private void btnOk_Click(object sender, EventArgs e) { try { btnOk.Enabled = false; btnPrint.Enabled = false; btnClose.Enabled = false; dtpFrom.Enabled = false; dtpTo.Enabled = false; Cursor = GWMHIS.BussinessLogicLayer.Classes.PublicStaticFun.WaitCursor( ); CreateTreeList( ); } catch (Exception err) { MessageBox.Show("统计发生错误!请稍后再试!"); ErrorWriter.WriteLog(err.Message); } finally { Cursor = Cursors.Default; btnOk.Enabled = true; btnPrint.Enabled = true; btnClose.Enabled = true; dtpFrom.Enabled = true; dtpTo.Enabled = true; } }
public JsonResult LoginPost(string userName, string pass) { int flag = FlagStatus.ServerError; try { string MD5Pass = Lib.Encrypt(pass); UserListBL uBL = new UserListBL(); //UserModel usermodel = new UserModel(); if (userName != string.Empty && pass != string.Empty) { var user = uBL.GetUserByUserPass(userName, MD5Pass); if (user != null)//nếu tồn tại trong hệ thống thì get DB xem ở nhóm nào, quyền gì { var usermodel = uBL.GetPermission_ByUserName(userName); FormsAuthentication.SetAuthCookie(JsonConvert.SerializeObject(usermodel, Formatting.None), false); flag = FlagStatus.Success; } else { flag = FlagStatus.DataNotFound; } } } catch (Exception ex) { ErrorWriter.WriteLog(Server.MapPath("~"), "[LoginPost]", ex.ToString()); return(Json(flag, JsonRequestBehavior.AllowGet)); } return(Json(flag, JsonRequestBehavior.AllowGet)); }
public string GetjsonInfo(string strMethod, string inputJson) { var res = ""; try { string urlAddress = string.Empty; urlAddress = ConfigurationManager.AppSettings["serviceURL"]; WebClient client = new WebClient(); client.Headers["Content-type"] = "application/json"; client.Encoding = Encoding.UTF8; ServicePointManager.MaxServicePointIdleTime = 1000; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls; res = client.UploadString(urlAddress + strMethod, inputJson); JavaScriptSerializer jsJson = new JavaScriptSerializer(); jsJson.MaxJsonLength = 2147483644; return(res); } catch (Exception ex) { res = ex.Message.ToString(); ErrorWriter.WriteLog(ex.GetType().ToString(), ex.GetType().Name.ToString(), ex.InnerException.ToString(), "UserRepository_GetjsonInfo", strMethod); return(res); } }
public async Task <UserViewModel> GETUSERBYUSERID(string username) { try { var parameters = new List <IDbDataParameter>(); parameters.Add(_db.CreateParameter("P_USER_ID", 10, username, DbType.String, ParameterDirection.Input)); parameters.Add(_db.CreateParameter("P_USER_NAME", 10, "", DbType.String, ParameterDirection.Output)); parameters.Add(_db.CreateParameter("P_USER_ROLE", 10, "", DbType.String, ParameterDirection.Output)); parameters.Add(_db.CreateParameter("P_APPROVED", 10, "", DbType.String, ParameterDirection.Output)); parameters.Add(_db.CreateParameter("P_DELETED", 10, "", DbType.String, ParameterDirection.Output)); parameters.Add(_db.CreateParameter("P_ERROR_MSG", 100, "", DbType.String, ParameterDirection.Output)); DbConnection connection = null; var userCommand = _db.GetExecuteNonQuery(STOREDPROC.GETUSERBYUSERID, CommandType.StoredProcedure, parameters, 0, out connection); string uId = userCommand.Parameters["P_USER_ID"].Value.ToString(); string uname = userCommand.Parameters["P_USER_NAME"].Value.ToString(); string urole = userCommand.Parameters["P_USER_ROLE"].Value.ToString(); string uapproved = userCommand.Parameters["P_APPROVED"].Value.ToString(); string udeleted = userCommand.Parameters["P_DELETED"].Value.ToString(); string error = userCommand.Parameters["P_ERROR_MSG"].Value.ToString(); if (string.IsNullOrEmpty(error)) { var objUser = new UserViewModel() { USER_ID = uId, USER_NAME = uname, USER_ROLE = urole, APPROVED = uapproved, DELETED = udeleted, Status = true, Message = "Success" }; ErrorWriter.WriteLog($"Fetch user data returned : { objUser.Message } at { DateTime.Now }"); return(objUser); } else { ErrorWriter.WriteLog($"Fetch user data returned : { error } at { DateTime.Now }"); throw new Exception(error); } } catch (Exception ex) { var error = await ExceptionRefiner.LogError(ex); ErrorWriter.WriteLog($"Fetch user data returned : { ex.Message } at { DateTime.Now }"); throw new Exception(error); } }
private void PrintReport(BaseReport Report, bool preview) { try { PrintController.PrintPatientFeeReport(Report, preview); } catch (Exception err) { ErrorWriter.WriteLog(err.Message); MessageBox.Show("预览/打印发生错误!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public async Task <bool> AUTHENTICATEUSER(LoginViewModel loginModel) { if (loginModel == null) { throw new PlatformCustomException("Invalid username or password"); } try { var objUser = new DataResult <UserViewModel>(); var parameters = new List <IDbDataParameter>(); var authorizedRole = GetConfigValue("AuthorizedUserRole"); //implement password hashing here loginModel.Password = HashUtil.EncryptStringValue(loginModel.Password); parameters.Add(_db.CreateParameter("p_user_id", 10, loginModel.UserId, DbType.String, ParameterDirection.Input)); parameters.Add(_db.CreateParameter("p_password", 70, loginModel.Password, DbType.String, ParameterDirection.Input)); parameters.Add(_db.CreateParameter("p_authorized_role", 70, authorizedRole, DbType.String, ParameterDirection.Input)); parameters.Add(_db.CreateParameter("p_error_msg", 100, "", DbType.String, ParameterDirection.Output)); parameters.Add(_db.CreateParameter("p_success", 100, "", DbType.String, ParameterDirection.Output)); DbConnection connection = null; var authCommand = _db.GetExecuteNonQuery(STOREDPROC.AUTHUSER, CommandType.StoredProcedure, parameters, 0, out connection); string error = authCommand.Parameters["p_error_msg"].Value.ToString(); string success = authCommand.Parameters["p_success"].Value.ToString(); if (!string.IsNullOrEmpty(error)) { throw new PlatformCustomException("Invalid username or password."); } var message = string.IsNullOrEmpty(error) ? error : success; ErrorWriter.WriteLog($"Login operation returned : { message } at { DateTime.Now }"); return(true); } catch (Exception ex) { var error = await ExceptionRefiner.LogError(ex); ErrorWriter.WriteLog($"Login operation returned : { ex.Message } at { DateTime.Now }"); throw new Exception(error); } }
public System.Drawing.Image Base64ToImage(string bs64str) { System.Drawing.Image image = null; try { byte[] imageBytes = Convert.FromBase64String(bs64str); MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length); ms.Write(imageBytes, 0, imageBytes.Length); image = System.Drawing.Image.FromStream(ms, true); } catch (Exception ex) { ErrorWriter.WriteLog(ex.GetType().ToString(), ex.GetType().Name.ToString(), ex.InnerException.ToString(), "GetUserProfile", "UserDashboardController"); } return(image); }
public JsonResult GetUserAppliedJobs(string usrid) { var res = ""; try { string jsr = ur.GetUserAppliedJobs(usrid); return(Json((new JavaScriptSerializer()).DeserializeObject(jsr), JsonRequestBehavior.AllowGet)); } catch (Exception ex) { ErrorWriter.WriteLog(ex.GetType().ToString(), ex.GetType().Name.ToString(), ex.InnerException.ToString(), "GetUserAppliedJobs", "UserDashboardController"); res = ex.Message.ToString(); return(Json(res, JsonRequestBehavior.AllowGet)); } }
public JsonResult DeleteUserGroup(string groupId) { int rs = -1; UserGroupBL UsergBL = new UserGroupBL(); try { UsergBL.Delete(groupId); rs = 1; } catch (Exception ex) { ErrorWriter.WriteLog(System.Web.HttpContext.Current.Server.MapPath("~"), "[DeleteUserGroup] groupId=", groupId.ToString() + ex.ToString()); } return(Json(rs, JsonRequestBehavior.AllowGet)); }
public JsonResult UpdateUserGroup(UserGroup model) { int rs = -1; UserGroupBL UsergBL = new UserGroupBL(); try { UsergBL.Update(model); rs = 1; } catch (Exception ex) { ErrorWriter.WriteLog(System.Web.HttpContext.Current.Server.MapPath("~"), "[UpdateUserGroup]", ex.ToString()); } return(Json(rs, JsonRequestBehavior.AllowGet)); }
public JsonResult DeleteProduct(int productId) { int rs = -1; ProductBL producBL = new ProductBL(); try { producBL.Delete(productId); rs = 1; } catch (Exception ex) { ErrorWriter.WriteLog(System.Web.HttpContext.Current.Server.MapPath("~"), "[DeleteProduct] productId=", productId.ToString() + ex.ToString()); } return(Json(rs, JsonRequestBehavior.AllowGet)); }
public JsonResult InsertProductType(ProductType model) { int rs = -1; ProductBL producBL = new ProductBL(); try { producBL.InsertProductType(model); rs = 1; } catch (Exception ex) { ErrorWriter.WriteLog(System.Web.HttpContext.Current.Server.MapPath("~"), "[InsertProductType]", ex.ToString()); } return(Json(rs, JsonRequestBehavior.AllowGet)); }
public string GetCountryList() { var res = ""; try { string jsr = GetjsonInfo("/ManPowers/GetCountryList", ""); return(jsr); } catch (Exception ex) { ErrorWriter.WriteLog(ex.GetType().ToString(), ex.GetType().Name.ToString(), ex.InnerException.ToString(), "GetCountryList", "MainRepository"); res = ex.Message.ToString(); return(res); } }
public string UpdatePassword(ChangePasswordModel cpm) { var res = ""; try { string inputJson = (new JavaScriptSerializer()).Serialize(cpm); string jsr = GetjsonInfo("/Signin/UpdatePassword", inputJson); return(jsr); } catch (Exception ex) { ErrorWriter.WriteLog(ex.GetType().ToString(), ex.GetType().Name.ToString(), ex.InnerException.ToString(), "ForgotPasswordSendLink", "MainRepository"); res = ex.Message.ToString(); return(res); } }
public string GetStatesbyCountry(StatesModel sm) { var res = ""; try { string inputJson = (new JavaScriptSerializer()).Serialize(sm); string jsr = GetjsonInfo("/ManPowers/GetStateList", inputJson); return(jsr); } catch (Exception ex) { ErrorWriter.WriteLog(ex.GetType().ToString(), ex.GetType().Name.ToString(), ex.InnerException.ToString(), "GetStatesbyCountry", "MainRepository"); res = ex.Message.ToString(); return(res); } }
public JsonResult UpdateUserProfile(UserProfileModel up, img imagpath) { var res = ""; try { //if (up.ImgPath != "" && up.ImgPath != null) //{ // if (up.ImgPath.IndexOf(".png") > -1) { } // else // { // Base64ToImage(up.ImgPath).Save(Server.MapPath("~/ProfilePics/" + up.UserID + ".png")); // up.ImgPath = "/ProfilePics/" + up.UserID + ".png"; // } //} //else //{ // up.ImgPath = "http://mps.manpowersupplier.net/img/admin.png"; //} if (imagpath.ImgPath != "" && imagpath.ImgPath != null) { if (imagpath.ImgPath.IndexOf(".png") > -1) { } else { Base64ToImage(imagpath.ImgPath).Save(Server.MapPath("~/ProfilePics/" + up.UserID + ".png")); imagpath.ImgPath = "/ProfilePics/" + up.UserID + ".png"; } } else { imagpath.ImgPath = "http://mps.manpowersupplier.net/img/admin.png"; } up.ImgPath = imagpath.ImgPath; string jsr = ur.UpdateUserProfile(up); return(Json((new JavaScriptSerializer()).DeserializeObject(jsr), JsonRequestBehavior.AllowGet)); } catch (Exception ex) { ErrorWriter.WriteLog(ex.GetType().ToString(), ex.GetType().Name.ToString(), ex.InnerException.ToString(), "UpdateUserProfile", "UserDashboardController"); res = ex.Message.ToString(); return(Json(res, JsonRequestBehavior.AllowGet)); } }
public string UpdateJobDetails(AgentJobPost jp) { var res = ""; try { string inputJson = (new JavaScriptSerializer()).Serialize(jp); string jsr = GetjsonInfo("/JobDeatils/UpdateJobDeatails", inputJson); return(jsr); } catch (Exception ex) { ErrorWriter.WriteLog(ex.GetType().ToString(), ex.GetType().Name.ToString(), ex.InnerException.ToString(), "UpdateJobDeatails", "JobsRepository"); res = ex.Message.ToString(); return(res); } }
public string GetUserProfile(GetUserProfileModel jp) { var res = ""; try { string inputJson = (new JavaScriptSerializer()).Serialize(jp); string jsr = GetjsonInfo("/UserDetails/GetUserPersonalDeatails", inputJson); return(jsr); } catch (Exception ex) { ErrorWriter.WriteLog(ex.GetType().ToString(), ex.GetType().Name.ToString(), ex.InnerException.ToString(), "GetUserProfile", "UserRepository"); res = ex.Message.ToString(); return(res); } }
public string DeleteJob(DeleteJobModel jp) { var res = ""; try { string inputJson = (new JavaScriptSerializer()).Serialize(jp); string jsr = GetjsonInfo("/JobDeatils/UpdateJobRecordStatus", inputJson); return(jsr); } catch (Exception ex) { ErrorWriter.WriteLog(ex.GetType().ToString(), ex.GetType().Name.ToString(), ex.InnerException.ToString(), "UpdateJobRecordStatus", "MainRepository"); res = ex.Message.ToString(); return(res); } }
public string UpdateAppliedJob(JobApplyModel jm) { var res = ""; try { string inputJson = (new JavaScriptSerializer()).Serialize(jm); string jsr = GetjsonInfo("/JobDeatils/UpdateJobApplyDeatails", inputJson); return(jsr); } catch (Exception ex) { ErrorWriter.WriteLog(ex.GetType().ToString(), ex.GetType().Name.ToString(), ex.InnerException.ToString(), "GetAppliedUserbyJob", "AdminRepository"); res = ex.Message.ToString(); return(res); } }
public string GetRegsiteredUsers() { var res = ""; try { string inputJson = ""; string jsr = GetjsonInfo("/Admin/GetPendingUserDetails", inputJson); return(jsr); } catch (Exception ex) { ErrorWriter.WriteLog(ex.GetType().ToString(), ex.GetType().Name.ToString(), ex.InnerException.ToString(), "GetRegsiteredUsers", "AdminRepository"); res = ex.Message.ToString(); return(res); } }
public string GetJobDetailsbyID(JobDetailsModel jp) { var res = ""; try { string inputJson = (new JavaScriptSerializer()).Serialize(jp); string jsr = GetjsonInfo("/JobDeatils/GetJobDetailsByJobID", inputJson); return(jsr); } catch (Exception ex) { ErrorWriter.WriteLog(ex.GetType().ToString(), ex.GetType().Name.ToString(), ex.InnerException.ToString(), "GetJobDetailsbyID", "MainRepository"); res = ex.Message.ToString(); return(res); } }
public string ApproveUser(ApproveUser au) { var res = ""; try { string inputJson = (new JavaScriptSerializer()).Serialize(au); string jsr = GetjsonInfo("/Admin/UpdateUserStatus", inputJson); return(jsr); } catch (Exception ex) { ErrorWriter.WriteLog(ex.GetType().ToString(), ex.GetType().Name.ToString(), ex.InnerException.ToString(), "UpdateUserStatus", "AdminRepository"); res = ex.Message.ToString(); return(res); } }
public string UpdateJobAccess(UpdateAccess au) { var res = ""; try { string inputJson = (new JavaScriptSerializer()).Serialize(au); string jsr = GetjsonInfo("/JobDeatils/UpdateJobDetailsAccessStatus", inputJson); return(jsr); } catch (Exception ex) { ErrorWriter.WriteLog(ex.GetType().ToString(), ex.GetType().Name.ToString(), ex.InnerException.ToString(), "UpdateJobAccess", "AdminRepository"); res = ex.Message.ToString(); return(res); } }
public JsonResult UpdateProduct(Product model) { int rs = -1; ProductBL producBL = new ProductBL(); try { model.ModifiedAt = DateTime.Now; model.ModifiedBy = 1;//Fix tạm producBL.Update(model); rs = 1; } catch (Exception ex) { ErrorWriter.WriteLog(System.Web.HttpContext.Current.Server.MapPath("~"), "[UpdateProduct]", ex.ToString()); } return(Json(rs, JsonRequestBehavior.AllowGet)); }
public JsonResult UpdatePassword(ChangePasswordModel cpm) { MainRepoistory mps = new MainRepoistory(); string finalres = string.Empty; try { finalres = mps.UpdatePassword(cpm); JavaScriptSerializer json_serializer = new JavaScriptSerializer(); var res = JsonConvert.DeserializeObject <ChangePasswordResult>(finalres); return(Json(res, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { finalres = ex.Message.ToString(); ErrorWriter.WriteLog(ex.GetType()?.ToString(), ex.GetType()?.Name?.ToString(), ex.InnerException?.ToString(), "UpdatePassword", "StartController"); return(Json(finalres, JsonRequestBehavior.AllowGet)); } }
private void PrintReport(BaseReport Report, bool preview) { try { if (chkChargeTotalInfo.Checked) { PrintController.PrintIncomeReport(Report, ((FundInfo[])dgvTotalInfo.Tag).ToList()); } else { PrintController.PrintIncomeReport(Report, preview); } } catch (Exception err) { ErrorWriter.WriteLog(err.Message); MessageBox.Show("预览/打印发生错误!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ActionResult ForgotPasswordSendLink(FormCollection frm) { ChangePasswordModel cpm = new ChangePasswordModel(); MainRepoistory mps = new MainRepoistory(); try { cpm.userid = frm["txtemail"]; string res = mps.ForgotPasswordSendLink(cpm); JavaScriptSerializer json_serializer = new JavaScriptSerializer(); var finalres = JsonConvert.DeserializeObject <ChangePasswordResult>(res); TempData["ResponseCode"] = finalres.ResponseCode; TempData["ResponseMessage"] = finalres.ResponseMessage; } catch (Exception ex) { ErrorWriter.WriteLog(ex.GetType()?.ToString(), ex.GetType()?.Name?.ToString(), ex.InnerException?.ToString(), "ForgotPassword", "StartController"); } return(Redirect("/Start/Start/ForgotPassword")); }
public string GetUserAppliedJobs(string usrid) { var res = ""; try { object jp = new { UserID = usrid }; string inputJson = (new JavaScriptSerializer()).Serialize(jp); string jsr = GetjsonInfo("/JobDeatils/GetAppliedJobDetailsByUserID", inputJson); return(jsr); } catch (Exception ex) { ErrorWriter.WriteLog(ex.GetType().ToString(), ex.GetType().Name.ToString(), ex.InnerException.ToString(), "GetUserProfile", "UserRepository"); res = ex.Message.ToString(); return(res); } }
public async Task <DataResult <List <AvailableIndentsViewModel> > > GETINDENTSFORENCRYPTION() { var objIndents = new DataResult <List <AvailableIndentsViewModel> >(); try { var parameter = new List <IDbDataParameter>(); parameter.Add(_db.CreateParameter("P_ERROR_MSG", string.Empty, DbType.String)); parameter.Add(_db.CreateParameter("P_INDENTFORENCRYPTION", OracleDbType.RefCursor, null)); var indentsDT = _db.GetDataTable(STOREDPROC.GENERATEDINDENTLIST, CommandType.StoredProcedure, 0, parameter); if (indentsDT.Rows.Count == 0) { objIndents.Data = null; objIndents.Status = false; objIndents.Message = "No record currently available for processing"; } var indentsList = ConvertDataTableToList <AvailableIndentsViewModel>(indentsDT); objIndents.Data = indentsList; objIndents.Status = true; objIndents.Message = "Successful"; } catch (Exception ex) { var error = await ExceptionRefiner.LogError(ex); ErrorWriter.WriteLog($"Fetch indents returned error: { ex.Message } at { DateTime.Now }"); objIndents.Data = null; objIndents.Status = false; objIndents.Message = error; } ErrorWriter.WriteLog($"Fetch indents returned : { objIndents.Message } at { DateTime.Now }"); return(objIndents); }