Пример #1
0
        protected void rptDepatments_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "edit_item")
            {
                if (iBiz.FinPro.Rights.edit_department)
                {
                    int deptId = Convert.ToInt32(e.CommandArgument);
                    iBiz.FinPro.Modules.Departments bDept = new iBiz.FinPro.Modules.Departments();
                    iBiz.FinPro.Modules.Departments.objfin_Departments objDept = new iBiz.FinPro.Modules.Departments.objfin_Departments();

                    objDept = bDept.Select(deptId);

                    if (objDept != null)
                    {
                        hfDeptId.Value         = objDept.deptId.ToString();
                        tbDeptCode.Text        = objDept.deptCode;
                        tbDeptDescription.Text = objDept.deptDescription;
                        tbDeptTitle.Text       = objDept.deptTitle;
                        mpeNewAccount.Show();
                    }
                    else
                    {
                        rnNotify.Show("Department doesn't exist.");
                    }
                }
            }
        }
Пример #2
0
        protected void lbtnSubmit_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                iBiz.FinPro.Modules.Departments bDept = new iBiz.FinPro.Modules.Departments();
                iBiz.FinPro.Modules.Departments.objfin_Departments objDept = new iBiz.FinPro.Modules.Departments.objfin_Departments();

                objDept.deptCode        = tbDeptCode.Text;
                objDept.deptDescription = tbDeptDescription.Text;
                objDept.deptTitle       = tbDeptTitle.Text;

                if (!string.IsNullOrEmpty(hfDeptId.Value))
                {
                    objDept.deptId = Convert.ToInt32(hfDeptId.Value);
                    bDept.Update(objDept);
                    rnNotify.Show("Department has been updated.");
                }
                else
                {
                    bDept.Add(objDept);
                    rnNotify.Show("Department has been created.");
                }

                hfDeptId.Value         = null;
                tbDeptTitle.Text       = "";
                tbDeptDescription.Text = "";
                tbDeptCode.Text        = "";

                Load_Departments();
            }
        }