protected void grid_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            ASPxComboBox    cboOffice        = grid.FindEditFormTemplateControl("cboOffice") as ASPxComboBox;
            ASPxTextBox     textId           = grid.FindEditFormTemplateControl("txtId") as ASPxTextBox;
            ASPxComboBox    cboState         = grid.FindEditFormTemplateControl("cboState") as ASPxComboBox;
            ASPxComboBox    cboEmp           = grid.FindEditFormTemplateControl("cboEmp") as ASPxComboBox;
            ASPxHiddenField ASPxHiddenField1 = grid.FindEditFormTemplateControl("ASPxCallbackPanel21").FindControl("ASPxHiddenField1") as ASPxHiddenField;

            if (ASPxHiddenField1.Count > 0)
            {
                this.emp.id     = -1;
                this.emp.empid  = Int32.Parse(ASPxHiddenField1.Get("value").ToString());
                this.emp.uid    = objEmployees.GetEmployees(Int32.Parse(ASPxHiddenField1.Get("value").ToString())).unitid;
                this.emp.unitid = objUnit.GetUnit(objEmployees.GetEmployees(Int32.Parse(ASPxHiddenField1.Get("value").ToString())).unitid).parentid;

                this.emp.officeid          = Int32.Parse(cboOffice.SelectedItem.Value.ToString());
                this.emp.statemanagementid = Int32.Parse(cboState.SelectedItem.Value.ToString());
                this.objectEmp.AddEmpOffice(emp);
            }

            grid.CancelEdit();
            e.Cancel = true;
            if (Session["Id"] != null)
            {
                grid.DataSource = objectEmp.GetEmpOfficeByUnit(Int32.Parse(Session["Id"].ToString()));
                grid.DataBind();
            }
            else
            {
                grid.DataSource = objectEmp.GetEmpOffices();
                grid.DataBind();
            }
        }
示例#2
0
        protected void grid_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            ASPxTextBox     txtLuongCB     = grid.FindEditFormTemplateControl("txtLuongCB") as ASPxTextBox;
            ASPxDateEdit    txtThoiDiem    = grid.FindEditFormTemplateControl("txtThoiDiem") as ASPxDateEdit;
            ASPxHiddenField HiddentfileKem = grid.FindEditFormTemplateControl("HiddentfileKem") as ASPxHiddenField;
            ASPxTextBox     txtQuyetDinh   = grid.FindEditFormTemplateControl("txtQuyetDinh") as ASPxTextBox;

            this.luongcb.id       = -1;
            this.luongcb.luongcb  = Convert.ToDecimal(txtLuongCB.Text.Trim());
            this.luongcb.thoidiem = txtThoiDiem.Date;
            this.luongcb.soqd     = txtQuyetDinh.Text.Trim();
            if (HiddentfileKem.Count > 0)
            {
                this.luongcb.fileKem = "LCB" + DateTime.Now.ToShortDateString().Replace("/", "_") + "_" + HiddentfileKem.Get("filekem").ToString();
            }
            this.objBaoHiem.AddLuongCB(luongcb);

            grid.CancelEdit();
            e.Cancel             = true;
            this.grid.DataSource = objBaoHiem.GetLuongCBs();
            this.grid.DataBind();
        }