Пример #1
0
        public void LoadDepartmentDropDownList()
        {
            try
            {
                DepartmentTableBody.InnerHtml = "";
                string htmlContent = "";
                List<Department> departmentList = new List<Department>();
                Department aDepartment = new Department();
                departmentList = aDepartment.GetAllDepartment(_company.CompanyId);
                foreach (Department aDepo in departmentList)
                {
                    string CompanyName = "";
                    htmlContent += "<tr>";
                    foreach (Company acompany in companyList)
                    {
                        if (acompany.CompanyId == aDepo.CompanyId)
                        {
                            CompanyName += acompany.CompanyName;
                            break;
                        }
                    }

                    htmlContent += String.Format(@"<th>{0}</th><th>{1}</th><th>{2}</th><th>{3}</th><th>{4}</th></tr>", aDepo.DepartmentName, aDepo.ParentDepartmentId, aDepo.IsActive, aDepo.UpdateBy, aDepo.UpdateDate);
                }
                DepartmentTableBody.InnerHtml += htmlContent;

            }
            catch (Exception exp)
            {
                Alert.Show(exp.Message);
            }
        }
 public void LoadDepartmentDropDownList()
 {
     Department newDeg = new Department();
     List<Department> newDegList = newDeg.GetAllDepartment(_company.CompanyId);
     departmentDropDownList.DataSource = newDegList;
     departmentDropDownList.DataTextField = "DepartmentName";
     departmentDropDownList.DataValueField = "DepartmentId";
     departmentDropDownList.DataBind();
 }
        public void LoadDepartmentDropDownList()
        {
            List<Department> departmentList=new List<Department>();
            Department aDepartment=new Department();

            departmentList= aDepartment.GetAllDepartment(0);
            departmentIdRadDropDownList.DataSource = departmentList;
            departmentIdRadDropDownList.DataTextField = "DepartmentName";
            departmentIdRadDropDownList.DataValueField = "DepartmentId";
            departmentIdRadDropDownList.DataBind();
        }
Пример #4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Department aDepartmnent = new Department();
                List<Department> departmentList = aDepartmnent.GetAllDepartment(_company.CompanyId);
                Department tempDepartment = departmentList[departmentList.Count - 1];
                int id = tempDepartment.DepartmentId + 1;
                aDepartmnent.DepartmentId = id;
                aDepartmnent.ParentDepartmentId = id;

                aDepartmnent.DepartmentName = txtDepartmentName.Value;

                aDepartmnent.UpdateDate = DateTime.Now;
                aDepartmnent.UpdateBy = user.UserId;

                aDepartmnent.IsActive = true;
                aDepartmnent.CompanyId = _company.CompanyId;
                int success = aDepartmnent.InsertDepartment();
                if (success > 0)
                {
                    Session["savedDepartmentMessage"] = "Saved Department Information successfully";
                    Response.Redirect(Request.RawUrl);

                }
                else
                {
                    Alert.Show("Error Occured while inserting a new user");
                }
                this.Clear();
            }
            catch (Exception ex)
            {
                Alert.Show(ex.Message);
            }
        }
        private void LoadDepartmentTable()
        {
            try
            {

                Department objDepartment = new Department();
                departmentsList = objDepartment.GetAllDepartment(_company.CompanyId);
                if (departmentsList.Count == 0)
                    departmentsList.Add(new Department());

                RadGrid1.DataSource = departmentsList;
                RadGrid1.Rebind();
            }
            catch (Exception ex)
            {
                Alert.Show(ex.Message);
            }
        }
        void LoadParentDepartmentIdDropDown()
        {
            Department dep=new Department();
            List<Department> depList = dep.GetAllDepartment(_company.CompanyId);
            List<string> idList = new List<string>();

            foreach (Department depoo in depList)
            {

                idList.Add(depoo.DepartmentName);
            }
            ParentDepartmentDropDownList.DataSource = idList.Distinct();
            ParentDepartmentDropDownList.DataBind();
        }