protected void listChiTiet_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e)
        {
            string          s     = e.Parameters.ToString();
            List <UnitInfo> lsEmp = new List <UnitInfo>();

            foreach (string sItem in s.Split(','))
            {
                if (string.IsNullOrEmpty(sItem))
                {
                    continue;
                }
                decimal id = Convert.ToDecimal(sItem);
                unit = objUnit.GetUnit(id);
                lsEmp.Add(unit);
            }

            listChiTiet.DataSource = lsEmp;
            listChiTiet.DataBind();
        }
 protected void listChiTiet_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
 {
     if (e.DataColumn.FieldName == "parentid")
     {
         ASPxLabel lbldonVi = listChiTiet.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lblDV") as ASPxLabel;
         {
             if (e.CellValue != null)
             {
                 unit = objUnit.GetUnit(Int32.Parse(e.CellValue.ToString()));
                 if (unit != null)
                 {
                     if (lbldonVi != null)
                     {
                         lbldonVi.Text = unit.name;
                     }
                 }
             }
         }
     }
 }
Beispiel #3
0
        protected void listChiTiet_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
        {
            if (e.DataColumn.FieldName == "positionid")
            {
                ASPxLabel lblChucVu = listChiTiet.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lblCV") as ASPxLabel;
                {
                    VNPT.Modules.Position.PositionController objPosition = new VNPT.Modules.Position.PositionController();
                    if (e.CellValue != null)
                    {
                        position = objPosition.GetPosition(Int32.Parse(e.CellValue.ToString()));
                        if (position != null)
                        {
                            if (lblChucVu != null)
                            {
                                lblChucVu.Text = position.name;
                            }
                        }
                    }
                }
            }

            if (e.DataColumn.FieldName == "unitid")
            {
                ASPxLabel lbldonVi = listChiTiet.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lblDV") as ASPxLabel;
                {
                    if (e.CellValue != null)
                    {
                        unit = objUnit.GetUnit(Int32.Parse(e.CellValue.ToString()));
                        if (unit != null)
                        {
                            if (lbldonVi != null)
                            {
                                UnitInfo parentUnit = objUnit.GetUnit(unit.parentid);
                                lbldonVi.Text = unit.name + " -- " + parentUnit.name;
                            }
                        }
                    }
                }
            }
        }
        void CreateNodes()
        {
            VNPT.Modules.Employees.EmployeesInfo emp = objEmployees.GetEmployeeByCode(this.UserInfo.Username);
            if (emp != null)
            {
                if (UserInfo.IsInRole("ToChucVTT")) // vien thong tinh
                {
                    List <VNPT.Modules.Unit.UnitInfo> list = objUnit.GetParentUnits();
                    foreach (VNPT.Modules.Unit.UnitInfo u in list)
                    {
                        string       k1   = "u" + u.id;
                        TreeListNode root = CreateNodeRoot(k1, "frontpage", "<font size='2' face='Tahoma'><b>&nbsp;" + u.name + "</b></font>");
                        root.Expanded = true;

                        List <VNPT.Modules.Unit.UnitInfo> listChild = objUnit.GetChildUnits(u.id);
                        foreach (VNPT.Modules.Unit.UnitInfo u1 in listChild)
                        {
                            string       k2    = "u" + u1.id;
                            TreeListNode root1 = CreateNodeCore(k2, "home", "<font size='2' face='Tahoma'><b>&nbsp;" + u1.name + "</b></font>", root, "");
                        }
                    }
                }
                else
                {
                    VNPT.Modules.Unit.UnitInfo u = objUnit.GetUnit(objUnit.GetUnit(emp.unitid).parentid);
                    string       k1   = "u" + u.id;
                    TreeListNode root = CreateNodeRoot(k1, "frontpage", "<font size='2' face='Tahoma'><b>&nbsp;" + u.name + "</b></font>");
                    root.Expanded = true;
                    List <VNPT.Modules.Unit.UnitInfo> listChild = objUnit.GetChildUnits(u.id);
                    foreach (VNPT.Modules.Unit.UnitInfo u1 in listChild)
                    {
                        string       k2    = "u" + u1.id;
                        TreeListNode root1 = CreateNodeCore(k2, "home", "<font size='2' face='Tahoma'><b>&nbsp;" + u1.name + "</b></font>", root, "");
                    }
                }
            }

            treeList.SettingsBehavior.AllowFocusedNode = true;
        }
 public void UpdateUnit(UnitInfo objUnit)
 {
     DataProvider.Instance().UpdateUnit(objUnit);
 }
 public void DeleteUnit(UnitInfo objUnit)
 {
     DataProvider.Instance().DeleteUnit(objUnit);
 }
 public void AddUnit(UnitInfo objUnit)
 {
     DataProvider.Instance().AddUnit(objUnit);
 }