public static void LoadForCurItemForExportNew(DataTable dt, DataRow curItem, int idTrungTam, int idPhongBan, int loai, int idDotDanhGia) { int curId = ConvertUtility.ToInt32(curItem["ID"]); int level = ConvertUtility.ToInt32(curItem["Level"]); level++; DataTable dtChildZones = GetAllByParentIDNew(curId, idTrungTam, idPhongBan, loai, idDotDanhGia); if (dtChildZones == null) { return; } foreach (DataRow row in dtChildZones.Rows) { DataRow _row = dt.NewRow(); _row["ID"] = row["ID"].ToString(); _row["Ten"] = MiscUtility.StringIndent(level) + row["Ten"].ToString(); _row["TyTrong"] = ConvertUtility.ToString(row["TyTrong"]).ToString().Replace(",", "."); _row["SoGio"] = Math.Round(ConvertUtility.ToDouble(row["SoGio"]), 3).ToString(); _row["KeHoach"] = row["KeHoach"].ToString(); _row["DonViDo"] = row["DonViDo"].ToString(); _row["Level"] = level; _row["Bold"] = "0"; _row["Ma"] = row["Ma"].ToString(); dt.Rows.Add(_row); LoadForCurItemForExportNew(dt, _row, idTrungTam, idPhongBan, loai, idDotDanhGia); } }
public static void LoadForCurItemChuaDuocGiao(ListItemCollection lstItems, ListItem curItem, int idTrungTam, int idPhongBan, int idDotDanhGia) { int curId = ConvertUtility.ToInt32(curItem.Value); int level = ConvertUtility.ToInt32(curItem.Attributes["Level"]); level++; DataTable dtChildZones = GetAllByParentID(curId, idTrungTam, idPhongBan); if (dtChildZones == null) { return; } foreach (DataRow row in dtChildZones.Rows) { DataTable dt = DotDanhGiaController.GetAllNhanVienTheoCongViec(ConvertUtility.ToInt32(row["ID"].ToString()), idDotDanhGia); ListItem item; if (dt != null && dt.Rows.Count > 0 && ConvertUtility.ToInt32(dt.Rows[0][0]) > 0) { item = new ListItem(MiscUtility.StringIndent(level) + "(" + row["TyTrong"].ToString() + "%) " + row["Ten"].ToString(), row["ID"].ToString()); item.Attributes.Add("Level", level.ToString()); //item.Attributes.Add("style", "color:red"); lstItems.Add(item); } else { item = new ListItem(MiscUtility.StringIndent(level) + "(" + row["TyTrong"].ToString() + "%) " + row["Ten"].ToString(), row["ID"].ToString()); item.Attributes.Add("Level", level.ToString()); item.Attributes.Add("style", "color:red"); lstItems.Add(item); } LoadForCurItemChuaDuocGiao(lstItems, item, idTrungTam, idPhongBan, idDotDanhGia); } }
public static void LoadForCurItemForExport(DataTable dt, DataRow curItem, int idTrungTam, int idPhongBan) { int curId = ConvertUtility.ToInt32(curItem["ID"]); int level = ConvertUtility.ToInt32(curItem["Level"]); level++; DataTable dtChildZones = GetAllByParentID(curId, idTrungTam, idPhongBan); if (dtChildZones == null) { return; } foreach (DataRow row in dtChildZones.Rows) { DataRow _row = dt.NewRow(); _row["ID"] = row["ID"].ToString(); _row["Ten"] = MiscUtility.StringIndent(level) + row["Ten"].ToString(); _row["TyTrong"] = row["TyTrong"].ToString(); _row["KeHoach"] = row["KeHoach"].ToString(); _row["DonViDo"] = row["DonViDo"].ToString(); _row["Level"] = level; _row["Bold"] = "0"; dt.Rows.Add(_row); LoadForCurItemForExport(dt, _row, idTrungTam, idPhongBan); } }
private void LoadChildFunctions(List <FunctionInfo> lstFunctions, FunctionInfo curFunc) { int level = curFunc.GetLevel() + 1; var lstChilds = FunctionRepository.GetChild(curFunc.FunctionID); foreach (FunctionInfo func in lstChilds) { func.SetLevel(level); func.Name = MiscUtility.StringIndent(level) + func.Name; lstFunctions.Add(func); LoadChildFunctions(lstFunctions, func); } }
private static DataTable LoadKeHoachCongViecForCur(DataTable dtCongViec, DataRow curItem, DataTable dtReturnCongViec) { int level = Convert.ToInt32(curItem["Level"]); level += 1; int ID = Convert.ToInt32(curItem["ID"]); DataRow[] dtChild = GetCongViecByParentID(dtCongViec, ID); foreach (DataRow row in dtChild) { DataRow childItem = dtReturnCongViec.NewRow(); childItem["CreateBy"] = row["CreateBy"].ToString(); childItem["CongViecKPI"] = row["CongViecKPI"].ToString(); childItem["CongViecCha"] = row["CongViecCha"].ToString(); childItem["TyTrong"] = row["TyTrong"].ToString(); childItem["SoGio"] = row["SoGio"].ToString(); childItem["TyLeHoanThanh"] = row["TyLeHoanThanh"].ToString(); childItem["KetQua"] = row["KetQua"].ToString(); childItem["LyDo"] = row["LyDo"].ToString(); childItem["DeXuat"] = row["DeXuat"].ToString(); childItem["Level"] = level; childItem["ID"] = row["ID"].ToString(); childItem["IDTrungTam"] = row["IDTrungTam"].ToString(); childItem["IDPhongBan"] = row["IDPhongBan"].ToString(); childItem["ParentID"] = row["ParentID"].ToString(); if (level == 1) { childItem["Ten"] = MiscUtility.StringIndent(level) + "<font color=\"Black\">" + row["Ten"].ToString() + "</font>"; } else if (level == 2) { childItem["Ten"] = MiscUtility.StringIndent(level) + "<font color=\"Orange\">" + row["Ten"].ToString() + "</font>"; } else if (level == 3) { childItem["Ten"] = MiscUtility.StringIndent(level) + "<font color=\"Orange\">" + row["Ten"].ToString() + "</font>"; } else if (level > 3) { childItem["Ten"] = MiscUtility.StringIndent(level) + "<font color=\"Gray\">" + row["Ten"].ToString() + "</font>"; } dtReturnCongViec.Rows.Add(childItem); LoadKeHoachCongViecForCur(dtCongViec, childItem, dtReturnCongViec); } return(dtReturnCongViec); }
public static void LoadForCurItem(ListItemCollection lstItems, ListItem curItem) { int curId = ConvertUtility.ToInt32(curItem.Value); int level = ConvertUtility.ToInt32(curItem.Attributes["Level"]); level++; DataTable dtChildRoles = GetRolesByParentId(curId); foreach (DataRow row in dtChildRoles.Rows) { ListItem item = new ListItem(MiscUtility.StringIndent(level) + row["RoleName"].ToString(), row["RoleID"].ToString()); item.Attributes.Add("Level", level.ToString()); lstItems.Add(item); LoadForCurItem(lstItems, item); } }
public static void LoadForCurItemForRadCombo(ListItemCollection lstItems, ListItem curItem, int userId) { int curId = ConvertUtility.ToInt32(curItem.Value); int level = ConvertUtility.ToInt32(curItem.Attributes["Level"]); level++; DataTable dtChildZones = GetPortalsByParentId(userId, curId); foreach (DataRow row in dtChildZones.Rows) { ListItem item = new ListItem(MiscUtility.StringIndent(level) + row["Portal_Name"].ToString(), row["PortalID"].ToString()); item.Attributes.Add("Level", level.ToString()); lstItems.Add(item); LoadForCurItemForRadCombo(lstItems, item, userId); } }
/// <summary> /// Load role permission for current item /// </summary> /// <param name="dtCommand"></param> /// <param name="curItem"></param> /// <param name="dtReturnCommand"></param> /// <returns></returns> public static DataTable LoadRolePermissionForCur(DataTable dtCommand, DataRow curItem, DataTable dtReturnCommand) { int level = Convert.ToInt32(curItem["Level"]); level += 1; int _commandID = Convert.ToInt32(curItem["CommandID"]); DataRow[] dtChild = GetRolePermissionByParentID(dtCommand, _commandID); foreach (DataRow row in dtChild) { DataRow childItem = dtReturnCommand.NewRow(); childItem["CommandID"] = row["CommandID"].ToString(); childItem["CommandParentID"] = row["CommandParentID"].ToString(); childItem["PortalID"] = row["PortalID"].ToString(); childItem["RoleID"] = row["RoleID"].ToString(); if (level == 1) { childItem["CommandName"] = MiscUtility.StringIndent(level) + "<font color=\"Red\">" + row["CommandName"].ToString() + "</font>"; } else if (level == 2) { childItem["CommandName"] = MiscUtility.StringIndent(level) + "<font color=\"Orange\">" + row["CommandName"].ToString() + "</font>"; } else if (level == 3) { childItem["CommandName"] = MiscUtility.StringIndent(level) + "<font color=\"Black\">" + row["CommandName"].ToString() + "</font>"; } else if (level > 3) { childItem["CommandName"] = MiscUtility.StringIndent(level) + "<font color=\"Gray\">" + row["CommandName"].ToString() + "</font>"; } childItem["Role_View"] = row["Role_View"].ToString(); childItem["Role_Add"] = row["Role_Add"].ToString(); childItem["Role_Update"] = row["Role_Update"].ToString(); childItem["Role_Delete"] = row["Role_Delete"].ToString(); //childItem["UseForWeb"] = row["UseForWeb"].ToString(); //childItem["UseForWap"] = row["UseForWap"].ToString(); //childItem["UseForSMS"] = row["UseForSMS"].ToString(); //childItem["UseForXzone"] = row["UseForXzone"].ToString(); childItem["Level"] = level.ToString(); dtReturnCommand.Rows.Add(childItem); LoadRolePermissionForCur(dtCommand, childItem, dtReturnCommand); } return(dtReturnCommand); }
private static void LoadCmdItem(ListItemCollection lstCmds, ListItem curItem) { int level = Convert.ToInt32(curItem.Attributes["Level"]); level += 1; int curID = Convert.ToInt32(curItem.Value); DataTable dtChild = GetByParentID(curID); foreach (DataRow row in dtChild.Rows) { ListItem childItem = new ListItem(); childItem.Text = MiscUtility.StringIndent(level) + row["Cmd_Name"].ToString(); childItem.Value = row["Cmd_ID"].ToString(); childItem.Attributes.Add("Level", level.ToString()); lstCmds.Add(childItem); LoadCmdItem(lstCmds, childItem); } }
private void BuildCongViec() { dropCongViecKPI.Items.Clear(); DataTable dtCongViec = DotDanhGiaController.GetAllCongViecGiaoChoNhanVienTheoNgay(CurrentUser.UserID, ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue)); DataTable dtCongViecClone = dtCongViec.Clone(); foreach (DataRow item in dtCongViec.Rows) { DataTable lstCongViec = new DataTable(); lstCongViec.Columns.Add("IDCongViecKPI", typeof(string)); lstCongViec.Columns.Add("Ten", typeof(string)); lstCongViec.Columns.Add("ParentID", typeof(string)); lstCongViec.Columns.Add("LevelDeep", typeof(string)); GetTenCongViec(lstCongViec, ConvertUtility.ToInt32(item["IDCongViecKPI"]), ConvertUtility.ToString(item["Ten"]), ConvertUtility.ToInt32(item["ParentID"]), ConvertUtility.ToInt32(item["LevelDeep"])); lstCongViec = resort(lstCongViec, "LevelDeep", "DESC"); int i = 0; foreach (DataRow _item in lstCongViec.Rows) { DataRow row = dtCongViecClone.NewRow(); row["IDCongViecKPI"] = item["IDCongViecKPI"]; row["Ten"] = MiscUtility.StringIndent(i) + _item["Ten"]; ListItem itemStyle = new ListItem(); itemStyle.Text = MiscUtility.StringIndent(i) + _item["Ten"]; itemStyle.Value = item["IDCongViecKPI"].ToString(); if (i == lstCongViec.Rows.Count - 1) { itemStyle.Attributes.Add("style", "font-weight:bold; color:blue"); } else { itemStyle.Attributes.Add("style", "font-style: italic;"); } dropCongViecKPI.Items.Add(itemStyle); i++; } } dropCongViecKPI.Items.Add(new ListItem("Công việc khác hoặc công việc phát sinh", "0")); }
private static void LoadForCurListItem(ListItemCollection lstItems, ListItem curItem, DataTable source, bool superUser) { int curCommandId = ConvertUtility.ToInt32(curItem.Value); int level = ConvertUtility.ToInt32(curItem.Attributes["Level"]); level++; DataRow[] drChildCommands = source.Select("CommandParentID = " + curCommandId); foreach (DataRow row in drChildCommands) { if (!superUser && (bool)row["IsSuperUser"]) { continue; } ListItem item = new ListItem(MiscUtility.StringIndent(level) + row["CommandName"].ToString(), row["CommandID"].ToString()); item.Attributes.Add("Level", level.ToString()); lstItems.Add(item); LoadForCurListItem(lstItems, item, source, superUser); } }
public static void LoadForCurItem(ListItemCollection lstItems, ListItem curItem, int idTrungTam) { int curId = ConvertUtility.ToInt32(curItem.Value); int level = ConvertUtility.ToInt32(curItem.Attributes["Level"]); level++; DataTable dtChildZones = GetAllByParentID(curId, idTrungTam); if (dtChildZones == null) { return; } foreach (DataRow row in dtChildZones.Rows) { ListItem item = new ListItem(MiscUtility.StringIndent(level) + row["Ten"].ToString(), row["ID"].ToString()); item.Attributes.Add("Level", level.ToString()); lstItems.Add(item); LoadForCurItem(lstItems, item, idTrungTam); } }
public static void LoadForCurItem(ListItemCollection lstItems, ListItem curItem, int idTrungTam, int idPhongBan, DateTime dt, int idDotDanhGia, int UserID) { int curId = ConvertUtility.ToInt32(curItem.Value); int level = ConvertUtility.ToInt32(curItem.Attributes["Level"]); level++; DataTable dtChildZones = GetAllByParentID(curId, idTrungTam, idPhongBan, dt, idDotDanhGia, UserID); if (dtChildZones == null) { return; } foreach (DataRow row in dtChildZones.Rows) { ListItem item = new ListItem(MiscUtility.StringIndent(level) + "(" + Math.Round(ConvertUtility.ToDouble(row["TyTrong"].ToString()), 3) + "%) " + row["Ten"].ToString(), row["ID"].ToString()); item.Attributes.Add("Level", level.ToString()); lstItems.Add(item); LoadForCurItem(lstItems, item, idTrungTam, idPhongBan, dt, idDotDanhGia, UserID); } }
public static DataTable LoadPortalForCur(DataTable dtPortal, DataRow curItem, DataTable dtReturnPortal) { int level = Convert.ToInt32(curItem["Level"]); level += 1; int _portalID = Convert.ToInt32(curItem["PortalID"]); DataRow[] dtChild = GetPortalByParentID(dtPortal, _portalID); foreach (DataRow row in dtChild) { DataRow childItem = dtReturnPortal.NewRow(); childItem["PortalID"] = row["PortalID"].ToString(); childItem["Portal_Description"] = row["Portal_Description"]; childItem["Portal_ParentId"] = row["Portal_ParentId"]; childItem["Portal_Name"] = MiscUtility.StringIndent(level) + row["Portal_Name"].ToString(); childItem["Level"] = level; dtReturnPortal.Rows.Add(childItem); LoadPortalForCur(dtPortal, childItem, dtReturnPortal); } return(dtReturnPortal); }
public static DataTable LoadRoleForCur(DataTable dtRole, DataRow curItem, DataTable dtReturnRole) { int level = Convert.ToInt32(curItem["Level"]); level += 1; int _roleID = Convert.ToInt32(curItem["RoleID"]); DataRow[] dtChild = GetRoleByParentID(dtRole, _roleID); foreach (DataRow row in dtChild) { DataRow childItem = dtReturnRole.NewRow(); childItem["RoleID"] = row["RoleID"].ToString(); childItem["RoleParentID"] = row["RoleParentID"]; childItem["RoleDescription"] = row["RoleDescription"]; childItem["RoleName"] = MiscUtility.StringIndent(level) + row["RoleName"].ToString(); childItem["Level"] = level; dtReturnRole.Rows.Add(childItem); LoadRoleForCur(dtRole, childItem, dtReturnRole); } return(dtReturnRole); }
public static void LoadForCurItemChuaDuocGiao(ListItemCollection lstItems, ListItem curItem, int idTrungTam, int idPhongBan, int loai, int idDotDanhGia) { string[] arr = curItem.Value.Split('_'); int curId = ConvertUtility.ToInt32(arr[0]); int hasChild = ConvertUtility.ToInt32(arr[1]); int level = ConvertUtility.ToInt32(curItem.Attributes["Level"]); level++; DataTable dtCongViec = GetAllByParentIDNew(curId, idTrungTam, idPhongBan, loai, idDotDanhGia); if (dtCongViec == null) { return; } foreach (DataRow row in dtCongViec.Rows) { DataTable dtChildLevel = GetAllByParentIDNew(ConvertUtility.ToInt32(row["ID"].ToString()), idTrungTam, idPhongBan, loai, idDotDanhGia); //DataTable dt = DotDanhGiaController.GetAllNhanVienTheoCongViec(ConvertUtility.ToInt32(row["ID"].ToString()), idDotDanhGia); ListItem item; //if (dt != null && dt.Rows.Count > 0 && ConvertUtility.ToInt32(dt.Rows[0][0]) > 0) //{ // if (dtChildLevel.Rows.Count > 0) // { // //item = new ListItem(MiscUtility.StringIndent(level) + "(" + Math.Round(ConvertUtility.ToDouble(row["TyTrong"].ToString()), 3) + "%) " + row["Ten"].ToString(), row["ID"].ToString() + "_1"); // item = new ListItem(MiscUtility.StringIndent(level) + row["Ten"].ToString(), row["ID"].ToString() + "_1"); // item.Attributes.Add("Level", level.ToString()); // item.Attributes.Add("HasChild", "1"); // } // else // { // //item = new ListItem(MiscUtility.StringIndent(level) + "(" + Math.Round(ConvertUtility.ToDouble(row["TyTrong"].ToString()), 3) + "%) " + row["Ten"].ToString(), row["ID"].ToString() + "_0"); // item = new ListItem(MiscUtility.StringIndent(level) + row["Ten"].ToString(), row["ID"].ToString() + "_0"); // item.Attributes.Add("Level", level.ToString()); // item.Attributes.Add("HasChild", "0"); // } // lstItems.Add(item); //} //else //{ if (dtChildLevel.Rows.Count > 0) { //item = new ListItem(MiscUtility.StringIndent(level) + "(" + Math.Round(ConvertUtility.ToDouble(row["TyTrong"].ToString()), 3) + "%) " + row["Ten"].ToString(), row["ID"].ToString() + "_1"); item = new ListItem(MiscUtility.StringIndent(level) + row["Ten"].ToString(), row["ID"].ToString() + "_1"); item.Attributes.Add("Level", level.ToString()); item.Attributes.Add("style", "color:red"); item.Attributes.Add("HasChild", "1"); } else { //item = new ListItem(MiscUtility.StringIndent(level) + "(" + Math.Round(ConvertUtility.ToDouble(row["TyTrong"].ToString()), 3) + "%) " + row["Ten"].ToString(), row["ID"].ToString() + "_0"); item = new ListItem(MiscUtility.StringIndent(level) + row["Ten"].ToString(), row["ID"].ToString() + "_0"); item.Attributes.Add("Level", level.ToString()); //item.Attributes.Add("style", "color:red"); item.Attributes.Add("HasChild", "0"); } lstItems.Add(item); //} LoadForCurItemChuaDuocGiao(lstItems, item, idTrungTam, idPhongBan, loai, idDotDanhGia); } }