public ServicesCommon GetServicesByProductId(int ProductId) { var services = new ServicesCommon(); string sql = "sproc_manage_services @flag='vid',@product_id=" + DAO.FilterString(ProductId.ToString()); var dr = DAO.ExecuteDataRow(sql); if (dr != null) { services.ProductId = dr["product_id"].ToString(); services.TransactionType = dr["txn_type"].ToString(); services.Company = dr["company"].ToString(); services.ProductServiceInfo = dr["Product_service_info"].ToString(); services.ProductLabel = dr["product_label"].ToString(); services.ProductType = dr["product_type"].ToString(); services.ProductCategory = dr["product_category"].ToString(); services.MinDenominationAmount = dr["min_denomination_amount"].ToString(); services.MaxDenomonationAmount = dr["max_denomination_amount"].ToString(); services.ProductLogo = dr["product_logo"].ToString(); services.ProductCode = dr.Table.Columns.Contains("product_code") ? dr["product_code"].ToString() : ""; services.ProductUrl = dr.Table.Columns.Contains("product_url") ? dr["product_url"].ToString() : ""; services.PrimaryGateway = dr["primary_gateway"].ToString(); services.SecondaryGateway = dr["secondary_gateway"].ToString(); services.Status = dr["product_status"].ToString().Trim(); } return(services); }
public ActionResult ManageServices(string id = "") { ServicesCommon servicesCommon = new ServicesCommon(); var productid = id.DecryptParameter(); if (!String.IsNullOrEmpty(productid)) { //return RedirectToAction("Index"); servicesCommon = _services.GetServicesByProductId(Int32.Parse(productid)); servicesCommon.ProductId = servicesCommon.ProductId.EncryptParameter(); } servicesCommon.StatusList = LoadDropdownList("status") as List <SelectListItem>; servicesCommon.CompanyList = ApplicationUtilities.SetDDLValue(LoadDropdownList("company") as Dictionary <string, string>, servicesCommon.Company, "Select Company"); servicesCommon.TransactionTypeList = ApplicationUtilities.SetDDLValue(LoadDropdownList("txntype") as Dictionary <string, string>, servicesCommon.TransactionType, "Select Transaction Type"); servicesCommon.ProductTypeList = ApplicationUtilities.SetDDLValue(LoadDropdownList("producttype") as Dictionary <string, string>, servicesCommon.ProductType, "Select Product Type"); servicesCommon.ProductCategoryList = ApplicationUtilities.SetDDLValue(LoadDropdownList("productcategory") as Dictionary <string, string>, servicesCommon.ProductCategory, "Select Product Category"); servicesCommon.PrimaryGatewayList = ApplicationUtilities.SetDDLValue(LoadDropdownList("primarygateway") as Dictionary <string, string>, servicesCommon.PrimaryGateway, "Select Primary Gateway"); servicesCommon.SecondaryGatewayList = ApplicationUtilities.SetDDLValue(LoadDropdownList("secondarygateway") as Dictionary <string, string>, servicesCommon.SecondaryGateway, "Select Secondary Gateway"); ServicesModel lst = servicesCommon.MapObject <ServicesModel>(); return(View(lst)); }
public List <ServicesCommon> GetServicesList(string UserId = "") { var list = new List <ServicesCommon>(); string sql = "sproc_manage_services @flag='v'"; sql += (string.IsNullOrEmpty(UserId) ? "" : ", @user_id =" + DAO.FilterString(UserId)); var dt = DAO.ExecuteDataTable(sql); // List<ServicesCommon> list = new List<ServicesCommon>(); if (dt != null) { //int sn = 1; foreach (DataRow item in dt.Rows) { var common = new ServicesCommon(); //{ common.ProductId = item["product_id"].ToString(); common.TransactionType = item["txn_type"].ToString(); common.Company = item["company"].ToString(); // ProductServiceInfo = item[""].ToString(), common.ProductLabel = item["product_label"].ToString(); common.ProductType = item["product_type"].ToString(); common.ProductCategory = item["product_category"].ToString(); common.MinDenominationAmount = item["min_denomination_amount"].ToString(); common.MaxDenomonationAmount = item["max_denomination_amount"].ToString(); common.ProductLogo = item["product_logo"].ToString(); common.ProductCode = dt.Columns.Contains("product_code") ? item["product_code"].ToString() : ""; common.ProductUrl = dt.Columns.Contains("product_url") ? item["product_url"].ToString() : ""; //PrimaryGateway = item[""].ToString(), //SecondaryGateway = item[""].ToString(), common.Status = item["product_status"].ToString(); common.ClientPmtUrl = item["clientPmtUrl"].ToString(); // }; if (!string.IsNullOrEmpty(UserId)) { common.CommissionValue = item["commission_value"].ToString(); common.CommissionType = item["commission_type"].ToString(); } list.Add(common); } } else { list = null; } return(list); }
public ActionResult ServicesDetail(string id = "") { ServicesCommon servicesCommon = new ServicesCommon(); var productid = id.DecryptParameter(); if (!String.IsNullOrEmpty(productid)) { //return RedirectToAction("Index"); servicesCommon = _services.GetServicesByProductId(Int32.Parse(productid)); servicesCommon.ProductId = servicesCommon.ProductId.EncryptParameter(); } Dictionary <string, string> CompanyList = LoadDropdownList("company") as Dictionary <string, string>; servicesCommon.Company = CompanyList.ContainsKey(servicesCommon.Company) ? CompanyList.First(x => x.Key == servicesCommon.Company).Value : servicesCommon.Company; Dictionary <string, string> TransactionTypeList = LoadDropdownList("txntype") as Dictionary <string, string>; servicesCommon.TransactionType = TransactionTypeList.ContainsKey(servicesCommon.TransactionType) ? TransactionTypeList.First(x => x.Key == servicesCommon.TransactionType).Value : servicesCommon.TransactionType; Dictionary <string, string> ProductTypeList = LoadDropdownList("producttype") as Dictionary <string, string>; servicesCommon.ProductType = ProductTypeList.ContainsKey(servicesCommon.ProductType) ? ProductTypeList.First(x => x.Key == servicesCommon.ProductType).Value : servicesCommon.ProductType; Dictionary <string, string> ProductCategoryList = LoadDropdownList("productcategory") as Dictionary <string, string>; servicesCommon.ProductCategory = ProductCategoryList.ContainsKey(servicesCommon.ProductCategory) ? ProductCategoryList.First(x => x.Key == servicesCommon.ProductCategory).Value : servicesCommon.ProductCategory; Dictionary <string, string> PrimaryGatewayList = LoadDropdownList("primarygateway") as Dictionary <string, string>; servicesCommon.PrimaryGateway = PrimaryGatewayList.ContainsKey(servicesCommon.PrimaryGateway) ? PrimaryGatewayList.First(x => x.Key == servicesCommon.PrimaryGateway).Value : servicesCommon.PrimaryGateway; Dictionary <string, string> SecondaryGatewayList = LoadDropdownList("secondarygateway") as Dictionary <string, string>; servicesCommon.SecondaryGateway = CompanyList.ContainsKey(servicesCommon.SecondaryGateway) ? CompanyList.First(x => x.Key == servicesCommon.SecondaryGateway).Value : servicesCommon.SecondaryGateway; servicesCommon.Status = string.IsNullOrEmpty(servicesCommon.Status) ? "Disabled" : string.Equals(servicesCommon.Status.ToUpper(), "Y") ? "Enabled" : "Disabled"; ServicesModel lst = servicesCommon.MapObject <ServicesModel>(); return(View(lst)); }
public CommonDbResponse ManageServices(ServicesCommon SC, string username) { string[] producttype = SC.ProductType.Split('|'); string sql = "sproc_manage_services "; sql += "@flag ='" + (string.IsNullOrEmpty(SC.ProductId) ? "i" : "u") + "' "; sql += ",@product_label=" + DAO.FilterString(SC.ProductLabel); sql += ",@product_type_id=" + DAO.FilterString(producttype[0]); sql += ",@product_type=" + DAO.FilterString(producttype[1]); sql += ",@product_logo=" + DAO.FilterString(SC.ProductLogo); sql += ",@product_service_info=" + DAO.FilterString(SC.ProductServiceInfo); sql += ",@product_category=" + DAO.FilterString(SC.ProductCategory); sql += ",@denomination_min=" + DAO.FilterString(SC.MinDenominationAmount); sql += ",@denomination_max=" + DAO.FilterString(SC.MaxDenomonationAmount); sql += "," + (string.IsNullOrEmpty(SC.ProductId) ? "@created_by" : "@updated_by") + " = " + DAO.FilterString(username); sql += ",@product_url=" + DAO.FilterString(SC.ProductUrl); if (string.IsNullOrEmpty(SC.ProductId)) { string[] trantype = SC.TransactionType.Split('|'); string[] company = SC.Company.Split('|'); sql += ",@product_status=" + DAO.FilterString(SC.Status); sql += ",@product_code=" + DAO.FilterString(SC.ProductCode); sql += ",@txn_type_id=" + DAO.FilterString(trantype[0]); sql += ",@txn_type=" + DAO.FilterString(trantype[1]); sql += ",@company_id=" + DAO.FilterString(company[0]); sql += ",@company=" + DAO.FilterString(company[1]); sql += ",@primary_gateway=" + DAO.FilterString(SC.PrimaryGateway); sql += ",@secondary_gateway=" + DAO.FilterString(SC.SecondaryGateway); sql += ",@created_ip=" + DAO.FilterString(SC.CreatedIp); } else { sql += ",@product_id=" + DAO.FilterString(SC.ProductId.ToString()); } return(DAO.ParseCommonDbResponse(sql)); }
public ActionResult ManageServices(ServicesModel SM, HttpPostedFileBase file) { string productid = ""; if (ModelState.IsValid) { string username = Session["UserName"].ToString(); SM.StatusList = LoadDropdownList("status") as List <SelectListItem>; productid = SM.ProductId; if (!string.IsNullOrEmpty(productid)) { if (string.IsNullOrEmpty(productid.DecryptParameter())) { return(RedirectToAction("ManageServices", SM)); } SM.ProductId = productid.DecryptParameter(); SM.Status = ""; } 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(RedirectToAction("ManageServices", ControllerName, productid)); } 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)); } } #endregion ServicesCommon service = SM.MapObject <ServicesCommon>(); 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(RedirectToAction("ManageServices", SM)); }
//public CommonDbResponse UpdateServicesByProductId(ServicesCommon SC, string username) //{ // return _repo.UpdateServicesByProductId( SC, username); //} public CommonDbResponse ManageServices(ServicesCommon SC, string username) { return(_repo.ManageServices(SC, username)); }