/// <summary> /// 获取公司信息页面 /// </summary> /// <param name="id">公司标识</param> public ActionResult CompanyInfo(string id) { if (string.IsNullOrEmpty(id)) { T_Company model = new T_Company(); return(View("CompanyInfo", model)); } else { ViewData["C_GUID"] = id; Session["CurrentCompany"] = id; //ViewData["MasterCompanyGuid"] = ""; List <T_Company> Info = new List <T_Company>(); Info = new CompanySvc().GetCompanyInfo(id, ""); if (Info.Count.Equals(0)) { T_Company model = new T_Company(); return(View("CompanyInfo", model)); } else { return(View("CompanyInfo", Info.FirstOrDefault())); } } }
/// <summary> /// 保存公司信息 /// </summary> /// <param name="form">公司对象</param> public string UpdCompany(T_Company form) { string msg = string.Empty; bool result = false; form.AuditDate = DateTime.Now.ToString(); if (string.IsNullOrEmpty(form.C_GUID) == true) { form.C_GUID = Guid.NewGuid().ToString(); form.MasterCompanyGuid = Session["MasterCompanyGuid"].ToString(); } else { form.MasterCompanyGuid = ""; } if (string.IsNullOrEmpty(form.MasterCompanyGuid) == true) { form.MasterCompanyGuid = Session["MasterCompanyGuid"].ToString(); } List <T_Company> info = new List <T_Company>(); info = new CompanySvc().GetCompanyInfo("", form.Name); if (info.Count.Equals(0)) { result = new CompanySvc().UpdCompany(form); if (result) { msg = General.Resource.Common.Success; } else { msg = General.Resource.Common.Failed; } return(string.Format("{{\"Result\":{0},\"Msg\":\"{1}\"}}" , result.ToString().ToLower(), msg)); } else { if (info.FirstOrDefault().C_GUID == form.C_GUID) { result = new CompanySvc().UpdCompany(form); if (result) { msg = General.Resource.Common.Success; } else { msg = General.Resource.Common.Failed; } return(string.Format("{{\"Result\":{0},\"Msg\":\"{1}\"}}" , result.ToString().ToLower(), msg)); } result = false; msg = General.Resource.Common.CompanyName + General.Resource.Common.Exist; return(string.Format("{{\"Result\":{0},\"Msg\":\"{1}\"}}", result.ToString().ToLower(), msg)); } }
/// <summary> /// 获取用户信息页面 /// </summary> /// <param name="id">用户标识</param> public ActionResult UserInfo(string id) { if (string.IsNullOrEmpty(id)) { ViewData["U_GUID"] = Guid.NewGuid().ToString(); T_User model = new T_User(); return(View("UserInfo", model)); } else { ViewData["U_GUID"] = id; List <T_User> info = new List <T_User>(); info = new CompanySvc().GetUserInfo(id, ""); return(View("UserInfo", info.FirstOrDefault())); } }
/// <summary> /// 保存用户信息 /// </summary> /// <param name="form">用户对象</param> public string UpdUserInfo(T_User form) { bool result = false; string msg = string.Empty; List <T_User> info = new List <T_User>(); info = new CompanySvc().GetUserInfo("", form.LoginName); if (string.IsNullOrEmpty(form.C_GUID)) { form.C_GUID = Session["MasterCompanyGuid"].ToString(); if (info.Count.Equals(0)) { result = new CompanySvc().UpdUserInfo(form); if (result) { msg = General.Resource.Common.Success; } else { msg = General.Resource.Common.Failed; } } else { msg = Common.Resource.RolePermission.LoginName + General.Resource.Common.Exist; } return(string.Format("{{\"Result\":{0},\"Msg\":\"{1}\"}}" , result.ToString().ToLower(), msg)); } else { if (info.Count.Equals(0)) { result = new CompanySvc().UpdUserInfo(form); if (result) { msg = General.Resource.Common.Success; } else { msg = General.Resource.Common.Failed; } return(string.Format("{{\"Result\":{0},\"Msg\":\"{1}\"}}" , result.ToString().ToLower(), msg)); } else { if (info.FirstOrDefault().C_GUID == form.C_GUID & info.FirstOrDefault().U_GUID == form.U_GUID) { result = new CompanySvc().UpdUserInfo(form); if (result) { msg = General.Resource.Common.Success; } else { msg = General.Resource.Common.Failed; } return(string.Format("{{\"Result\":{0},\"Msg\":\"{1}\"}}" , result.ToString().ToLower(), msg)); } result = false; msg = Common.Resource.RolePermission.LoginName + General.Resource.Common.Exist; return(string.Format("{{\"Result\":{0},\"Msg\":\"{1}\"}}", result.ToString().ToLower(), msg)); } } }