public JsonResult DisableMerchant(string merchantid, string status) { var data = new CommonDbResponse(); MerchantCommon merchantCommon = new MerchantCommon(); bool valid = true; //string userId = userid.DecryptParameter(); string agentId = merchantid.DecryptParameter(); if (String.IsNullOrEmpty(agentId)) { data = new CommonDbResponse { Code = ResponseCode.Failed, Message = "Invalid User." }; valid = false; } if (valid) { merchantCommon.MerchantStatus = "n"; merchantCommon.MerchantID = agentId; //merchantCommon.UserID = userId; merchantCommon.ActionUser = Session["UserName"].ToString(); data = _merchant.Disable_EnableMerchant(merchantCommon); //if (data.ErrorCode == 0) //{ // data.Message = "Successfully Changed User"; //} } data.SetMessageInTempData(this); return(Json(data)); }
public JsonResult ResetPassword(string userid, string merchantid) { var data = new CommonDbResponse(); bool valid = true; string userId = userid.DecryptParameter(); string MerchantId = merchantid.DecryptParameter(); if (String.IsNullOrEmpty(userId)) { data = new CommonDbResponse { Code = ResponseCode.Failed, Message = "Failed to Reset Password" }; valid = false; } MerchantCommon model = new MerchantCommon(); model.MerchantID = MerchantId; model.UserID = userId; model.ActionUser = ApplicationUtilities.GetSessionValue("username").ToString(); model.IpAddress = ApplicationUtilities.GetIP(); if (valid) { data = _merchant.ResetPassword(model); //if (data.ErrorCode == 0) //{ // data.Message = "Successfully Changed User"; //} } data.SetMessageInTempData(this); return(Json(data)); }
public List <MerchantCommon> GetMerchantList(string MerchantId = "", string parentid = "") { string sql = "sproc_merchant_detail"; sql += " @flag='s'"; sql += " ,@merchant_type='Merchant'"; sql += " ,@parent_Id=" + DAO.FilterParameter(parentid); sql += " ,@agent_id=" + DAO.FilterParameter(MerchantId); var dt = DAO.ExecuteDataTable(sql); List <MerchantCommon> lst = new List <MerchantCommon>(); if (dt != null) { foreach (DataRow item in dt.Rows) { MerchantCommon merchantCommon = new MerchantCommon { ParentID = item["parent_id"].ToString(), MerchantID = item["agent_id"].ToString(), MerchantName = item["agent_name"].ToString(), MerchantOperationType = item["agent_operation_type"].ToString(), MerchantStatus = item["agent_status"].ToString(), MerchantCreditLimit = item["agent_credit_limit"].ToString(), MerchantMobileNumber = item["agent_mobile_no"].ToString() }; lst.Add(merchantCommon); } } return(lst); }
public CommonDbResponse ResetPassword(MerchantCommon mCommon) { string sql = "sproc_merchant_detail @flag = 'rpass'"; sql += ", @agent_id=" + DAO.FilterString(mCommon.MerchantID); sql += ", @user_id=" + DAO.FilterString(mCommon.UserID); sql += ", @action_user="******", @created_ip=" + DAO.FilterString(mCommon.ActionIP); return(DAO.ParseCommonDbResponse(sql)); }
public CommonDbResponse Disable_EnableMerchant(MerchantCommon merchantCommon) { string sql = "sproc_merchant_detail "; sql += " @flag='edm'"; sql += ",@agent_id=" + DAO.FilterString(merchantCommon.MerchantID); sql += ",@action_user="******",@user_status=" + DAO.FilterString(merchantCommon.UserStatus); return(DAO.ParseCommonDbResponse(sql)); }
public CommonDbResponse ManageMerchant(MerchantCommon merchantCommon) { string sql = "sproc_merchant_detail "; sql += "@flag='" + (string.IsNullOrEmpty(merchantCommon.MerchantID) ? "i" : "u") + "'"; sql += " ,@merchant_type='Merchant'"; sql += " ,@agent_id=" + DAO.FilterString(merchantCommon.MerchantID); sql += " ,@merchant_commission_type=" + merchantCommon.MerchantCommissionType; sql += " ,@merchant_mobile_no=" + DAO.FilterString(merchantCommon.MerchantMobileNumber); sql += " ,@merchant_country=" + DAO.FilterString(merchantCommon.MerchantCountry); sql += " ,@merchant_province=" + DAO.FilterString(merchantCommon.MerchantProvince); sql += " ,@merchant_district=" + DAO.FilterString(merchantCommon.MerchantDistrict); sql += " ,@merchant_local_body=" + DAO.FilterString(merchantCommon.MerchantVDC_Muncipality); sql += " ,@merchant_ward_number=" + DAO.FilterString(merchantCommon.MerchantWardNo); sql += " ,@merchant_street=" + DAO.FilterString(merchantCommon.MerchantStreet); sql += " ,@merchant_available_balance=" + DAO.FilterString(merchantCommon.MerchantBalance); sql += " ,@merchant_logo=" + DAO.FilterString(merchantCommon.MerchantLogo); //user info sql += " ,@user_id=" + DAO.FilterString(merchantCommon.UserID); sql += " ,@first_name=" + DAO.FilterString(merchantCommon.FirstName); sql += " ,@middle_name=" + DAO.FilterString(merchantCommon.MiddleName); sql += " ,@last_name=" + DAO.FilterString(merchantCommon.LastName); sql += " ,@action_user="******" ,@action_ip=" + DAO.FilterString(merchantCommon.IpAddress); sql += " ,@action_platform=''";// + DAO.FilterString(merchantCommon.IpAddress); sql += " ,@role_id='12'"; sql += " ,@usr_type='Merchant'"; sql += " ,@usr_type_id='12'"; sql += " ,@merchant_phone_number=" + DAO.FilterString(merchantCommon.MerchantPhoneNumber); sql += " ,@merchant_email=" + DAO.FilterString(merchantCommon.MerchantEmail); sql += " ,@merchant_web_url=" + DAO.FilterString(merchantCommon.MerchantWebUrl); sql += " ,@merchant_registration_no=" + DAO.FilterString(merchantCommon.MerchantRegistrationNumber); sql += " ,@merchant_Pan_no=" + DAO.FilterString(merchantCommon.MerchantPanNumber); sql += " ,@merchant_contract_date=" + DAO.FilterString(merchantCommon.MerchantContractDate); sql += " ,@merchant_reg_certificate=" + DAO.FilterString(merchantCommon.MerchantRegistrationCertificate); sql += " ,@merchant_pan_Certificate=" + DAO.FilterString(merchantCommon.MerchantPanCertificate); sql += " ,@merchant_name=" + DAO.FilterString(merchantCommon.MerchantName);// DAO.FilterString(merchantCommon.FirstName+" "+ merchantCommon.MiddleName+" "+merchantCommon.LastName); if (string.IsNullOrEmpty(merchantCommon.MerchantID)) { //sql += " ,@merchant_name=" + DAO.FilterString(merchantCommon.MerchantName);// DAO.FilterString(merchantCommon.FirstName+" "+ merchantCommon.MiddleName+" "+merchantCommon.LastName); sql += " ,@user_name=" + DAO.FilterString(merchantCommon.UserName); sql += " ,@password="******" ,@confirm_password="******" ,@user_mobile_number=" + DAO.FilterString(merchantCommon.UserMobileNumber); sql += " ,@user_email=" + DAO.FilterString(merchantCommon.UserEmail); sql += " ,@parent_id=" + DAO.FilterString(merchantCommon.ParentID); } return(DAO.ParseCommonDbResponse(sql)); }
public MerchantCommon GetMerchantById(string MerchantId) { string sql = "sproc_merchant_detail"; sql += " @flag='md'"; sql += ", @agent_id=" + DAO.FilterString(MerchantId); var dt = DAO.ExecuteDataRow(sql); MerchantCommon merchantCommon = new MerchantCommon(); if (dt != null) { merchantCommon.MerchantCode = dt["agent_code"].ToString(); merchantCommon.MerchantType = dt["agent_type"].ToString(); merchantCommon.MerchantID = dt["agent_id"].ToString(); merchantCommon.ParentID = dt["parent_id"].ToString(); merchantCommon.MerchantOperationType = dt["agent_operation_type"].ToString(); string test = dt["is_auto_commission"].ToString(); merchantCommon.MerchantCommissionType = dt["is_auto_commission"].ToString().ToUpper() == "TRUE" ? true : false;//dt[""].ToString(); merchantCommon.MerchantName = dt["agent_name"].ToString(); merchantCommon.MerchantPhoneNumber = dt["agent_phone_no"].ToString(); merchantCommon.MerchantMobileNumber = dt["agent_mobile_no"].ToString(); merchantCommon.MerchantEmail = dt["agent_email_address"].ToString(); merchantCommon.MerchantWebUrl = dt["web_url"].ToString(); merchantCommon.MerchantRegistrationNumber = dt["agent_registration_no"].ToString(); merchantCommon.MerchantPanNumber = dt["agent_pan_no"].ToString(); merchantCommon.MerchantContractDate = dt["agent_contract_local_date"].ToString(); merchantCommon.MerchantContractDate_BS = dt["agent_contract_nepali_date"].ToString(); merchantCommon.MerchantCountry = dt["agent_country"].ToString(); merchantCommon.MerchantProvince = dt["permanent_province"].ToString(); merchantCommon.MerchantDistrict = dt["permanent_district"].ToString(); merchantCommon.MerchantVDC_Muncipality = dt["permanent_localbody"].ToString(); merchantCommon.MerchantWardNo = dt["permanent_wardno"].ToString(); merchantCommon.MerchantStreet = dt["permanent_address"].ToString(); merchantCommon.MerchantCreditLimit = dt["agent_credit_limit"].ToString(); merchantCommon.MerchantBalance = dt["available_balance"].ToString(); merchantCommon.MerchantLogo = dt["agent_logo_img"].ToString(); merchantCommon.MerchantPanCertificate = dt["agent_document_img_front"].ToString(); merchantCommon.MerchantRegistrationCertificate = dt["agent_document_img_back"].ToString(); merchantCommon.UserID = dt["user_id"].ToString(); merchantCommon.UserName = dt["user_name"].ToString(); merchantCommon.FirstName = dt["first_name"].ToString(); merchantCommon.MiddleName = dt["middle_name"].ToString(); merchantCommon.LastName = dt["last_name"].ToString(); merchantCommon.FullName = merchantCommon.FirstName + " " + merchantCommon.MiddleName + " " + merchantCommon.LastName; merchantCommon.UserMobileNumber = dt["user_mobile_no"].ToString(); merchantCommon.UserEmail = dt["user_email"].ToString(); merchantCommon.MerchantQr = dt["agent_qr_image"].ToString(); } return(merchantCommon); }
public ActionResult ManageMerchant(MerchantModel merchantModel, HttpPostedFileBase Merchant_Logo, HttpPostedFileBase Pan_Certiticate, HttpPostedFileBase Registration_Certificate, string changepassword) { var Merchant_LogoPath = ""; var Pan_CertiticatePath = ""; var Registration_CertificatePath = ""; LoadDropDownList(merchantModel); if (!string.IsNullOrEmpty(merchantModel.MerchantID.DecryptParameter())) { ModelState.Remove("UserName"); ModelState.Remove("Password"); ModelState.Remove("ConfirmPassword"); ModelState.Remove("FullName"); ModelState.Remove("UserMobileNumber"); ModelState.Remove("UserEmail"); ModelState.Remove("FirstName"); ModelState.Remove("LastName"); if (string.IsNullOrEmpty(changepassword)) { ModelState.Remove("UserName"); ModelState.Remove("Password"); ModelState.Remove("ConfirmPassword"); } } if (ModelState.IsValid) { MerchantCommon merchantCommon = new MerchantCommon(); merchantCommon = merchantModel.MapObject <MerchantCommon>(); if (!string.IsNullOrEmpty(merchantCommon.MerchantID)) { if (string.IsNullOrEmpty(merchantCommon.MerchantID.DecryptParameter())) { return(View(merchantModel)); } if (string.IsNullOrEmpty(changepassword)) { merchantCommon.Password = ""; merchantCommon.ConfirmPassword = ""; merchantCommon.MerchantEmail = ""; merchantCommon.MerchantMobileNumber = ""; } merchantCommon.MerchantID = merchantCommon.MerchantID.DecryptParameter(); merchantCommon.UserID = merchantCommon.UserID.DecryptParameter(); } if (!string.IsNullOrEmpty(merchantCommon.ParentID)) { if (string.IsNullOrEmpty(merchantCommon.ParentID.DecryptParameter())) { return(View(merchantModel)); } merchantCommon.ParentID = merchantCommon.ParentID.DecryptParameter(); } merchantCommon.ActionUser = ApplicationUtilities.GetSessionValue("UserName").ToString(); merchantCommon.IpAddress = ApplicationUtilities.GetIP(); if (Merchant_Logo != null) { var allowedExtensions = new[] { ".jpg", ".png", ".jpeg" }; var fileName = Path.GetFileName(Merchant_Logo.FileName); String timeStamp = DateTime.Now.ToString(); var ext = Path.GetExtension(Merchant_Logo.FileName); if (Merchant_Logo.ContentLength > 1 * 1024 * 1024)//1 MB { this.ShowPopup(1, "Image Size must be less than 1MB"); return(View(merchantModel)); } if (allowedExtensions.Contains(ext.ToLower())) { string datet = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' '); string myfilename = "logo " + datet + "." + Merchant_Logo.FileName; Merchant_LogoPath = Path.Combine(Server.MapPath("~/Content/userupload/merchant"), myfilename); merchantCommon.MerchantLogo = "/Content/userupload/merchant/" + myfilename; } else { this.ShowPopup(1, "File Must be .jpg,.png,.jpeg"); return(View(merchantModel)); } } if (Pan_Certiticate != null) { var allowedExtensions = new[] { ".jpg", ".png", ".jpeg" }; var fileName = Path.GetFileName(Pan_Certiticate.FileName); String timeStamp = DateTime.Now.ToString(); var ext = Path.GetExtension(Pan_Certiticate.FileName); if (Pan_Certiticate.ContentLength > 1 * 1024 * 1024)//1 MB { this.ShowPopup(1, "Image Size must be less than 1MB"); return(View(merchantModel)); } if (allowedExtensions.Contains(ext.ToLower())) { string datet = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' '); string myfilename = "pan " + datet + "." + Pan_Certiticate.FileName; Pan_CertiticatePath = Path.Combine(Server.MapPath("~/Content/userupload/merchant"), myfilename); merchantCommon.MerchantPanCertificate = "/Content/userupload/merchant/" + myfilename; } else { this.ShowPopup(1, "File Must be .jpg,.png,.jpeg"); return(View(merchantModel)); } } if (Registration_Certificate != null) { var allowedExtensions = new[] { ".jpg", ".png", ".jpeg" }; var fileName = Path.GetFileName(Registration_Certificate.FileName); String timeStamp = DateTime.Now.ToString(); var ext = Path.GetExtension(Registration_Certificate.FileName); if (Registration_Certificate.ContentLength > 1 * 1024 * 1024)//1 MB { this.ShowPopup(1, "Image Size must be less than 1MB"); return(View(merchantModel)); } if (allowedExtensions.Contains(ext.ToLower())) { string datet = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' '); string myfilename = "reg " + datet + "." + Registration_Certificate.FileName; Registration_CertificatePath = Path.Combine(Server.MapPath("~/Content/userupload/merchant"), myfilename); merchantCommon.MerchantRegistrationCertificate = "/Content/userupload/merchant/" + myfilename; //Registration_Certificate.SaveAs(path); } else { this.ShowPopup(1, "File Must be .jpg,.png,.jpeg"); return(View(merchantModel)); } } CommonDbResponse dbresp = _merchant.ManageMerchant(merchantCommon); if (dbresp.Code == 0) { if (Pan_Certiticate != null) { Pan_Certiticate.SaveAs(Pan_CertiticatePath); } if (Registration_Certificate != null) { Registration_Certificate.SaveAs(Registration_CertificatePath); } if (Merchant_Logo != null) { Merchant_Logo.SaveAs(Merchant_LogoPath); } string userId = dbresp.Extra1; string agentId = dbresp.Extra2; string AgentCode = dbresp.Extra3; QRCoder.QRCodeGenerator qrGenerator = new QRCodeGenerator(); var encData = AgentCode.EncryptParameterForQr(); QRCodeData qrCodeData = qrGenerator.CreateQrCode(encData, QRCodeGenerator.ECCLevel.Q); QRCode qrCode = new QRCode(qrCodeData); Bitmap qrCodeImage = qrCode.GetGraphic(20); string ImageUrl = ""; using (MemoryStream stream = new MemoryStream()) { qrCodeImage.Save(stream, System.Drawing.Imaging.ImageFormat.Png); byte[] byteImage = stream.ToArray(); ImageUrl = string.Format(Convert.ToBase64String(byteImage)); } string qrFilePath = Server.MapPath("~/Content/userupload/Merchant/"); string qrImageName = "qrImage" + "_" + userId + "_" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss").Replace("-", "_").Replace(" ", "_").Replace(":", "_") + ".png"; qrCodeImage.Save(qrFilePath + qrImageName, ImageFormat.Png); CommonDbResponse qrInsert = _merchant.AddCardQr(userId, agentId, ImageUrl, "/Content/userupload/Merchant/" + qrImageName); this.ShowPopup(0, dbresp.Message); return(RedirectToAction("Index")); } merchantModel.Msg = dbresp.Message; } this.ShowPopup(1, "Error " + merchantModel.Msg); return(View(merchantModel)); }
public ActionResult ManageMerchant(MerchantModel merchantModel, HttpPostedFileBase Merchant_Logo, HttpPostedFileBase Pan_Certiticate, HttpPostedFileBase Registration_Certificate, string changepassword) { var Merchant_LogoPath = ""; var Pan_CertiticatePath = ""; var Registration_CertificatePath = ""; LoadDropDownList(merchantModel); if (!string.IsNullOrEmpty(merchantModel.MerchantID.DecryptParameter())) { ModelState.Remove("UserName"); if (string.IsNullOrEmpty(changepassword)) { ModelState.Remove("Password"); ModelState.Remove("ConfirmPassword"); } } if (ModelState.IsValid) { MerchantCommon merchantCommon = new MerchantCommon(); merchantCommon = merchantModel.MapObject <MerchantCommon>(); if (!string.IsNullOrEmpty(merchantCommon.MerchantID)) { if (string.IsNullOrEmpty(merchantCommon.MerchantID.DecryptParameter())) { return(View(merchantModel)); } if (string.IsNullOrEmpty(changepassword)) { merchantCommon.Password = ""; merchantCommon.ConfirmPassword = ""; merchantCommon.MerchantEmail = ""; merchantCommon.MerchantMobileNumber = ""; } merchantCommon.MerchantID = merchantCommon.MerchantID.DecryptParameter(); merchantCommon.UserID = merchantCommon.UserID.DecryptParameter(); } if (!string.IsNullOrEmpty(merchantCommon.ParentID)) { if (string.IsNullOrEmpty(merchantCommon.ParentID.DecryptParameter())) { return(View(merchantModel)); } merchantCommon.ParentID = merchantCommon.ParentID.DecryptParameter(); } merchantCommon.ActionUser = ApplicationUtilities.GetSessionValue("UserName").ToString(); merchantCommon.IpAddress = ApplicationUtilities.GetIP(); if (Merchant_Logo != null) { var allowedExtensions = new[] { ".jpg", ".png", ".jpeg" }; var fileName = Path.GetFileName(Merchant_Logo.FileName); String timeStamp = DateTime.Now.ToString(); var ext = Path.GetExtension(Merchant_Logo.FileName); if (Merchant_Logo.ContentLength > 1 * 1024 * 1024)//1 MB { this.ShowPopup(1, "Image Size must be less than 1MB"); return(View(merchantModel)); } if (allowedExtensions.Contains(ext.ToLower())) { string datet = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' '); string myfilename = "logo " + datet + "." + Merchant_Logo.FileName; Merchant_LogoPath = Path.Combine(Server.MapPath("~/Content/userupload/merchant"), myfilename); merchantCommon.MerchantLogo = "/Content/userupload/merchant/" + myfilename; } else { this.ShowPopup(1, "File Must be .jpg,.png,.jpeg"); return(View(merchantModel)); } } if (Pan_Certiticate != null) { var allowedExtensions = new[] { ".jpg", ".png", ".jpeg" }; var fileName = Path.GetFileName(Pan_Certiticate.FileName); String timeStamp = DateTime.Now.ToString(); var ext = Path.GetExtension(Pan_Certiticate.FileName); if (Pan_Certiticate.ContentLength > 1 * 1024 * 1024)//1 MB { this.ShowPopup(1, "Image Size must be less than 1MB"); return(View(merchantModel)); } if (allowedExtensions.Contains(ext.ToLower())) { string datet = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' '); string myfilename = "pan " + datet + "." + Pan_Certiticate.FileName; Pan_CertiticatePath = Path.Combine(Server.MapPath("~/Content/userupload/merchant"), myfilename); merchantCommon.MerchantPanCertificate = "/Content/userupload/merchant/" + myfilename; } else { this.ShowPopup(1, "File Must be .jpg,.png,.jpeg"); return(View(merchantModel)); } } if (Registration_Certificate != null) { var allowedExtensions = new[] { ".jpg", ".png", ".jpeg" }; var fileName = Path.GetFileName(Registration_Certificate.FileName); String timeStamp = DateTime.Now.ToString(); var ext = Path.GetExtension(Registration_Certificate.FileName); if (Registration_Certificate.ContentLength > 1 * 1024 * 1024)//1 MB { this.ShowPopup(1, "Image Size must be less than 1MB"); return(View(merchantModel)); } if (allowedExtensions.Contains(ext.ToLower())) { string datet = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' '); string myfilename = "reg " + datet + "." + Registration_Certificate.FileName; Registration_CertificatePath = Path.Combine(Server.MapPath("~/Content/userupload/merchant"), myfilename); merchantCommon.MerchantRegistrationCertificate = "/Content/userupload/merchant/" + myfilename; //Registration_Certificate.SaveAs(path); } else { this.ShowPopup(1, "File Must be .jpg,.png,.jpeg"); return(View(merchantModel)); } } CommonDbResponse dbresp = _merchant.ManageMerchant(merchantCommon); if (dbresp.Code == 0) { if (Pan_Certiticate != null) { Pan_Certiticate.SaveAs(Pan_CertiticatePath); } if (Registration_Certificate != null) { Registration_Certificate.SaveAs(Registration_CertificatePath); } if (Merchant_Logo != null) { Merchant_Logo.SaveAs(Merchant_LogoPath); } this.ShowPopup(0, dbresp.Message); return(RedirectToAction("Index")); } merchantModel.Msg = dbresp.Message; } this.ShowPopup(1, "Error " + merchantModel.Msg); return(View(merchantModel)); }
public CommonDbResponse Disable_EnableMerchant(MerchantCommon merchantCommon) { return(_repo.Disable_EnableMerchant(merchantCommon)); }
public CommonDbResponse ManageMerchant(MerchantCommon merchantCommon) { return(_repo.ManageMerchant(merchantCommon)); }
public CommonDbResponse ResetPassword(MerchantCommon mCommon) { return(_repo.ResetPassword(mCommon)); }