PageRenderTime 225ms CodeModel.GetById 220ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/admins/Config.aspx.cs

http://github.com/gmhawash/SSR
C# | 91 lines | 78 code | 13 blank | 0 comment | 7 complexity | 7791aae6730934d44bb5bb3fc57aaf3c MD5 | raw file
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using System.Web;
 5using System.Web.UI;
 6using System.Web.UI.WebControls;
 7using System.Data;
 8using System.Web.UI.WebControls.WebParts;
 9using System.Web.UI.HtmlControls;
10using System.Data.SqlClient;
11using System.Data.Common;
12
13
14public partial class admins_Default2 : ZaytonaClasses.ZPage
15{
16  protected void Page_Load(object sender, EventArgs e)
17  {
18
19  }
20
21
22  protected void NoDataInsert_Click(object sender, EventArgs e)
23  {
24      TextBox tbCode = DeptGridView.Controls[0].Controls[0].FindControl("NoDataCode") as TextBox;
25      TextBox tbDescription = DeptGridView.Controls[0].Controls[0].FindControl("NoDataDescription") as TextBox;
26
27      DeptsBLL deptBll = new DeptsBLL();
28      deptBll.AddDept(tbCode.Text, tbDescription.Text);
29      DeptGridView.DataBind();
30  }
31
32  protected void InsertNew_Click(object sender, EventArgs e)
33  {
34    TextBox tbCode = DeptGridView.FooterRow.FindControl("InsertCode") as TextBox;
35    TextBox tbDescription = DeptGridView.FooterRow.FindControl("InsertDescription") as TextBox;
36
37    DeptsBLL deptBll = new DeptsBLL();
38    deptBll.AddDept(tbCode.Text, tbDescription.Text);
39    DeptGridView.DataBind();
40  }
41  
42  protected void GroupInsert(TextBox tb1, TextBox tb2, DropDownList dd)
43  {
44    try
45    {
46      GroupsBLL groupBll = new GroupsBLL();
47      groupBll.AddGroup(tb1.Text, tb2.Text, new Guid(dd.SelectedItem.Value));
48      GroupGridView.DataBind();
49    }
50    catch (Exception e)
51    {
52      Flash.Text = e.Message;
53      Flash.Visible = true;
54    }
55 }
56  
57  protected void GroupInsert_Click(object sender, EventArgs e)
58  {
59    if (((LinkButton)sender).ID == "InsertFirst")
60    {
61      TextBox tb1 = GroupGridView.Controls[0].Controls[0].FindControl("GroupFirstCode") as TextBox;
62      TextBox tb2 = GroupGridView.Controls[0].Controls[0].FindControl("GroupFirstName") as TextBox;
63      DropDownList dd = GroupGridView.Controls[0].Controls[0].FindControl("GroupFirstDeptId") as DropDownList;
64      GroupInsert(tb1, tb2, dd);
65
66    }
67    else if (((LinkButton)sender).ID == "InsertNew")
68    {
69      TextBox tb1 = GroupGridView.FooterRow.FindControl("GroupCode") as TextBox;
70      TextBox tb2 = GroupGridView.FooterRow.FindControl("GroupName") as TextBox;
71      DropDownList dd = GroupGridView.FooterRow.FindControl("GroupDeptId") as DropDownList;
72      GroupInsert(tb1, tb2, dd);
73
74    }
75  }
76  protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
77  {
78    TextBox tb1 = GroupGridView.FooterRow.FindControl("GroupCode") as TextBox;
79    
80  }
81  protected void GroupGridView_RowUpdated(object sender, GridViewUpdatedEventArgs e)
82  {
83    if (e.Exception != null)
84    {
85      Flash.Visible = true;
86      Flash.Text = e.Exception.Message;
87      e.ExceptionHandled = true;
88      e.KeepInEditMode = true;
89    }
90  }
91}