public ActionResult Index(string DistId = "", string username = "", string Search = "", int Pagesize = 10) { var UserType = ApplicationUtilities.GetSessionValue("UserType").ToString(); string SubDistId = ""; if (UserType.ToUpper() == "SUB-DISTRIBUTOR") { DistId = Session["ParentId"].ToString(); SubDistId = Session["AgentId"].ToString(); } else { DistId = DistId.DecryptParameter(); if (string.IsNullOrEmpty(DistId)) { return(RedirectToAction("Index", "Distributor")); } } if (string.IsNullOrEmpty(username)) { username = Session["UserName"].ToString(); } string IsPrimary = ApplicationUtilities.GetSessionValue("IsPrimaryUser").ToString(); var lst = ISD.GetSubDistributorsList(username, DistId, SubDistId); foreach (var item in lst) { item.Action = StaticData.GetActions("Subdistributor", item.AgentID.ToString().EncryptParameter(), this, "", "", ""); //item.kycstatus = "<img src='/Content/assets/images/service logos/" + item.ProductLogo + "' height='50' width='50' />"; item.AgentStatus = "<span class='badge badge-" + (item.AgentStatus.Trim().ToUpper() == "Y" ? "success" : "danger") + "'>" + (item.AgentStatus.Trim().ToUpper() == "Y" ? "Enable" : "Disable") + "</span>"; if (item.kycstatus.ToUpper().Equals("PENDING")) { item.kycstatus = "<span class='badge badge-warning'>Pending</span>"; } else if (item.kycstatus.ToUpper().Equals("APPROVED")) { item.kycstatus = "<span class='badge badge-success'>Approved</span>"; } else { item.kycstatus = "<span class='badge badge-danger'>Rejected</span>"; } } IDictionary <string, string> param = new Dictionary <string, string>(); //param.Add("ProductId", "Product Id"); // param.Add("ProductLogo", "Product Logo"); param.Add("AgentName", "Agent Name"); param.Add("AgentOperationType", "Operation Type"); param.Add("AgentMobileNumber", "Contact Number"); param.Add("AgentStatus", "Agent Status"); param.Add("kycstatus", "Kyc Status"); param.Add("Action", "Action"); ProjectGrid.column = param; var grid = ProjectGrid.MakeGrid(lst, "Sub-Distributor", Search, Pagesize, true, "", "", "Home", "Sub-Distributor", "/Admin/subdistributor", String.IsNullOrEmpty(IsPrimary) == false && IsPrimary.ToUpper().Trim() == "Y" ?"/Admin/subdistributor/Manage?parentid=" + DistId.EncryptParameter():""); ViewData["grid"] = grid; return(View()); }
public void LoadRolesDropdownList(DistributorRoles model) { model.RolesList = ApplicationUtilities.SetDDLValue(LoadDropdownList("userRole"), model.RoleId, "--Select Role--"); }
public ActionResult ManageServices(ServicesModel SM, HttpPostedFileBase file) { SM.StatusList = LoadDropdownList("status") as List <SelectListItem>; SM.CompanyList = ApplicationUtilities.SetDDLValue(LoadDropdownList("company") as Dictionary <string, string>, SM.Company, "Select Company"); SM.TransactionTypeList = ApplicationUtilities.SetDDLValue(LoadDropdownList("txntype") as Dictionary <string, string>, SM.TransactionType, "Select Transaction Type"); SM.ProductTypeList = ApplicationUtilities.SetDDLValue(LoadDropdownList("producttype") as Dictionary <string, string>, SM.ProductType, "Select Product Type"); SM.ProductCategoryList = ApplicationUtilities.SetDDLValue(LoadDropdownList("productcategory") as Dictionary <string, string>, SM.ProductCategory, "Select Product Category"); SM.PrimaryGatewayList = ApplicationUtilities.SetDDLValue(LoadDropdownList("primarygateway") as Dictionary <string, string>, SM.PrimaryGateway, "Select Primary Gateway"); SM.SecondaryGatewayList = ApplicationUtilities.SetDDLValue(LoadDropdownList("secondarygateway") as Dictionary <string, string>, SM.SecondaryGateway, "Select Secondary Gateway"); string productid = ""; productid = SM.ProductId; if (!string.IsNullOrEmpty(productid)) { if (string.IsNullOrEmpty(productid.DecryptParameter())) { return(View(SM)); } SM.Status = ""; ModelState.Remove("ProductCode"); ModelState.Remove("TransactionType"); ModelState.Remove("Company"); ModelState.Remove("PrimaryGateway"); ModelState.Remove("SecondaryGateway"); ModelState.Remove("Status"); } if (ModelState.IsValid) { string username = Session["UserName"].ToString(); SM.StatusList = LoadDropdownList("status") as List <SelectListItem>; var path = ""; #region "logo" if (file != null) { var allowedExtensions = new[] { ".jpg", ".png", ".jpeg" }; var fileName = Path.GetFileName(file.FileName); String timeStamp = DateTime.Now.ToString(); var ext = Path.GetExtension(file.FileName); if (file.ContentLength > 1 * 1024 * 1024)//1 MB { this.ShowPopup(1, "Image Size must be less than 1MB"); return(View(SM)); } if (allowedExtensions.Contains(ext.ToLower())) { string datet = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' '); string myfilename = SM.ProductType.Replace('|', '.') + "." + file.FileName; path = Path.Combine(Server.MapPath("~/Content/assets/images/service logos"), myfilename); SM.ProductLogo = myfilename; } else { this.ShowPopup(1, "File Must be .jpg,.png,.jpeg"); //return RedirectToAction("ManageServices", ControllerName, productid); return(View(SM)); } } #endregion ServicesCommon service = SM.MapObject <ServicesCommon>(); service.CreatedIp = ApplicationUtilities.GetIP(); service.ProductId = productid.DecryptParameter(); CommonDbResponse dbresp = _services.ManageServices(service, username); if (dbresp.Code == 0) { if (path != "") { file.SaveAs(path); } this.ShowPopup(0, "Save Succesfully"); // dbresp.SetMessageInTempData(this); return(RedirectToAction("Index")); } } this.ShowPopup(1, "Error"); // dbresp.SetMessageInTempData(this); return(View(SM)); }
public void LoadUserDropdownlist(SubDistributorManagementRolesModel DMR) { ViewBag.usertype = ApplicationUtilities.SetDDLValue(LoadDropdownList("usertype"), DMR.RoleId, "--Select User Type--"); ViewBag.Primary = ApplicationUtilities.SetDDLValue(LoadDropdownList("isprimary"), DMR.IsPrimary, "--Select Primary--"); }
public ActionResult SearchUser() { ViewBag.SearchFilter = ApplicationUtilities.SetDDLValue(LoadDropdownList("searchfilter") as Dictionary <string, string>, "", "--Select--"); return(View()); }
public ActionResult VianetBillPayment(VianetBillInquiryResponseModel Response) { if (Response.Encryptioncontent.DecryptParameter() != (Response.VianetCustomerId + Response.BillAmount)) { this.ShowPopup(1, "Data Mismatch"); return(RedirectToAction("VianetBillInquiry")); } if (string.IsNullOrEmpty(Response.BillAmount) && string.IsNullOrEmpty(Response.RenewalPlans)) { this.ShowPopup(1, "Invalid Plan"); return(View(Response)); } VianetBillPaymentModel payment = new VianetBillPaymentModel(); if (!string.IsNullOrEmpty(Response.RenewalPlans)) { var plan = Response.RenewalPlans; var plansplit = plan.Split('|'); payment.VianetCustomerId = Response.VianetCustomerId; if (plansplit.Length == 2) { payment.Amount = plansplit[0]; payment.PlanId = plansplit[1]; } else { this.ShowPopup(1, "Select Plan Invalid"); return(RedirectToAction("VianetBillInquiry")); } } else { payment.Amount = Response.BillAmount; } var jstring = Newtonsoft.Json.JsonConvert.SerializeObject(payment); MobileTopUpPaymentRequest mtpr = new MobileTopUpPaymentRequest() { action_user = Session["UserName"].ToString(), product_id = Response.ProductId.DecryptParameter(), amount = payment.Amount, subscriber_no = payment.VianetCustomerId, quantity = "", additonal_data = jstring, CreatedIp = ApplicationUtilities.GetIP() }; var response = _mtp.MobileTopUpPaymentRequest(mtpr); if (response.Code == 0) { payment.TransactionId = response.Extra1; VianetBillPaymentCommon pcommon = new VianetBillPaymentCommon(); var amt = payment.Amount.Contains(".") ? payment.Amount.Split('.')[0].ToString() : payment.Amount; payment.Amount = amt; pcommon = payment.MapObject <VianetBillPaymentCommon>(); var paymentresponse = _vianet.BillPayment(pcommon); bool failed = true; if (paymentresponse.GatewayName == "PRABHUPAY") { if (paymentresponse.Code == shared.Models.ResponseCode.Success) { var ppresponse = (prabhupay.service.data.ReturnTransaction)paymentresponse.Data; var data = new MobileTopUpPaymentUpdateRequest(); data.action_user = Session["username"].ToString(); data.refstan = ppresponse.TransactionId; data.transaction_id = response.Extra1; data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse); data.amount = pcommon.Amount; data.status_code = ppresponse.Code; data.remarks = ppresponse.Message; data.ip_address = ApplicationUtilities.GetIP(); response = _mtp.MobileTopUpPaymentResponse(data); failed = false; //return RedirectToAction("ResultPage", "WorldLinkBillPayment", new { txnid = ppresponse }); return(RedirectToAction("ResultPage", "VianetBillPayment", new { txnid = response.Extra1.EncryptParameter() })); } else if (paymentresponse.Code == shared.Models.ResponseCode.Exception) { var ppresponse = (prabhupay.service.data.ReturnTransaction)paymentresponse.Data; var data = new MobileTopUpPaymentUpdateRequest(); data.action_user = Session["username"].ToString(); data.transaction_id = response.Extra1; data.refstan = ppresponse.TransactionId; data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse); data.amount = pcommon.Amount; data.status_code = ppresponse.Code; data.remarks = ppresponse.Message; data.ip_address = ApplicationUtilities.GetIP(); //data.product_id = pcommon.; data.partner_txn_id = ppresponse.TransactionId; response = _mtp.MobileTopUpPaymentResponse(data); failed = false; return(RedirectToAction("ResultPage", "VianetBillPayment", new { txnid = response.Extra1.EncryptParameter() })); } else { var ppresponse = (prabhupay.service.data.ReturnTransaction)paymentresponse.Data; var data = new MobileTopUpPaymentUpdateRequest(); data.action_user = Session["UserName"].ToString(); data.transaction_id = response.Extra1; data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse); data.amount = pcommon.Amount; data.status_code = ((int)paymentresponse.Code).ToString(); data.remarks = paymentresponse.Message; data.ip_address = ApplicationUtilities.GetIP(); //data.product_id = pcommon.ProductId; response = _mtp.MobileTopUpPaymentResponse(data); } response.SetMessageInTempData(this, "VianetBillPayment"); if (failed) { VianetBillInquiryCommon query = new VianetBillInquiryCommon() { VianetCustomerId = payment.VianetCustomerId }; return(RedirectToAction("VianetBillInquiry", new { wpm = query })); } } } response.SetMessageInTempData(this, "VianetBillPayment"); VianetBillInquiryCommon que = new VianetBillInquiryCommon() { VianetCustomerId = payment.VianetCustomerId }; return(RedirectToAction("VianetBillInquiry", new { wpm = que })); }
public ActionResult ManageAssignCategory(string ID) { ClientAssignCommissionCommon ACC = comm.GetAssignedCategoryById(ID.DecryptParameter()); ClientAssignCommissionModel ACM = new ClientAssignCommissionModel(); if (ACC != null) { ACM.AgentName = ACC.AgentName; ACM.AgentId = ACC.AgentId.EncryptParameter(); ACM.CommissionCategoryId = ACC.CommissionCategoryId; ViewBag.CommissionCategoryList = ApplicationUtilities.SetDDLValue(ICB.sproc_get_dropdown_list("016", ApplicationUtilities.GetSessionValue("agentid").ToString()), ACM.CommissionCategoryId, "Select Commission Category"); return(View(ACM)); } this.ShowPopup(1, "Error"); return(RedirectToAction("AssignCategory")); }
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 MobileTopup(ClientModel clientModel) { //string productid = clientModel.ProductId; var validMobileNo = MobileNumberValidate(clientModel.MobileNo); if (validMobileNo.Code != "0") { ModelState.AddModelError("MobileNo", validMobileNo.Message); return(View(clientModel)); } MobileTopUpPaymentRequest mtpr = new MobileTopUpPaymentRequest() { action_user = Session["UserName"].ToString(), product_id = clientModel.ProductId, amount = clientModel.Amount, subscriber_no = clientModel.MobileNo, quantity = "", additonal_data = "", CardNo = clientModel.CardNo, CardAmount = clientModel.CardAmount }; var response = _mtp.MobileTopUpPaymentRequest(mtpr); if (response.Code == 0) { var amt = clientModel.Amount.Contains(".") ? clientModel.Amount.Split('.')[0].ToString() : clientModel.Amount; var payment = _mpaymentPP.ConsumeService(clientModel.MobileNo, long.Parse(amt)); bool failed = false; if (payment.Code == shared.Models.ResponseCode.Success) { var billNo = payment.Extra1; var refStan = payment.Extra2; var ppresponse = (PPResponse)payment.Data; var data = new MobileTopUpPaymentUpdateRequest(); data.action_user = Session["UserName"].ToString(); data.transaction_id = response.Extra1; data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse); data.amount = clientModel.Amount; data.bill_number = billNo; data.refstan = refStan; data.status_code = ppresponse.Result; data.remarks = ppresponse.ResultMessage; data.ip_address = ApplicationUtilities.GetIP(); data.product_id = clientModel.ProductId; data.partner_txn_id = ppresponse.TransactionId; response = _mtp.MobileTopUpPaymentResponse(data); } else { var ppresponse = (PPResponse)payment.Data; var data = new MobileTopUpPaymentUpdateRequest(); data.action_user = Session["UserName"].ToString(); data.transaction_id = response.Extra1; data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse); data.amount = clientModel.Amount; data.status_code = ((int)payment.Code).ToString(); data.remarks = payment.Message; data.ip_address = ApplicationUtilities.GetIP(); data.product_id = clientModel.ProductId; response = _mtp.MobileTopUpPaymentResponse(data); failed = true; } if (failed) { response.Code = shared.Models.ResponseCode.Failed; response.Message = "Transaction Failed"; } response.SetMessageInTempData(this, "MobileTopup"); if (failed) { return(RedirectToAction("MobileTopup")); } return(RedirectToAction("ResultPage", ControllerName, new { txnid = response.Extra1.EncryptParameter() })); //return RedirectToAction("MobileTopup"); } response.SetMessageInTempData(this, "MobileTopup"); if (Session["UserType"].ToString().ToLower() == "merchant") { return(RedirectToAction("MobileTopUp3")); } return(RedirectToAction("MobileTopup")); }
public ActionResult PaymentGatewayTransactionReport() { ViewBag.GatewayList = ApplicationUtilities.SetDDLValue(LoadDropdownList("pmtGt"), "", "Select Gateway"); return(View()); }
// private async void MigrateSchedulesAsync(Int64 currentVersion) // { // if (_application.Preferences.LastMigrationVersion == currentVersion) // { // return ; // } // // if (!await _application.Manager.MigrateSchedulesAsync()) // { // ShowSnackbar(Resource.String.schedulesMigrationErrorMessage); // _ = _application.SaveLogAsync(); // } // else // { // _application.Preferences.SetLastMigrationVersion(currentVersion); // } // } private async void CheckForCriticalUpdatesAsync(Int64 currentVersion) { if (IsPermissionDenied(Manifest.Permission.Internet)) { RequestPermissions(InternetPermissionRequestCode, Manifest.Permission.Internet); return; } ReleaseDescription latest = await ApplicationUtilities.GetLatestReleaseDescription(); if (latest == null) { return; } if (!latest.IsCriticalUpdate) // && !_application.Preferences.CheckUpdatesOnStart { return; } if (latest.VersionCode == _application.Preferences.LastSeenUpdateVersion || latest.VersionCode <= currentVersion) { return; } Java.Lang.ICharSequence dialogMessage = (latest.VersionNotes != null) ? latest.VersionNotes.FromHtml() : Resources.GetString(Resource.String.applicationUpdateAvailableMessage).FromMarkdown(); Int32 dialogTitleId = latest.IsCriticalUpdate ? Resource.String.applicationCriticalUpdateAvailableDialogTitle : Resource.String.applicationUpdateAvailableDialogTitle; String packageId = latest.GooglePlayStorePackageId; if (packageId == null) { new CustomAlertDialog(this) .SetTitle(dialogTitleId) .SetMessage(dialogMessage) .SetPositiveButton( Resource.String.openUpdateDownloadPageActionTitle, () => { String url = ApplicationUtilities.LatestReleaseDownloadPageUrl; StartActivity(IntentUtilities.CreateViewIntentFromUrl(url)); } ) .SetNegativeButton( Resource.String.gotItActionTitle, () => _application.Preferences.SetLastSeenUpdateVersion(latest.VersionCode) ) .Show(); return; } void OpenWithPlayStore() { try { Intent intent = IntentUtilities.CreateGooglePlayStoreViewIntent( this, packageId ); if (intent != null) { StartActivity(intent); } } catch (ActivityNotFoundException) { Intent intent = IntentUtilities.CreateGooglePlayStoreViewIntent( this, packageId, true ); if (intent != null) { StartActivity(intent); } } } if (packageId == PackageName) { new CustomAlertDialog(this) .SetTitle(dialogTitleId) .SetMessage(dialogMessage) .SetPositiveButton( Resource.String.openPlayMarketActionTitle, () => OpenWithPlayStore() ) .SetNegativeButton( Resource.String.gotItActionTitle, () => _application.Preferences.SetLastSeenUpdateVersion(latest.VersionCode) ) .Show(); return; } new CustomAlertDialog(this) .SetTitle(Resource.String.googlePlayStoreReleaseAvailableDialogTitle) .SetMessage(Resource.String.googlePlayStoreReleaseRelocatedMessage) .SetPositiveButton(Resource.String.openPlayMarketActionTitle, () => OpenWithPlayStore()) .Show(); }
public void LoadDropDownList(DynamicReportFilter dynamicReportCommon) { ViewBag.Services = ApplicationUtilities.SetDDLValue(LoadDropdownList("ProductName"), dynamicReportCommon.Service, "--Services--"); ViewBag.txnType = ApplicationUtilities.SetDDLValue(LoadDropdownList("TxnType"), dynamicReportCommon.TxnType, "--Transaction Type--"); ViewBag.txnStatus = ApplicationUtilities.SetDDLValue(LoadDropdownList("txnstatus"), dynamicReportCommon.TxnType, "--Transaction Status--"); }
public async Task <IActionResult> GetMe() { return(Ok(await _userService.GetByIdAsync(ApplicationUtilities.GetUserIdFromHttpContext(HttpContext)))); }
public ActionResult Manage(DistributorCommon DModel, HttpPostedFileBase Agent_Logo, HttpPostedFileBase Pan_Certiticate, HttpPostedFileBase Registration_Certificate) { string DistId = ""; var Agent_LogoPath = ""; var Pan_CertiticatePath = ""; var Registration_CertificatePath = ""; string op_type = DModel.AgentOperationType; //string temp_address = DModel..ToString(); DistId = DModel.AgentID; if (!string.IsNullOrEmpty(DModel.AgentID)) { RemoveUpdateValidation(DModel); ModelState.Remove("ContactPersonIDExpiryDate"); ModelState.Remove("ContactPersonIDExpiryDate_BS"); } if (DModel.AgentOperationType == "Individual") { RemoveContactPersonValidation(DModel); } LoadDropDownList(DModel); if (ModelState.IsValid) { string username = Session["UserName"].ToString(); if (!string.IsNullOrEmpty(DModel.AgentID)) { if (string.IsNullOrEmpty(DModel.AgentID.DecryptParameter())) { return(View("Manage", DModel)); } DModel.AgentID = DModel.AgentID.DecryptParameter(); } DModel.ActionUser = Session["username"].ToString(); DModel.IpAddress = ApplicationUtilities.GetIP(); 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(DModel)); } if (allowedExtensions.Contains(ext.ToLower())) { string datet = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' '); string myfilename = "logo " + datet + "." + Pan_Certiticate.FileName; Pan_CertiticatePath = Path.Combine(Server.MapPath("~/Content/assets/images/distributor_image"), myfilename); DModel.AgentPanCertificate = myfilename; } else { this.ShowPopup(1, "File Must be .jpg,.png,.jpeg"); return(View(DModel)); } } 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(DModel)); } if (allowedExtensions.Contains(ext.ToLower())) { string datet = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' '); string myfilename = "logo " + datet + "." + Registration_Certificate.FileName; Registration_CertificatePath = Path.Combine(Server.MapPath("~/Content/assets/images/distributor_image"), myfilename); DModel.AgentRegistrationCertificate = myfilename; //Registration_Certificate.SaveAs(path); } else { this.ShowPopup(1, "File Must be .jpg,.png,.jpeg"); return(View(DModel)); } } if (Agent_Logo != null) { var allowedExtensions = new[] { ".jpg", ".png", ".jpeg" }; var fileName = Path.GetFileName(Agent_Logo.FileName); String timeStamp = DateTime.Now.ToString(); var ext = Path.GetExtension(Agent_Logo.FileName); if (Agent_Logo.ContentLength > 1 * 1024 * 1024)//1 MB { this.ShowPopup(1, "Image Size must be less than 1MB"); return(View(DModel)); } if (allowedExtensions.Contains(ext.ToLower())) { string datet = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' '); string myfilename = "logo " + datet + "." + Agent_Logo.FileName; Agent_LogoPath = Path.Combine(Server.MapPath("~/Content/assets/images/distributor_image"), myfilename); DModel.AgentLogo = myfilename; } else { this.ShowPopup(1, "File Must be .jpg,.png,.jpeg"); return(View(DModel)); } } //DModel.DistributorId = DModel.DistributorId.DecryptParameter(); CommonDbResponse dbresp = _distributor.ManageDistributor(DModel, username); if (dbresp.Code == 0) // if (dbresp.Code == shared.Models.ResponseCode.Success) { if (!string.IsNullOrEmpty(Agent_LogoPath)) { Agent_Logo.SaveAs(Agent_LogoPath); } if (!string.IsNullOrEmpty(Registration_CertificatePath)) { Registration_Certificate.SaveAs(Registration_CertificatePath); } if (!string.IsNullOrEmpty(Pan_CertiticatePath)) { Pan_Certiticate.SaveAs(Pan_CertiticatePath); } //SaveImages On Success //Ends SaveImages this.ShowPopup(0, "Saved Succesfully"); return(RedirectToAction("Index")); } } this.ShowPopup(1, "Please fill out all the field stating * (Mandatory)"); return(View(DModel)); }
public override void OnActionExecuting(ActionExecutingContext filterContext) { HttpContext ctx = HttpContext.Current; // If the browser session or authentication session has expired... if (ctx.Session["UserName"] == null) { filterContext.Result = new RedirectToRouteResult( new RouteValueDictionary { { "Controller", "Home" }, { "Action", "LogOff" } }); } else { ILoginUserBusiness ILUB = new LoginUserBusiness(); shared.Models.SessionIdMapping map = ILUB.getUserSessionId(ctx.Session["UserName"].ToString()); if (map.Session != ctx.Session.SessionID && !map.Allowd_Multiple_Login.Equals("Y")) { filterContext.Result = new RedirectToRouteResult( new RouteValueDictionary { { "Controller", "Home" }, { "Action", "LogOff" } }); } if (map.Session.Contains("|") && !map.Session.Substring(1).Equals(ctx.Session.SessionID)) { filterContext.Result = new RedirectToRouteResult( new RouteValueDictionary { { "Controller", "Home" }, { "Action", "LogOff" } }); } var areaName = String.Empty; var controllerName = string.Empty; var actionName = string.Empty; var routeValues = HttpContext.Current.Request.RequestContext.RouteData.Values; var dataTokens = HttpContext.Current.Request.RequestContext.RouteData.DataTokens; if (routeValues != null) { var area = dataTokens.Where(x => x.Key.ToLower() == "area"); if (routeValues.ContainsKey("area")) { areaName = routeValues["area"].ToString(); } else if (dataTokens != null && area != null) { areaName = area.FirstOrDefault().Value == null ? "" : area.FirstOrDefault().Value.ToString(); } if (routeValues.ContainsKey("action")) { actionName = routeValues["action"].ToString(); } if (routeValues.ContainsKey("controller")) { controllerName = routeValues["controller"].ToString(); } var Role = ctx.Session["UserType"] != null ? ctx.Session["UserType"].ToString() : ""; #region check menu rights var functions = ctx.Session["functions"] as List <string>; if (controllerName.ToUpper() == "HOME" && (actionName.ToUpper() == "INDEX" || actionName.ToUpper() == "LOGOFF" || actionName.ToUpper() == "VERIFYCODE" || actionName.ToUpper() == "DASHBOARD2" || actionName.ToUpper() == "DASHBOARD3")) { } else { var redirectArea = ""; if (Role.ToUpper() == "ADMIN" || Role.ToUpper() == "DISTRIBUTOR" || Role.ToUpper() == "SUB-DISTRIBUTOR") { redirectArea = "ADMIN"; } else if (Role.ToUpper() == "WALLETUSER" || Role.ToUpper() == "MERCHANT" || Role.ToUpper() == "AGENT" || Role.ToUpper() == "SUB-AGENT") { redirectArea = "CLIENT"; } var func = functions.ConvertAll(x => x.ToUpper()); var actionUrl = "/" + ((String.IsNullOrEmpty(areaName) ? "" : areaName + "/") + controllerName + "/" + actionName).ToUpper(); if (func.Contains(actionUrl) == false && func.Equals(actionUrl) == false) { filterContext.Result = new RedirectToRouteResult( new RouteValueDictionary { { "Controller", "Error" }, { "Action", "error_403" }, { "Area", redirectArea } }); } } #endregion check menu rights if (Role.ToUpper() == "ADMIN" || Role.ToUpper() == "DISTRIBUTOR" || Role.ToUpper() == "SUB-DISTRIBUTOR") { if (areaName.ToUpper() != "ADMIN") { filterContext.Result = new RedirectToRouteResult( new RouteValueDictionary { { "Controller", "Error" }, { "Action", "error_403" }, { "Area", "Admin" } }); } } else if (Role.ToUpper() == "WALLETUSER" || Role.ToUpper() == "MERCHANT" || Role.ToUpper() == "AGENT" || Role.ToUpper() == "SUB-AGENT") { if (areaName.ToUpper() != "CLIENT") { filterContext.Result = new RedirectToRouteResult( new RouteValueDictionary { { "Controller", "Error" }, { "Action", "error_403" }, { "Area", "Client" } }); } } } ApplicationUtilities.LogRequest(); } base.OnActionExecuting(filterContext); }
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)); }
protected void Application_Error(object sender, EventArgs e) { bool customRedirect = true; if (ConfigurationManager.AppSettings["CustomRedirect"] != null && ConfigurationManager.AppSettings["CustomRedirect"].ToString().ToLower() == "false") { customRedirect = false; } ErrorHandlerBusiness buss = new ErrorHandlerBusiness(); Exception exception = HttpContext.Current.Error; var Session = HttpContext.Current.Session; var err = Server.GetLastError(); if (err != null) { System.Diagnostics.Debug.WriteLine(exception.GetType()); if (exception.GetType() == typeof(HttpException) || exception.GetType() == typeof(NullReferenceException) || exception.GetType() == typeof(HttpAntiForgeryException) || exception.GetType() == typeof(ArgumentNullException)) //It's an Http Exception { int statusCode = 0; if (exception.GetType() == typeof(HttpException)) { statusCode = ((HttpException)exception).GetHttpCode(); } var page = HttpContext.Current.Request.Url.ToString(); string userName = "******"; if (Session != null && Session["UserName"] != null) { userName = HttpContext.Current.Session["UserName"].ToString(); //userName = string.IsNullOrEmpty(Session["UserName"].ToString()) ? "" : Session["UserName"].ToString(); } else { userName = "******"; } string ipAddress = ApplicationUtilities.GetIP(); var id = buss.LogError(err, page, userName, ipAddress); switch (statusCode) { //case 400: // routeData.Values.Add("status", "400 - Bad Request"); // break; //case 401: // routeData.Values.Add("status", "401 - Access Denied"); // break; case 403: break; case 404: break; default: //routeData.Values.Add("status", "500 - Internal Server Error"); if (customRedirect) { HttpContext.Current.Response.Redirect("/Error/Index?Id=" + id); } break; } } } }
public ActionResult BulkUpload(HttpPostedFileBase bulk_upload) { string AgentId = Session["AgentId"].ToString(), ActionUser = Session["UserName"].ToString(); //ApplicationUtilities.GetIP(); var UploadFilePath = ""; if (bulk_upload != null) { var allowedExtensions = new[] { ".csv" }; var fileName = Path.GetFileName(bulk_upload.FileName); String timeStamp = DateTime.Now.ToString(); var ext = Path.GetExtension(bulk_upload.FileName); if (bulk_upload.ContentLength > 5 * 1024 * 1024)//1 MB { TempData["msg"] = "file must be less than 5MB"; return(RedirectToAction("Index")); } if (allowedExtensions.Contains(ext.ToLower())) { string ftpusername = ApplicationUtilities.GetAppConfigValue("ftpusername"); string ftppassword = ApplicationUtilities.GetAppConfigValue("ftppassword"); string ftpurl = ApplicationUtilities.GetAppConfigValue("ftpurl"); string uploadfilelocation = ApplicationUtilities.GetAppConfigValue("uploadfilelocation"); string datet = DateTime.Now.ToString().Replace('/', '_').Replace(':', '_').Replace(' ', '_'); string myfilename = "bulkupload_" + datet + ext; string FileLocation = uploadfilelocation + myfilename;//webconfig file location for db UploadFilePath = Path.Combine(Server.MapPath("~/Content/userupload/bulkupload"), myfilename); //UploadFilePath = Path.Combine(Server.MapPath(FileLocation), myfilename); bulk_upload.SaveAs(UploadFilePath); var client = new WebClient(); client.Credentials = new NetworkCredential(ftpusername, ftppassword); //web config username and password ftp client.UploadFile(ftpurl + myfilename, WebRequestMethods.Ftp.UploadFile, UploadFilePath); //web config ftp url var log = _upload.LogFile(myfilename, FileLocation, ActionUser); var resp = _upload.BulkUpload(myfilename, FileLocation, ActionUser, AgentId); //shared.Models.ResponseCode.Success if (resp.Code == 0) { string ProcessId = resp.Extra1; string FileName = resp.Extra2; return(RedirectToAction("GetErrorDataList", new { ProcessId = ProcessId, FileName = FileName })); } else { TempData["msg"] = resp.Message; return(RedirectToAction("Index")); } } else { TempData["msg"] = "File Must be .csv"; return(RedirectToAction("Index")); } } TempData["msg"] = "File is required"; //ViewBag.data = ErrorList; //TempData["msg"] = "successfully uploaded"; return(RedirectToAction("Index")); }
public ActionResult LoadBalanceIndex(LoadBalanceModel balance) { CommonDbResponse dbResponse = new CommonDbResponse(); var dbLimits = _iLoad.GetTransactionLimit(Session["AgentId"].ToString()); var limits = dbLimits.Data.MapObject <LoadBalanceModel>(); if (Convert.ToInt32(balance.amount) < 10 || Convert.ToInt32(balance.amount) > 100000) { return(View(limits)); } //if ( // int.Parse(balance.amount) > limits.transactiondailylimitmax // || int.Parse(balance.amount) > limits.transactionmonthlylimitmax // ) //{ // dbResponse.Code = ResponseCode.Failed; // dbResponse.Message = "Amount Exceeded Transaction Limit"; // dbResponse.SetMessageInTempData(this); // return View(limits); //} if (int.Parse(balance.amount) > limits.transactiondailylimitmax && int.Parse(balance.amount) <= limits.transactionmonthlylimitmax) { dbResponse.Code = ResponseCode.Failed; dbResponse.Message = "Amount Exceeded Daily Transaction Limit"; dbResponse.SetMessageInTempData(this); return(View(limits)); } if (int.Parse(balance.amount) > limits.transactionmonthlylimitmax) { dbResponse.Code = ResponseCode.Failed; dbResponse.Message = "Amount Exceeded Monthly Transaction Limit"; dbResponse.SetMessageInTempData(this); return(View(limits)); } LoadBalanceCommon ld = new LoadBalanceCommon(); if (ModelState.IsValid) { balance.action_user = Session["UserName"].ToString(); balance.action_ip = ApplicationUtilities.GetIP(); balance.action_browser = HttpContext.Request.Browser.ToString(); ld = balance.MapObject <LoadBalanceCommon>(); dbResponse = _iLoad.LoadBalance(ld); if (dbResponse.Code == ResponseCode.Success) { string apiusername = ApplicationUtilities.GetAppConfigValue("apiusername"); string apipasssword = ApplicationUtilities.GetAppConfigValue("apipasssword"); string apisecretkey = ApplicationUtilities.GetAppConfigValue("apisecretkey"); string merchantname = ApplicationUtilities.GetAppConfigValue("merchantname"); string merchantid = ApplicationUtilities.GetAppConfigValue("merchantid"); try { MiddleServiceRequest middlewareCall = new MiddleServiceRequest("cgpay", apiusername, apipasssword, apisecretkey, Session["UserName"].ToString()); var response = middlewareCall.GetFormObject(merchantid, merchantname, dbResponse.Extra1, balance.amount, dbResponse.Extra2, balance.instrument_code); if (response != null && response.code == "0") { var formString = ApplicationUtilities.MapObject <MiddlewareResponse.FormDataObject>(response.data); Response.Write(formString.FormData); Response.End(); } else if (response != null && response.code == "1") { dbResponse.Code = ResponseCode.Failed; dbResponse.Message = response.message; // dbResponse.SetMessageInTempData(this); return(View(limits)); } else { dbResponse.Code = ResponseCode.Failed; dbResponse.Message = "Service Call Failed"; //dbResponse.SetMessageInTempData(this); return(View(limits)); } } catch (Exception) { dbResponse.Code = ResponseCode.Failed; dbResponse.Message = "Service Call Failed"; // dbResponse.SetMessageInTempData(this); return(View(limits)); } } //dbResponse.SetMessageInTempData(this); return(View(limits)); } return(View(limits)); }
public ActionResult ManageAgent(AgentNewModel agentModel, HttpPostedFileBase Agent_Logo, HttpPostedFileBase Pan_Certiticate, HttpPostedFileBase Registration_Certificate) { var Agent_LogoPath = ""; var Pan_CertiticatePath = ""; var Registration_CertificatePath = ""; LoadDropDownList(agentModel); if (ModelState.IsValid) { AgentNewCommon AC = new AgentNewCommon(); AC = agentModel.MapObject <AgentNewCommon>(); if (!string.IsNullOrEmpty(AC.AgentID)) { if (string.IsNullOrEmpty(AC.AgentID.DecryptParameter())) { return(View(agentModel)); } } if (!string.IsNullOrEmpty(AC.ParentID)) { if (string.IsNullOrEmpty(AC.ParentID.DecryptParameter())) { return(View(agentModel)); } } AC.ActionUser = ApplicationUtilities.GetSessionValue("UserName").ToString(); AC.IpAddress = ApplicationUtilities.GetIP(); if (Agent_Logo != null) { var allowedExtensions = new[] { ".jpg", ".png", ".jpeg" }; var fileName = Path.GetFileName(Agent_Logo.FileName); String timeStamp = DateTime.Now.ToString(); var ext = Path.GetExtension(Agent_Logo.FileName); if (Agent_Logo.ContentLength > 1 * 1024 * 1024)//1 MB { this.ShowPopup(1, "Image Size must be less than 1MB"); return(View(agentModel)); } if (allowedExtensions.Contains(ext.ToLower())) { string datet = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' '); string myfilename = "logo " + datet + "." + Agent_Logo.FileName; Agent_LogoPath = Path.Combine(Server.MapPath("~/Content/assets/images/distributor_image"), myfilename); AC.AgentLogo = myfilename; } else { this.ShowPopup(1, "File Must be .jpg,.png,.jpeg"); return(View(agentModel)); } } if (AC.AgentOperationType.ToUpper() == "BUSINESS") { 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(agentModel)); } if (allowedExtensions.Contains(ext.ToLower())) { string datet = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' '); string myfilename = "logo " + datet + "." + Pan_Certiticate.FileName; Pan_CertiticatePath = Path.Combine(Server.MapPath("~/Content/assets/images/distributor_image"), myfilename); AC.AgentPanCertificate = myfilename; } else { this.ShowPopup(1, "File Must be .jpg,.png,.jpeg"); return(View(agentModel)); } } 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(agentModel)); } if (allowedExtensions.Contains(ext.ToLower())) { string datet = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' '); string myfilename = "logo " + datet + "." + Registration_Certificate.FileName; Registration_CertificatePath = Path.Combine(Server.MapPath("~/Content/assets/images/distributor_image"), myfilename); AC.AgentRegistrationCertificate = myfilename; //Registration_Certificate.SaveAs(path); } else { this.ShowPopup(1, "File Must be .jpg,.png,.jpeg"); return(View(agentModel)); } } } CommonDbResponse dbresp = buss.ManageAgent(AC); if (dbresp.Code == 0) { this.ShowPopup(0, dbresp.Message); return(RedirectToAction("Index")); } agentModel.Msg = dbresp.Message; } this.ShowPopup(1, "Error " + agentModel.Msg); return(View(agentModel)); }
public ActionResult ReceivePaymentResponse(string MerchantTxnId, string GatewayTxnId) { if (string.IsNullOrEmpty(MerchantTxnId) && string.IsNullOrEmpty(GatewayTxnId)) { CommonDbResponse dbRes = new CommonDbResponse(); ViewTransactionReponseModel viewModel = new ViewTransactionReponseModel(); viewModel.code = 1; viewModel.Message = "Tranasaction Failed"; viewModel.gateway_status = "Failed"; //dbRes.SetMessageInTempData(this); return(View(viewModel)); } string apiusername = ApplicationUtilities.GetAppConfigValue("apiusername"); string apipasssword = ApplicationUtilities.GetAppConfigValue("apipasssword"); string apisecretkey = ApplicationUtilities.GetAppConfigValue("apisecretkey"); string merchantname = ApplicationUtilities.GetAppConfigValue("merchantname"); string merchantid = ApplicationUtilities.GetAppConfigValue("merchantid"); CommonDbResponse dbResponse = new CommonDbResponse(); ViewTransactionReponseModel model = new ViewTransactionReponseModel(); try { MiddleServiceRequest serviceCall = new MiddleServiceRequest("cgpay", apiusername, apipasssword, apisecretkey, Session["UserName"].ToString()); var resp = serviceCall.GetTransactionDetail(merchantid, merchantname, MerchantTxnId); //if (resp != null && resp.code == "0" && resp.data.Status.ToLower() == "success" ) //{ // dbResponse = _iLoad.GetTransactionReposne(MerchantTxnId, GatewayTxnId); // if (dbResponse.Code == ResponseCode.Success) // { // model = ApplicationUtilities.MapObject<ViewTransactionReponseModel>(dbResponse.Data); // model.code = int.Parse(resp.code); // return View(model); // } // else // { // //dbResponse.SetMessageInTempData(this); // model.code = 1; // return View(model); // } //} //else if (resp != null && resp.code == "0" && resp.data.Status.ToLower() == "fail") //{ // model.code = 1; // model.Message = "Tranasaction Failed"; // //dbResponse.SetMessageInTempData(this); // return View(model); //} //else if (resp != null && resp.code == "1") //{ // dbResponse.Code = ResponseCode.Failed; // dbResponse.Message = resp.message; // dbResponse.SetMessageInTempData(this); // model.code = int.Parse(resp.code); // return View(model); //} //else //{ // dbResponse.Code = ResponseCode.Failed; // dbResponse.Message = "Service Call Failed"; // dbResponse.SetMessageInTempData(this); // model.code = 1; // return View(model); //} if (resp != null && resp.code == "0") { dbResponse = _iLoad.GetTransactionReposne(MerchantTxnId, GatewayTxnId); if (dbResponse.Code == ResponseCode.Success) { model = ApplicationUtilities.MapObject <ViewTransactionReponseModel>(dbResponse.Data); model.code = int.Parse(resp.code); return(View(model)); } else { model.code = 1; model.Message = "Transaction status failed."; model.gateway_status = "Failed"; return(View(model)); } } else if (resp != null && resp.code == "1") { //dbResponse.Code = ResponseCode.Failed; model.Message = "Transaction status failed."; model.gateway_status = "Failed"; model.code = 1; return(View(model)); } else { //dbResponse.Code = ResponseCode.Failed; model.Message = "Transaction status failed."; model.gateway_status = "Failed"; model.code = 1; return(View(model)); } } catch (Exception) { //dbResponse.Code = ResponseCode.Failed; model.Message = "Transaction status failed."; model.gateway_status = "Failed"; //dbResponse.SetMessageInTempData(this); model.code = 1; return(View(model)); } }
public ActionResult VianetBillInquiry(VianetBillInquiryModel wpm) { VianetBillInquiryCommon wpc = wpm.MapObject <VianetBillInquiryCommon>(); var productdetails = GetVianetproductDetails(); wpm.ProductLogo = productdetails.ProductLogo; wpm.CommissionType = productdetails.CommissionType; wpm.CommissionValue = productdetails.CommissionValue; wpc.IpAddress = ApplicationUtilities.GetIP(); wpc.UserId = ApplicationUtilities.GetSessionValue("userid").ToString(); var inquiry = _vianet.CheckVianetAccount(wpc); VianetBillInquiryResponseModel vnet = new VianetBillInquiryResponseModel(); vnet.ProductLogo = productdetails.ProductLogo; vnet.CommissionType = productdetails.CommissionType; vnet.CommissionValue = productdetails.CommissionValue; vnet.ProductId = productdetails.ProductId.EncryptParameter(); if (inquiry.GatewayName.ToUpper() == "PRABHUPAY") { if (inquiry.Code == shared.Models.ResponseCode.Success) { var obj = Newtonsoft.Json.JsonConvert.SerializeObject(inquiry.Data); var prabhupayinqresp = Newtonsoft.Json.JsonConvert.DeserializeObject <PrabhuPayVianetBillInquiryResponseModel>(obj); vnet.CustomerName = prabhupayinqresp.CustomerName; vnet.VianetCustomerId = prabhupayinqresp.VianetCustomerId; vnet.PaymentMessage = prabhupayinqresp.PaymentMessage; List <PlansModel> lst = new List <PlansModel>(); foreach (var item in prabhupayinqresp.RenewalPlans) { PlansModel plan = new PlansModel() { PlanId = item.PlanId, PlanAmount = item.PlanAmount, PlanName = item.PlanName, PlanDescription = item.PlanDescription }; lst.Add(plan); } //wlink.RenewalPlans = lst; //var planlst = DropdownPlan(lst); //if (planlst == null) //{ // ViewBag.Planlist = null; //} ViewBag.Planlist = ApplicationUtilities.SetDDLValue(DropdownPlan(lst), "", "--Select--"); vnet.Encryptioncontent = (prabhupayinqresp.VianetCustomerId + prabhupayinqresp.BillAmount).EncryptParameter(); string AgentId = Session["AgentId"].ToString(); var TxnLimit = _transactionLimit.GetTransactionLimitForUser(AgentId); var trangrid = ProjectGrid.TransactionLimit(TxnLimit); ViewData["trangrid"] = trangrid; return(View("VianetBillPayment", vnet)); } else { string AgentId = Session["AgentId"].ToString(); var TxnLimit = _transactionLimit.GetTransactionLimitForUser(AgentId); var trangrid = ProjectGrid.TransactionLimit(TxnLimit); ViewData["trangrid"] = trangrid; this.ShowPopup(1, inquiry.Message); return(View(wpm)); } } this.ShowPopup(1, "Service Unavaliable"); return(View(wpm)); }
public ActionResult Generate(int appId = 0, string[] selectedTables = null, string selectedTheme = "") { try { string userName = User.Identity.Name; Application application = applicationRepository.FindFirst(ap => ap.Member.username == userName && ap.Id == appId); if (application != null) { bool connectionSuccess = CheckConnection(application); if (connectionSuccess == true) { DeleteExistsFile(application); //Change Application Theme application.theme_id = GetTheme(selectedTheme); applicationRepository.Edit(application); //Create Application Folders string appMainDirectory = CreateAppDirectories(application); if (!string.IsNullOrEmpty(appMainDirectory)) { //Generate Database files string connectionString = Globals.GetSQLServerConnectionString(application); string appName = application.Name; var myGenerator = new MyGenerator(connectionString, appName, appMainDirectory); //App Tables var tablesType = myGenerator.DatabaseTables.Where(tb => selectedTables.Contains(tb.Name)).ToList(); //Create application models and mapping myGenerator.GenerateCode(); CreateContextAndConfig(myGenerator.DatabaseTables.ToList(), application, appMainDirectory); //Create application controllers var controllerGenerator = new ControllerGenerator(myGenerator, appName, appMainDirectory); controllerGenerator.Generate(tablesType, connectionString); //Create application navigation menu ApplicationUtilities utilities = new ApplicationUtilities(appMainDirectory, application.Name); utilities.CreateAppNav(tablesType); //Create Application project file string[] controllers = tablesType.Select(tp => tp.Name).ToArray <string>(); string[] allModels = myGenerator.DatabaseTables.Select(tp => tp.Name).ToArray <string>(); utilities.CreateProjectFile(controllers, allModels, application.Theme.FileName); //Create Home Controller utilities.CreateControllerHome(tablesType); application.generated = true; applicationRepository.Edit(application); //Zip Application Folder string member_public_id = application.Member.public_id; utilities.ZipApplication(application); //Check the application has folders or not //DirectoryUtility.DeleteFolder(Globals.APP_DATA_PATH + "\\" + member_public_id + "\\" + application.Name + "_" + application.Id); return(View("Success", new MessageView() { Message = "Your application has been generated successfully." })); } } else { return(View("Error", new MessageView() { Message = "An error while connecting to your database." })); } } ViewBag.appId = application.Id; return(View()); } catch (Exception ex) { return(View("Error", new MessageView() { Message = "An error occured while generating the application" })); } }
public ActionResult ViewSubDistributorUser(string DistId = "") { var UserType = Session["UserType"].ToString(); string username = ApplicationUtilities.GetSessionValue("username").ToString(); string id = "", IsPrimary = ApplicationUtilities.GetSessionValue("IsPrimaryUser").ToString().Trim(); /*if (UserType.ToUpper() == "SUB-DISTRIBUTOR") * { * return RedirectToAction("Index", "SubDistributorManagement", new { DistId = Session["AgentId"].ToString() }); * } * else if (UserType.ToUpper() == "DISTRIBUTOR") * { * id = Session["AgentId"].ToString(); * } * else * { * id = DistId.DecryptParameter(); * }*/ if (UserType.ToUpper() == "SUB-DISTRIBUTOR") { id = Session["AgentId"].ToString(); } else { id = DistId.DecryptParameter(); } if (string.IsNullOrEmpty(id)) { return(RedirectToAction("Index")); } var userId = ""; if (String.IsNullOrEmpty(IsPrimary) == false && (IsPrimary.ToUpper().Trim() == "N" || IsPrimary.ToUpper().Trim() == "")) { userId = Session["UserId"].ToString(); } var subDistributorCommons = buss.GetUserList(id, username, userId); //Actions foreach (var item in subDistributorCommons) { item.Action = StaticData.GetActions("SubDistributorManagementUser", item.UserID.EncryptParameter(), this, "", "", item.AgentID.EncryptParameter(), item.UserStatus, item.IsPrimary, DisableAddEdit: Session["UserId"].ToString() == item.UserID); } //Column Creator IDictionary <string, string> param = new Dictionary <string, string>(); //param.Add("DistributorId", "Agent Id"); param.Add("FullName", "Fullname"); param.Add("UserName", "Username"); param.Add("UserEmail", "Email"); param.Add("UserMobileNumber", "Mobile No"); // param.Add("UserType", "User Type"); param.Add("IsPrimary", "Is primary"); param.Add("UserStatus", "Status"); param.Add("Action", "Action"); ProjectGrid.column = param; //Ends //Add New var grid = ProjectGrid.MakeGrid(subDistributorCommons, "Sub-Distributor Users", "", 0, true, "", "", "Home", "Sub-Distributor", "/Admin/SubDistributorManagement", String.IsNullOrEmpty(IsPrimary) == false && IsPrimary.ToUpper().Trim() == "Y" ? "/Admin/SubDistributorManagement/ManageSubDistributorUsers?distid=" + id.EncryptParameter() : ""); ViewData["grid"] = grid; return(View()); }
// GET: KYC/Details/id="1003" public ActionResult Details(string agentid = "") { KYCCommon kycCommon = new KYCCommon(); KYCModelDetail kycModel = new KYCModelDetail(); var ID = agentid.DecryptParameter(); if (String.IsNullOrEmpty(ID)) { return(RedirectToAction("Index", ControllerName)); } if (!String.IsNullOrEmpty(ID)) { kycCommon = _kyc.AgentKycInfo(ID); } //kycCommon.AgentId = ID.ToString(); kycModel = kycCommon.MapObject <KYCModelDetail>(); kycModel.Country = string.IsNullOrEmpty(kycModel.Country) ? "Nepal" : kycModel.Country; kycModel.Nationality = string.IsNullOrEmpty(kycModel.Nationality) ? "Nepali" : kycModel.Nationality; var pprovince = LoadDropdownList("province") as Dictionary <string, string>; kycModel.PProvince = pprovince.ContainsKey(kycModel.PProvince) ? pprovince.FirstOrDefault(x => x.Key == kycModel.PProvince).Value : kycModel.PProvince; kycModel.TProvince = pprovince.ContainsKey(kycModel.TProvince) ? pprovince.FirstOrDefault(x => x.Key == kycModel.TProvince).Value : kycModel.TProvince; ViewBag.AgentId = ID; KYCModel kyc = new KYCModel(); kyc = kycModel.MapObject <KYCModel>(); ViewBag.RemarksList = ApplicationUtilities.SetDDLValue(LoadDropdownList("remarks") as Dictionary <string, string>, kycModel.Remarks, "--Remarks--"); //LoadDropDownList(kyc); #region FileLocation string FileLocation; string usertype = kycModel.AgentType; if (usertype.ToLower() == "distributor") { FileLocation = "/Content/userupload/Distributor/kyc/"; } else if (usertype.ToLower() == "sub-distributor") { FileLocation = "/Content/userupload/SubDistributor/kyc/"; } else if (usertype.ToLower() == "walletuser") { FileLocation = "/Content/userupload/Walletuser/kyc/"; } else if (usertype.ToLower() == "merchant") { FileLocation = "/Content/userupload/Merchant/kyc/"; } else if (usertype.ToLower() == "agent") { FileLocation = "/Content/userupload/Agent/kyc/"; } else if (usertype.ToLower() == "sub-agent") { FileLocation = "/Content/userupload/SubAgent/kyc/"; } else { FileLocation = "/Content/userupload/"; } ViewBag.FileLocation = FileLocation; #endregion return(View(kycModel)); }
public ActionResult ManageSubDistributor(SubDistributorManagementModel DistModel, HttpPostedFileBase Agent_Logo, HttpPostedFileBase Pan_Certiticate, HttpPostedFileBase Registration_Certificate, string changepassword) { var Agent_LogoPath = ""; var Pan_CertiticatePath = ""; var Registration_CertificatePath = ""; ModelState.Remove("AgentContractDate_BS"); LoadDropDownList(DistModel); if (!string.IsNullOrEmpty(DistModel.AgentID.DecryptParameter())) { RemoveupdateValidation(DistModel); } if (DistModel.AgentOperationType.ToUpper() != "BUSINESS") { DistModel.AgentEmail = DistModel.UserEmail; DistModel.AgentMobileNumber = DistModel.UserMobileNumber; RemoveBusinessValidation(DistModel); } if (ModelState.IsValid) { SubDistributorManagementCommon DMC = new SubDistributorManagementCommon(); DMC = DistModel.MapObject <SubDistributorManagementCommon>(); if (!string.IsNullOrEmpty(DMC.AgentID)) { if (string.IsNullOrEmpty(DMC.AgentID.DecryptParameter())) { return(View(DistModel)); } if (string.IsNullOrEmpty(changepassword)) { DMC.Password = ""; DMC.ConfirmPassword = ""; } DMC.AgentID = DMC.AgentID.DecryptParameter(); DMC.UserID = DMC.UserID.DecryptParameter(); } if (!string.IsNullOrEmpty(DMC.ParentID)) { if (string.IsNullOrEmpty(DMC.ParentID.DecryptParameter())) { return(View(DistModel)); } DMC.ParentID = DMC.ParentID.DecryptParameter(); } DMC.ActionUser = ApplicationUtilities.GetSessionValue("UserName").ToString(); DMC.IpAddress = ApplicationUtilities.GetIP(); if (Agent_Logo != null) { var allowedExtensions = new[] { ".jpg", ".png", ".jpeg" }; var fileName = Path.GetFileName(Agent_Logo.FileName); String timeStamp = DateTime.Now.ToString(); var ext = Path.GetExtension(Agent_Logo.FileName); if (Agent_Logo.ContentLength > 1 * 1024 * 1024)//1 MB { this.ShowPopup(1, "Image Size must be less than 1MB"); return(View(DistModel)); } if (allowedExtensions.Contains(ext.ToLower())) { string datet = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' '); string myfilename = "logo " + datet + ext.ToLower(); Agent_LogoPath = Path.Combine(Server.MapPath("~/Content/userupload/subdistributor"), myfilename); DMC.AgentLogo = "/content/userupload/subdistributor/" + myfilename; } else { this.ShowPopup(1, "File Must be .jpg,.png,.jpeg"); return(View(DistModel)); } } if (DMC.AgentOperationType.ToUpper() == "BUSINESS") { 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(DistModel)); } if (allowedExtensions.Contains(ext.ToLower())) { string datet = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' '); string myfilename = "pan " + datet + ext.ToLower(); Pan_CertiticatePath = Path.Combine(Server.MapPath("~/Content/userupload/subdistributor"), myfilename); DMC.AgentPanCertificate = "/content/userupload/subdistributor/" + myfilename; } else { this.ShowPopup(1, "File Must be .jpg,.png,.jpeg"); return(View(DistModel)); } } 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(DistModel)); } if (allowedExtensions.Contains(ext.ToLower())) { string datet = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' '); string myfilename = "reg " + datet + ext.ToLower(); Registration_CertificatePath = Path.Combine(Server.MapPath("~/Content/userupload/subdistributor"), myfilename); DMC.AgentRegistrationCertificate = "/content/userupload/subdistributor/" + myfilename; //Registration_Certificate.SaveAs(path); } else { this.ShowPopup(1, "File Must be .jpg,.png,.jpeg"); return(View(DistModel)); } } } CommonDbResponse dbresp = buss.ManageSubDistributor(DMC); if (dbresp.Code == 0) { if (DMC.AgentOperationType.ToUpper() == "BUSINESS") { if (Pan_Certiticate != null) { Pan_Certiticate.SaveAs(Pan_CertiticatePath); } if (Registration_Certificate != null) { Registration_Certificate.SaveAs(Registration_CertificatePath); } } if (Agent_Logo != null) { Agent_Logo.SaveAs(Agent_LogoPath); } this.ShowPopup(0, dbresp.Message); return(RedirectToAction("Index", new { ParentId = DistModel.ParentID })); } DistModel.Msg = dbresp.Message; } this.ShowPopup(1, "Error " + DistModel.Msg); return(View(DistModel)); }
public ActionResult Manage(SubDistributorModel SDM, HttpPostedFileBase Agent_Logo, HttpPostedFileBase Pan_Certiticate, HttpPostedFileBase Registration_Certificate) { ViewBag.PermanentCountryList = ApplicationUtilities.SetDDLValue(LoadDropdownList("country"), SDM.PermanentCountry, "--Permanent Country--"); ViewBag.PermanentProvienceList = ApplicationUtilities.SetDDLValue(LoadDropdownList("province", SDM.PermanentCountry), SDM.PermanentProvince, "--Permanent Provience--"); ViewBag.PermanentDistrictList = ApplicationUtilities.SetDDLValue(LoadDropdownList("districtList", SDM.PermanentProvince) as Dictionary <string, string>, SDM.PermanentDistrict, "--Permanent District--"); ViewBag.PermanentVDC_MuncipilityList = ApplicationUtilities.SetDDLValue(LoadDropdownList("vdc_muncipality", SDM.PermanentDistrict), SDM.PermanentVDC_Muncipality, "--Permanent VDC Muncipality--"); ViewBag.TemporarytCountryList = ApplicationUtilities.SetDDLValue(LoadDropdownList("country"), SDM.TemporaryCountry, "--Temporary Country--"); ViewBag.TemporaryProvienceList = ApplicationUtilities.SetDDLValue(LoadDropdownList("province", SDM.TemporaryCountry), SDM.TemporaryProvince, "--Temporary Provience--"); ViewBag.TemporaryDistrictList = ApplicationUtilities.SetDDLValue(LoadDropdownList("districtList", SDM.TemporaryProvince), SDM.TemporaryDistrict, "--Temporary District--"); ViewBag.TemporaryVDC_MuncipilityList = ApplicationUtilities.SetDDLValue(LoadDropdownList("vdc_muncipality", SDM.TemporaryDistrict), SDM.TemporaryVDC_Muncipality, "--Temporary VDC Muncipality--"); ViewBag.GenderList = ApplicationUtilities.SetDDLValue(LoadDropdownList("gender"), SDM.Gender, "--Select Gender--"); ViewBag.OccupationList = ApplicationUtilities.SetDDLValue(LoadDropdownList("occupation"), SDM.Occupation, "--Select Occupation--"); ViewBag.Nationalitylist = ApplicationUtilities.SetDDLValue(LoadDropdownList("nationality"), SDM.Nationality, "--Select Nationality--"); ViewBag.DoctypeList = ApplicationUtilities.SetDDLValue(LoadDropdownList("doctype"), SDM.Nationality, "--Select Document Type--"); ViewBag.IssueDistrictList = ApplicationUtilities.SetDDLValue(LoadDropdownList("issuedistrict"), SDM.Nationality, "--Select District--"); if (!string.IsNullOrEmpty(SDM.AgentID)) { RemoveUserValidation(SDM); } if (SDM.AgentOperationType.ToUpper() == "INDIVIDUAL") { RemoveContactPersonValidation(SDM); } if (ModelState.IsValid) { SubDistributorCommon SDC = SDM.MapObject <SubDistributorCommon>(); if (!string.IsNullOrEmpty(SDC.AgentID)) { if (string.IsNullOrEmpty(SDC.AgentID.DecryptParameter())) { return(View("Manage", SDM)); } SDC.AgentID = SDC.AgentID.DecryptParameter(); } if (!string.IsNullOrEmpty(SDC.UserId)) { if (string.IsNullOrEmpty(SDC.UserId.DecryptParameter())) { return(View("Manage", SDM)); } SDC.UserId = SDC.UserId.DecryptParameter(); } if (!string.IsNullOrEmpty(SDC.ParentId)) { SDC.ParentId = SDC.ParentId.DecryptParameter(); } SDC.ActionUser = Session["username"].ToString(); SDC.IpAddress = ApplicationUtilities.GetIP(); 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(SDM)); } if (allowedExtensions.Contains(ext.ToLower())) { string datet = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' '); string myfilename = "logo " + datet + "." + Pan_Certiticate.FileName; var path = Path.Combine(Server.MapPath("~/Content/assets/images/Sub_Distributor"), myfilename); SDC.AgentPanCertificate = myfilename; Pan_Certiticate.SaveAs(path); } else { this.ShowPopup(1, "File Must be .jpg,.png,.jpeg"); return(View(SDM)); } } 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(SDM)); } if (allowedExtensions.Contains(ext.ToLower())) { string datet = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' '); string myfilename = "logo " + datet + "." + Registration_Certificate.FileName; var path = Path.Combine(Server.MapPath("~/Content/assets/images/Sub_Distributor"), myfilename); SDC.AgentRegistrationCertificate = myfilename; Registration_Certificate.SaveAs(path); } else { this.ShowPopup(1, "File Must be .jpg,.png,.jpeg"); return(View(SDM)); } } if (Agent_Logo != null) { var allowedExtensions = new[] { ".jpg", ".png", ".jpeg" }; var fileName = Path.GetFileName(Agent_Logo.FileName); String timeStamp = DateTime.Now.ToString(); var ext = Path.GetExtension(Agent_Logo.FileName); if (Agent_Logo.ContentLength > 1 * 1024 * 1024)//1 MB { this.ShowPopup(1, "Image Size must be less than 1MB"); return(View(SDM)); } if (allowedExtensions.Contains(ext.ToLower())) { string datet = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' '); string myfilename = "logo " + datet + "." + Agent_Logo.FileName; var path = Path.Combine(Server.MapPath("~/Content/assets/images/Sub_Distributor"), myfilename); SDC.AgentLogo = myfilename; Agent_Logo.SaveAs(path); } else { this.ShowPopup(1, "File Must be .jpg,.png,.jpeg"); return(View(SDM)); } } var dbresp = ISD.Manage(SDC); if (dbresp.Code == 0) { this.ShowPopup(0, dbresp.Message); return(RedirectToAction("Index", new{ DistId = SDM.ParentId })); } SDM.Msg = dbresp.Message; } this.ShowPopup(1, "Error " + SDM.Msg); return(View(SDM)); }