public ActionResult GetListDepartment(int pageIndex = 1, int pageSize = 500, string filter = "") { var db = new OrganizationUnitDAL(); int?total = 0; var baseListParam = new BaseListParam() { FilterField = filter, OrderByField = "", UserType = Global.CurrentUser.RoleId, UserId = Global.CurrentUser.LoginUserId, DeptId = Global.CurrentUser.OrganizationUnitID, PageIndex = pageIndex, PageSize = pageSize, LanguageCode = Global.CurrentUser.CurrentLanguageID.ToString() }; var result = db.GetOrganizationUnit(baseListParam, out total);; var list = JsonConvert.SerializeObject(result, Formatting.None, new JsonSerializerSettings() { ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore }); return(Content(list, "application/json")); }
public ActionResult TableServerSideGetData(int pageIndex, int pageSize, string filter = "") { var db = new OrganizationUnitDAL(); int?total = 0; var baseListParam = new BaseListParam() { FilterField = filter, OrderByField = "", UserType = Global.CurrentUser.RoleId, UserId = Global.CurrentUser.LoginUserId, DeptId = Global.CurrentUser.OrganizationUnitID, PageIndex = pageIndex, PageSize = pageSize, LanguageCode = Global.CurrentUser.CurrentLanguageID.ToString() }; var result = db.GetOrganizationUnit(baseListParam, out total); var lstTotal = new TableColumnsTotalModel(); lstTotal.Total1 = "15"; lstTotal.Total2 = "25"; lstTotal.Total3 = "35"; return(Content(JsonConvert.SerializeObject(new { employees = result, totalCount = total, lstTotal = lstTotal }))); }
public ActionResult GetEmployee(int OrganizationUnitID) { var db = new OrganizationUnitDAL(); var result = db.GetListEmployeeByOrganizationUnitID(OrganizationUnitID); return(Content(JsonConvert.SerializeObject(new { result }))); }
public ActionResult GetCompany() { var db = new OrganizationUnitDAL(); var result = db.GetCompany(); return(Content(JsonConvert.SerializeObject(new { result }))); }
public ActionResult GetOrganizationUnitWhereParent(int ParentID) { var db = new OrganizationUnitDAL(); var result = db.OrganizationUnitWhereParentID(ParentID); return(Content(JsonConvert.SerializeObject(new { result }))); }
public ActionResult GetOrganizationUnit(int chon) { var db = new OrganizationUnitDAL(); var result = db.OrganizationUnitAll(chon, Global.CurrentUser.RoleId, Global.CurrentUser.UserID); return(Content(JsonConvert.SerializeObject(new { result }))); }
public ActionResult UpdateColumnByUsserID(int TableID, string Visible, int OrderNo, int TableColumnId) { var db = new OrganizationUnitDAL(); int UserID = Global.CurrentUser.LoginUserId; var result = db.UpdateColumnByUsserID(UserID, TableID, Visible, OrderNo, TableColumnId); return(Content(JsonConvert.SerializeObject(new { result }))); }
public ActionResult GetColumnByUsserID(int TableId, string filter) { var db = new OrganizationUnitDAL(); int UserID = Global.CurrentUser.LoginUserId; var result = db.GetColumnByUsserID(TableId, UserID, filter); return(Content(JsonConvert.SerializeObject(new { result }))); }
public ActionResult GetEmployeeWhereOrganizationUnit(string id) { var db = new OrganizationUnitDAL(); var languageID = Global.CurrentLanguage; var result = db.GetEmployeeWhereOrganizationUnit(languageID, id, Global.CurrentUser.UserID, Global.CurrentUser.RoleId); return(Content(JsonConvert.SerializeObject(new { result }))); }
public ActionResult EmployeeByOrganizationUnitIDSupplement(string id) { var db = new OrganizationUnitDAL(); var languageID = Global.CurrentLanguage; int id1 = Convert.ToInt32(id); var result = db.EmployeeByOrganizationUnitIDSupplement(languageID, id1, Global.CurrentUser.UserID, Global.CurrentUser.RoleId); return(Content(JsonConvert.SerializeObject(new { result }))); }
public ActionResult _DeleteOrganizationUnit(int id, int idTable) { var db = new OrganizationUnitDAL(); int usertype = Global.CurrentUser.RoleId; int userid = Global.CurrentUser.UserID; int LanguageID = Global.CurrentLanguage; var result = db.DeleteOrganizationUnit(id, idTable, userid, usertype, LanguageID); return(Content(JsonConvert.SerializeObject(new { result }))); }
public ActionResult OrganizationUnitExportExcel(string filterString) { var baseListParam = new BaseListParam() { FilterField = filterString, OrderByField = "", PageIndex = 1, PageSize = int.MaxValue, UserType = Global.CurrentUser.RoleId, UserId = Global.CurrentUser.LoginUserId, DeptId = Global.CurrentUser.OrganizationUnitID, LanguageCode = Global.CurrentUser.CurrentLanguageID.ToString() }; DataTable dt = new DataTable("Grid"); dt.Columns.AddRange(new DataColumn[6] { new DataColumn(AppRes.OrganazationUnitCode), new DataColumn(AppRes.NameVi), new DataColumn(AppRes.NameEn), new DataColumn(AppRes.Email), new DataColumn(AppRes.Phone), new DataColumn(AppRes.Status) }); dt.Columns[0].DataType = typeof(string); dt.Columns[1].DataType = typeof(string); dt.Columns[2].DataType = typeof(string); dt.Columns[3].DataType = typeof(string); dt.Columns[4].DataType = typeof(string); dt.Columns[5].DataType = typeof(string); var db = new OrganizationUnitDAL(); int total = 0; var lstData = db.ExportOrganizationUnit(baseListParam, filterString); foreach (var item in lstData) { dt.Rows.Add(item.OrganizationUnitCode, item.Name, item.NameEN, item.Email, item.Phone, item.Status == 0 ? "Không hoạt động" : "Hoạt động"); } var wb = new XLWorkbook(); wb.Worksheets.Add(dt); byte[] data = null; using (var stream = new MemoryStream()) { wb.SaveAs(stream); data = stream.ToArray(); } return(File(data, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "SecRole.xlsx")); }
public ActionResult SaveOrganizationUnit(OrganizationUnit secRole) { var db = new OrganizationUnitDAL(); int trung = 0; var result = db.SaveOrganizationUnit(1, 1, secRole, out trung); if (result.IsSuccess == true && secRole.OrganizationUnitID == 0) { result.Message = AppRes.MSG_INSERT_SUCCESSFUL; } else if (result.IsSuccess == true && secRole.OrganizationUnitID != 0) { result.Message = AppRes.MS_Update_success; } return(Content(JsonConvert.SerializeObject(new { bientrung = trung, result }))); }
public virtual ActionResult DownloadTemplate(string formatFile, int?param) { if (String.IsNullOrEmpty(formatFile)) { formatFile = ".xlsx"; } //var globalListDal = new GlobalListDal(); DataTable dt = new DataTable("Grid"); dt.Columns.AddRange(new DataColumn[16] { new DataColumn(AppRes.StaffIDD), new DataColumn(AppRes.OrganazationId), new DataColumn(AppRes.ShareRate), new DataColumn(AppRes.StartDate), new DataColumn(AppRes.EndDate), new DataColumn(AppRes.CompanyId), new DataColumn(AppRes.Note), new DataColumn(""), new DataColumn(""), new DataColumn(AppRes.CompanyId + " "), new DataColumn(AppRes.Company + " "), new DataColumn(""), new DataColumn(AppRes.StaffIDD + " "), new DataColumn(AppRes.Staff + " "), new DataColumn(AppRes.OrganazationId + " "), new DataColumn(AppRes.OrganizationUnit + " ") }); var db = new OrganizationUnitDAL(); var listCompany = db.GetCompany(); var dborg = new OrganizationUnitDAL(); var listStaff = dborg.GetEmployeeByStatusAndDept(Global.CurrentLanguage, 0, Constant.numStatusStaff.Activity.GetHashCode(), Global.CurrentUser.UserID, Global.CurrentUser.RoleId); var listOrganizationUnit = dborg.OrganizationUnitAll(1, Global.CurrentUser.RoleId, Global.CurrentUser.UserID); var rowsNumber = 0; rowsNumber = Math.Max(listCompany.Count, Math.Max(listStaff.Count, listOrganizationUnit.Count)); dt.Rows.Add( 1, 1230, 50, DateTime.Now, DateTime.Now, 1221, Global.CurrentLanguage == 4 ? "Note" : "Ghi chú" ); for (int i = 0; i < rowsNumber; i++) { dt.Rows.Add( "", "", "", "", "", "", "", "", "", listCompany.Count > i ? listCompany[i].OrganizationUnitID.ToString() : "", listCompany.Count > i ? listCompany[i].Name.ToString() : "", "", listStaff.Count > i ? listStaff[i].StaffID.ToString() : "", listStaff.Count > i ? listStaff[i].FullName.ToString() : "", listOrganizationUnit.Count > i ? listOrganizationUnit[i].OrganizationUnitID.ToString() : "", listOrganizationUnit.Count > i ? listOrganizationUnit[i].Name.ToString() : "" ); } if (param == 2) { dt.Columns.Remove(AppRes.StaffIDD + " "); dt.Columns.Remove(AppRes.Staff + " "); dt.Columns.Remove(AppRes.StaffIDD); } else { dt.Columns.Remove(AppRes.OrganazationId + " "); dt.Columns.Remove(AppRes.OrganizationUnit + " "); dt.Columns.Remove(AppRes.OrganazationId); } var wb = new XLWorkbook(); wb.Worksheets.Add(dt); wb.Worksheet("Grid").Cell(1, 7).Style.Fill.BackgroundColor = XLColor.White; wb.Worksheet("Grid").Cell(1, 8).Style.Fill.BackgroundColor = XLColor.White; wb.Worksheet("Grid").Cell(1, 11).Style.Fill.BackgroundColor = XLColor.White; byte[] data = null; using (var stream = new MemoryStream()) { wb.SaveAs(stream); data = stream.ToArray(); } return(File(data, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "ImportFileTemplate" + formatFile)); }