534 lines
16 KiB
C#
534 lines
16 KiB
C#
|
using System;
|
|||
|
using System.Data;
|
|||
|
using System.IO;
|
|||
|
using System.Text;
|
|||
|
using System.Web;
|
|||
|
using System.Web.UI;
|
|||
|
using System.Web.UI.WebControls;
|
|||
|
using view.App_Code;
|
|||
|
using DeiNiu.wms.Logical;
|
|||
|
using DeiNiu.Utils;
|
|||
|
|
|||
|
public partial class EmployeeMain : PageBase
|
|||
|
{
|
|||
|
private LEmployee _logic;
|
|||
|
protected void Page_Init()
|
|||
|
{
|
|||
|
|
|||
|
PostBackTrigger trigger = new PostBackTrigger();
|
|||
|
trigger.ControlID = Button1.UniqueID;
|
|||
|
|
|||
|
// (Button)pnGridViewProcess.FindControl("btnExcel")).UniqueID.ToString();
|
|||
|
|
|||
|
// (UpdatePanel)(Page.Controls[0].FindControl("UpdatePanel1")).Triggers.Add(trigger);
|
|||
|
|
|||
|
((UpdatePanel)Master.FindControl("UpdatePanel1")).Triggers.Add(trigger);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
|
|||
|
_logic = new LEmployee();
|
|||
|
bindDeptTree();
|
|||
|
Databound();
|
|||
|
}
|
|||
|
SessionSeting();
|
|||
|
}
|
|||
|
|
|||
|
/***************************************** private methods ******************************************/
|
|||
|
|
|||
|
void bindDeptTree()
|
|||
|
{
|
|||
|
|
|||
|
DataView dvDept = new DataView(_logic.GetDepartments());
|
|||
|
|
|||
|
//װ<><D7B0>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>Žڵ<C5BD><DAB5>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
TreeDept.SelectedNode.ChildNodes.Clear();
|
|||
|
BindTree(TreeDept.SelectedNode.Value, TreeDept.SelectedNode, dvDept);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// bound the query list.
|
|||
|
/// </summary>
|
|||
|
private void Databound()
|
|||
|
{
|
|||
|
|
|||
|
//<2F><EFBFBD><F3B6A8B2><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD>еIJ<D0B5><C4B2><EFBFBD><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
bindGrid();
|
|||
|
|
|||
|
|
|||
|
|
|||
|
UpdateSession();
|
|||
|
// btnSubmit.Enabled = false;
|
|||
|
ClearDetail();
|
|||
|
}
|
|||
|
|
|||
|
private void SessionSeting()
|
|||
|
{
|
|||
|
if (IsPostBack)
|
|||
|
{
|
|||
|
_logic = (LEmployee)Session[appScope.PagelevelObj];
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void UpdateSession()
|
|||
|
{
|
|||
|
Session[appScope.PagelevelObj] = _logic;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// set data from shift object to page
|
|||
|
/// </summary>
|
|||
|
private void DetailDataBind()
|
|||
|
{
|
|||
|
DataDetail.Visible = true;
|
|||
|
txtAccount.ReadOnly = true;
|
|||
|
txtName.Text = _logic.GetEmployee.em_name;
|
|||
|
txtBirthday.Text = _logic.GetEmployee.em_birthday.ToString();
|
|||
|
txtCell.Text = _logic.GetEmployee.em_cellnum;
|
|||
|
|
|||
|
txtID.Text = _logic.GetEmployee.em_idnum;
|
|||
|
txtMail.Text = _logic.GetEmployee.em_email;
|
|||
|
//txtPasswd.Text = _logic.GetEmployee.em_passwd;
|
|||
|
txtAccount.Text = _logic.GetEmployee.em_account;
|
|||
|
lbSelectedDept.Text = TreeDept.SelectedNode.Text;
|
|||
|
drplstSex.Items.FindByValue("1").Selected = true;
|
|||
|
|
|||
|
if (_logic.GetEmployee.em_sex)
|
|||
|
{
|
|||
|
drplstSex.Items.FindByValue("0").Selected = false;
|
|||
|
drplstSex.Items.FindByValue("1").Selected = true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
drplstSex.Items.FindByValue("1").Selected = false;
|
|||
|
drplstSex.Items.FindByValue("0").Selected = true;
|
|||
|
}
|
|||
|
if (drplstEducation.Items.FindByValue(_logic.GetEmployee.em_education) != null)
|
|||
|
// drplstEducation.Items.FindByValue(_logic.GetEmployee.em_education).Selected=true; //ListItemColleciton can only select one item, if another has been selected, this will case error.
|
|||
|
SetDropDownlistSelection(drplstEducation, _logic.GetEmployee.em_education);
|
|||
|
|
|||
|
bindGV();
|
|||
|
|
|||
|
if (drlstPlitics.Items.FindByValue(_logic.GetEmployee.em_type) != null)
|
|||
|
//drlstPlitics.Items.FindByValue(_logic.GetEmployee.em_politic).Selected = true;
|
|||
|
SetDropDownlistSelection(drlstPlitics, _logic.GetEmployee.em_type);
|
|||
|
|
|||
|
// chkStatus.Checked = _logic.GetRole.dr;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void bindGV()
|
|||
|
{
|
|||
|
GvDept.DataSource = _logic.GetDepartments(_logic.GetEmployee.ID);
|
|||
|
GvDept.DataBind();
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/************************************** protected methods (event listeners) ********************************/
|
|||
|
|
|||
|
protected void btnAddnew_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if(TreeDept.SelectedValue == "0" )
|
|||
|
{
|
|||
|
ScriptManager.RegisterStartupScript(btnSubmit, typeof(UpdatePanel), "alert",
|
|||
|
"alert('<27><>ѡ<EFBFBD><D1A1><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>š<EFBFBD>');", true);
|
|||
|
return;
|
|||
|
}
|
|||
|
txtAccount.ReadOnly = false;
|
|||
|
chgOperTxt(true);
|
|||
|
_logic.Initialize();
|
|||
|
ClearDetail();
|
|||
|
GridView1.SelectedIndex = -1;
|
|||
|
Databound();
|
|||
|
txtTitle.Enabled = true;
|
|||
|
lbTitle.Visible = true;
|
|||
|
txtTitle.Visible = true;
|
|||
|
lbSelectedDept.Text = TreeDept.SelectedNode.Text;
|
|||
|
// DetailDataBind();
|
|||
|
DataDetail.Visible = true;
|
|||
|
bindGV();
|
|||
|
}
|
|||
|
|
|||
|
protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
|
|||
|
{
|
|||
|
chgOperTxt(false);
|
|||
|
if (GridView1.DataKeys != null)
|
|||
|
{
|
|||
|
string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString();
|
|||
|
_logic.Initialize(int.Parse(id));
|
|||
|
}
|
|||
|
Databound();
|
|||
|
DetailDataBind();
|
|||
|
}
|
|||
|
|
|||
|
protected void btnSubmit_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
bool userNotExist = true;
|
|||
|
SetDataBack();
|
|||
|
if (txtName.Text.Trim().Length == 0)
|
|||
|
{
|
|||
|
txtName.Focus();
|
|||
|
bindGrid();
|
|||
|
// ScriptManager.RegisterStartupScript(btnSubmit, typeof(UpdatePanel), "alert",
|
|||
|
// "alert('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');", true);
|
|||
|
return;
|
|||
|
|
|||
|
}
|
|||
|
if (txtAccount.Text.Trim().Length == 0)
|
|||
|
{
|
|||
|
txtAccount.Focus();
|
|||
|
bindGrid();
|
|||
|
// ScriptManager.RegisterStartupScript(btnSubmit, typeof (UpdatePanel), "alert",
|
|||
|
// "alert('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>˺š<CBBA>');", true);
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/*
|
|||
|
if(lem.GetEmployee.em_account !="mysec" )
|
|||
|
if (_logic != null)
|
|||
|
if (_logic.GetEmployee != null)
|
|||
|
if(_logic.GetEmployee.QueryActived().Tables[0].Rows.Count>20)
|
|||
|
return;
|
|||
|
*/
|
|||
|
|
|||
|
if (_logic != null)
|
|||
|
if (_logic.GetEmployee != null)
|
|||
|
if (_logic.GetEmployee.ID > 0)
|
|||
|
_logic.GetEmployee.Update();
|
|||
|
else
|
|||
|
{
|
|||
|
userNotExist = _logic.AddEmployee();
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
if (!userNotExist)
|
|||
|
{
|
|||
|
ScriptManager.RegisterStartupScript(btnSubmit, typeof (UpdatePanel), "alert",
|
|||
|
"alert('<27>û<EFBFBD><C3BB><EFBFBD> " + txtAccount.Text
|
|||
|
+ " <20>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룬<EFBFBD><EBA3AC><EFBFBD><EFBFBD>ʧ<EFBFBD>ܡ<EFBFBD>');", true);
|
|||
|
|
|||
|
bindGrid();
|
|||
|
|
|||
|
txtAccount.Text ="";
|
|||
|
txtAccount.Focus();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
ClearDetail();
|
|||
|
Databound();
|
|||
|
DataDetail.Visible = false;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
void bindGrid()
|
|||
|
{
|
|||
|
_logic.GetEmployee.em_dept = TreeDept.SelectedValue;
|
|||
|
DataView dv = TreeDept.SelectedValue != "0"
|
|||
|
? new DataView(_logic.GetActiveEmpByDept(Convert.ToInt32(TreeDept.SelectedValue)))
|
|||
|
: new DataView(_logic.GetActivedEmpDept());
|
|||
|
dv.RowFilter = "em_name <>'Root'";
|
|||
|
GridView1.DataSource = dv;
|
|||
|
GridView1.DataBind();
|
|||
|
|
|||
|
}
|
|||
|
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
if (GridView1 != null)
|
|||
|
{
|
|||
|
if (GridView1.DataKeys != null)
|
|||
|
{
|
|||
|
string id = GridView1.DataKeys[e.RowIndex].Value.ToString();
|
|||
|
_logic.Initialize(int.Parse(id));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
_logic.GetEmployee.Delete();
|
|||
|
ClearDetail();
|
|||
|
Databound();
|
|||
|
}
|
|||
|
|
|||
|
protected void GridView1_PageIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
|
|||
|
{
|
|||
|
GridView1.PageIndex = e.NewPageIndex;
|
|||
|
Databound();
|
|||
|
|
|||
|
//GridView1.DataSource = shiftLgc.getAllShifts().Tables[0];
|
|||
|
// GridView1.DataBind();
|
|||
|
}
|
|||
|
|
|||
|
protected void GridView1_DataBinding(object sender, EventArgs e)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
|
|||
|
{
|
|||
|
Label lb;
|
|||
|
switch (e.Row.RowType)
|
|||
|
{
|
|||
|
case DataControlRowType.DataRow:
|
|||
|
lb = new Label();
|
|||
|
lb.Text = e.Row.Cells[3].Text.Trim().Equals("True") ? "<22><>" : "Ů";
|
|||
|
e.Row.Cells[3].Controls.Add(lb);
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
//reset the page
|
|||
|
protected void btnCancel_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
_logic.Initialize();
|
|||
|
Page_Load(this, e);
|
|||
|
}
|
|||
|
|
|||
|
/***************************************** internal methods ********************************************/
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// set data from page to shift object
|
|||
|
/// </summary>
|
|||
|
private void SetDataBack()
|
|||
|
{
|
|||
|
// _logic.GetRole.operater = Session["CurrentUserID"].ToString(); todo: write a public method to handle operater,createtime,lastmodfied ... log info.
|
|||
|
|
|||
|
if ( _logic.GetEmployee.ID >0 )
|
|||
|
{
|
|||
|
// _logic.GetEmployee.lastmodified = DateTime.Now.ToString();
|
|||
|
|
|||
|
if(txtPasswd.Text.Trim().Length>0)
|
|||
|
_logic.GetEmployee.em_passwd = Util.Encrypt(txtPasswd.Text.Trim());
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_logic.GetEmployee.em_passwd = Util.Encrypt(txtPasswd.Text.Trim());
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// _logic.GetEmployee.dr = true;
|
|||
|
_logic.GetEmployee.em_name = txtName.Text;
|
|||
|
_logic.GetEmployee.em_account = txtAccount.Text;
|
|||
|
_logic.GetEmployee.em_birthday = txtBirthday.Text;
|
|||
|
_logic.GetEmployee.em_cellnum = txtCell.Text;
|
|||
|
|
|||
|
_logic.GetEmployee.em_education = drplstEducation.SelectedValue;
|
|||
|
_logic.GetEmployee.em_email = txtMail.Text;
|
|||
|
_logic.GetEmployee.em_idnum = txtID.Text;
|
|||
|
|
|||
|
_logic.GetEmployee.em_type = drlstPlitics.SelectedValue;
|
|||
|
_logic.GetEmployee.em_sex = drplstSex.SelectedIndex == 0;
|
|||
|
|
|||
|
|
|||
|
_logic.GetEmployee.em_dept = TreeDept.SelectedValue;
|
|||
|
_logic.GetEmployee.em_jobcode = txtTitle.Text;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void chgOperTxt(bool addNew)
|
|||
|
{
|
|||
|
DataDetail.Visible = true;
|
|||
|
lbEdit.Text = addNew ? "<22><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>¼" : "<22><EFBFBD><DEB8><EFBFBD><EFBFBD>м<EFBFBD>¼";
|
|||
|
btnSubmit.Enabled = true;
|
|||
|
}
|
|||
|
|
|||
|
private void ClearDetail()
|
|||
|
{
|
|||
|
lbEdit.Text = "";
|
|||
|
|
|||
|
txtName.Text = "" ;
|
|||
|
txtBirthday.Text = "";
|
|||
|
txtCell.Text = "";
|
|||
|
|
|||
|
txtID.Text = "";
|
|||
|
txtMail.Text ="";
|
|||
|
txtPasswd.Text ="";
|
|||
|
txtAccount.Text ="";
|
|||
|
txtTitle.Text = "";
|
|||
|
lbSelectedDept.Text = TreeDept.SelectedNode.Text;
|
|||
|
txtPasswd.Text = "";
|
|||
|
InitDropdownlist();
|
|||
|
//װ<><D7B0>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>Žڵ<C5BD><DAB5>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
// drlstPlitics.SelectedIndex = -1;
|
|||
|
DataDetail.Visible = false;
|
|||
|
}
|
|||
|
|
|||
|
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
chgOperTxt(false);
|
|||
|
if (GridView1.DataKeys != null)
|
|||
|
{
|
|||
|
string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString();
|
|||
|
_logic.Initialize(int.Parse(id));
|
|||
|
}
|
|||
|
lbTitle.Visible = false;
|
|||
|
txtTitle.Visible = false;
|
|||
|
Databound();
|
|||
|
DetailDataBind();
|
|||
|
txtTitle.Enabled = false;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
public void BindTree(string id, TreeNode pNode, DataView dv)
|
|||
|
{
|
|||
|
|
|||
|
dv.RowFilter = "dep_mastdept = '" + id + "'";
|
|||
|
foreach (DataRowView row in dv)
|
|||
|
{
|
|||
|
TreeNode node = new TreeNode();
|
|||
|
node.Text = row["dep_name"].ToString();
|
|||
|
node.Value = row["ID"].ToString();
|
|||
|
if (pNode == null)
|
|||
|
//˵<><CBB5><EFBFBD>Ǹ<EFBFBD><C7B8>ڵ<EFBFBD>
|
|||
|
{
|
|||
|
|
|||
|
TreeDept.Nodes.Add(node);
|
|||
|
node.Expanded = true;
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
pNode.ChildNodes.Add(node);
|
|||
|
node.Expanded = true;
|
|||
|
|
|||
|
}
|
|||
|
BindTree(node.Value, node, new DataView(dv.Table));
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
protected void TreeDept_SelectedNodeChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
/*
|
|||
|
DataView dv = new DataView(_logic.GetAllActiveData().Tables[0]);
|
|||
|
if(TreeDept.SelectedValue !="0")
|
|||
|
dv.RowFilter = "em_dept = '" + TreeDept.SelectedValue + "'";
|
|||
|
GridView1.DataSource = dv;
|
|||
|
GridView1.DataBind();
|
|||
|
ClearDetail();
|
|||
|
*/
|
|||
|
if (_logic != null) _logic.Initialize();
|
|||
|
GridView1.SelectedIndex = -1;
|
|||
|
Databound();
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
protected void drplstSex_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
ListItem selectedItem = drplstSex.Items[1];
|
|||
|
selectedItem.Selected = true;
|
|||
|
}
|
|||
|
|
|||
|
protected void InitDropdownlist()
|
|||
|
{
|
|||
|
|
|||
|
drplstSex.Items[ drplstSex.SelectedIndex].Selected = false;
|
|||
|
drplstSex.Items.FindByValue("1").Selected = true;
|
|||
|
|
|||
|
drlstPlitics.Items[drlstPlitics.SelectedIndex].Selected = false;
|
|||
|
drlstPlitics.Items[0].Selected = true;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
protected void SetDropDownlistSelection(DropDownList drdlst,string value)
|
|||
|
{
|
|||
|
drdlst.Items[drdlst.SelectedIndex].Selected = false;
|
|||
|
if (drdlst.Items.FindByValue(value)!=null)
|
|||
|
drdlst.Items.FindByValue(value).Selected = true;
|
|||
|
}
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>淽<EFBFBD><E6B7BD><EFBFBD>ᱨ<EFBFBD><E1B1A8><EFBFBD><EFBFBD><EFBFBD>͡<EFBFBD>GridView<65><77><EFBFBD>Ŀؼ<C4BF><D8BC><EFBFBD>GridView1<77><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ھ<EFBFBD><DABE><EFBFBD> runat=server <20>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
public override void VerifyRenderingInServerForm(Control control)
|
|||
|
{
|
|||
|
}
|
|||
|
protected void Excel_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
Master.ScriptMgr.RegisterPostBackControl(this.Button1);
|
|||
|
GridView1.AllowPaging = false;
|
|||
|
GridView1.Columns[11].Visible = false;
|
|||
|
Databound();
|
|||
|
Export("application/ms-excel", "WMSϵͳ<CFB5>û<EFBFBD><C3BB>б<EFBFBD>.xls");
|
|||
|
GridView1.AllowPaging = false;
|
|||
|
GridView1.Columns[11].Visible = true;
|
|||
|
Databound();
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void Export(string FileType, string FileName)
|
|||
|
{
|
|||
|
|
|||
|
Response.Charset = "GB2312";
|
|||
|
Response.ContentEncoding = Encoding.UTF7;
|
|||
|
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString());
|
|||
|
Response.ContentType = FileType;
|
|||
|
EnableViewState = false;
|
|||
|
StringWriter tw = new StringWriter();
|
|||
|
HtmlTextWriter hw = new HtmlTextWriter(tw);
|
|||
|
GridView1.RenderControl(hw);
|
|||
|
Response.Write(tw.ToString());
|
|||
|
Response.End();
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
protected void GvDept_RowUpdating(object sender, GridViewUpdateEventArgs e)
|
|||
|
{
|
|||
|
if (GvDept.DataKeys != null)
|
|||
|
{
|
|||
|
string id = GvDept.DataKeys[e.RowIndex].Value.ToString();
|
|||
|
|
|||
|
_logic.GetDeptEmp.ID = Convert.ToInt32(id);
|
|||
|
_logic.GetDeptEmp.getModel();
|
|||
|
|
|||
|
_logic.GetDeptEmp.de_title = ((TextBox)GvDept.Rows[e.RowIndex].Cells[3].Controls[1]).Text;
|
|||
|
|
|||
|
//_logic.GetTrainingDetail.operater =
|
|||
|
_logic.GetDeptEmp.Update();
|
|||
|
}
|
|||
|
GvDept.EditIndex = -1;
|
|||
|
GvDept.SelectedIndex = e.RowIndex;
|
|||
|
bindGV();
|
|||
|
}
|
|||
|
protected void GvDept_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
|
|||
|
{
|
|||
|
GvDept.EditIndex = -1;
|
|||
|
GvDept.SelectedIndex = e.RowIndex;
|
|||
|
bindGV();
|
|||
|
}
|
|||
|
protected void GvDept_RowEditing(object sender, GridViewEditEventArgs e)
|
|||
|
{
|
|||
|
GvDept.EditIndex = e.NewEditIndex;
|
|||
|
GvDept.SelectedIndex = e.NewEditIndex;
|
|||
|
bindGV();
|
|||
|
}
|
|||
|
|
|||
|
}
|