Ejemplo n.º 1
0
        protected void SaveDept()
        {
            bool success;

            if (uclAdminEdit.IsNew)
            {
                BUSINESS_ORG busOrg  = (BUSINESS_ORG)SessionManager.EffLocation.BusinessOrg;
                DEPARTMENT   deptNew = new DEPARTMENT();
                deptNew = uclAdminEdit.ReadDepartment(deptNew);
                LocalOrg().DeptList.Add(SQMModelMgr.CreateDepartment(entities, busOrg, deptNew, SessionManager.UserContext.UserName()));
            }
            else
            {
                DEPARTMENT dept = (DEPARTMENT)LocalOrg().EditObject;
                dept = uclAdminEdit.ReadDepartment(dept);
                SQMModelMgr.UpdateDepartment(entities, dept, SessionManager.UserContext.UserName());
                LocalOrg().DeptList[LocalOrg().DeptList.FindIndex(d => (d.DEPT_ID == dept.DEPT_ID))] = dept;
            }

            LocalOrg().EditObject = null;
            DoDeptList();
            pnlAdminEdit.Visible = false;
        }
        protected void SaveDept()
        {
            bool success;

            if (uclAdminEdit.IsNew)
            {
                PLANT      plant   = (PLANT)SessionManager.EffLocation.Plant;
                DEPARTMENT deptNew = new DEPARTMENT();
                deptNew = uclAdminEdit.ReadDepartment(deptNew);
                LocalOrg().DeptList.Add(SQMModelMgr.CreateDepartment(entities, plant, deptNew, SessionManager.UserContext.UserName()));
            }
            else
            {
                DEPARTMENT dept = (DEPARTMENT)LocalOrg().EditObject;
                dept = SQMModelMgr.LookupDepartment(entities, (decimal)dept.COMPANY_ID, (decimal)dept.BUS_ORG_ID, (decimal)dept.PLANT_ID, (decimal)dept.DEPT_ID, "", false);
                dept = uclAdminEdit.ReadDepartment(dept);
                SQMModelMgr.UpdateDepartment(entities, dept, SessionManager.UserContext.UserName());
                LocalOrg().DeptList[LocalOrg().DeptList.FindIndex(d => (d.DEPT_ID == dept.DEPT_ID))] = dept;
            }

            LocalOrg().EditObject = null;
            DoDeptList();
            pnlAdminEdit.Visible = false;
        }