public ActionResult Create() { PaymentMethodModels model = new PaymentMethodModels(); return(PartialView("Create", model)); //return View("Create", model); }
public ActionResult AddChild(int currentOffset) { PaymentMethodModels group = new PaymentMethodModels(); group.OffSet = currentOffset; return(PartialView("_ItemCardForPaymentMethod", group)); }
public bool CreateOrEdit(PaymentMethodModels paymentMethod, ref string msg) { bool resultReturn = false; try { CreateOrEditPaymentMethodRequest paraBody = new CreateOrEditPaymentMethodRequest(); paraBody.PaymentMethod = paymentMethod; NSLog.Logger.Info("Payment method CreateOrEdit Request", paraBody); var result = (NSApiResponse)ApiResponse.Post <NSApiResponse>(Commons.paymentMethodAPICreateOrEdit, null, paraBody); NSLog.Logger.Info("Payment method CreateOrEdit Response", result); if (result != null) { if (result.Success) { resultReturn = result.Success; } else { msg = result.Message; //msg = Commons.ErrorMsg; NSLog.Logger.Info("Payment method CreateOrEdit Error", result.Message); } } } catch (Exception e) { NSLog.Logger.Error("Payment method CreateOrEdit Error", e); } return(resultReturn); }
//public ActionResult AddSubPayment(int currentOffset) public ActionResult AddSubPayment(PaymentMethodModels PaymentMethodDTO) { PaymentMethodModels group = new PaymentMethodModels(); group.OffSet = PaymentMethodDTO.OffSet; group.Name = PaymentMethodDTO.Name; group.NumberOfCopies = PaymentMethodDTO.NumberOfCopies; group.FixedAmount = PaymentMethodDTO.FixedAmount; group.GLAccountCode = PaymentMethodDTO.GLAccountCode; group.Sequence = PaymentMethodDTO.Sequence; group.IsGiveBackChange = PaymentMethodDTO.IsGiveBackChange; group.IsAllowKickDrawer = PaymentMethodDTO.IsAllowKickDrawer; group.IsIncludeOnSale = PaymentMethodDTO.IsIncludeOnSale; group.IsShowOnPos = PaymentMethodDTO.IsShowOnPos; if (!string.IsNullOrEmpty(PaymentMethodDTO.StoreID)) { var InfoStore = CurrentUser.listStore.Where(o => o.ID.Equals(PaymentMethodDTO.StoreID)).FirstOrDefault(); if (InfoStore != null) { var InfoXero = InfoStore.ThirdParty; if (InfoXero != null) { if (!string.IsNullOrEmpty(InfoXero.ApiURL)) { var data = _facXero.GetListXeroSetting(InfoXero.IPAddress, InfoXero.ThirdPartyID, InfoXero.ApiURL, null); if (data != null) { data = data.Select(o => new XeroDTO { AccountID = o.AccountID, Name = o.Name, Code = o.Code, ReportingCodeName = o.ReportingCodeName, NameDisplayCombobox = o.Code + "-" + o.Name, }).OrderBy(o => o.ReportingCodeName).ToList(); //data.ForEach(o => //{ // o.ReportingCodeName = !string.IsNullOrEmpty(o.ReportingCodeName) ? (o.ReportingCodeName.Length < 11 ? o.ReportingCodeName : o.ReportingCodeName.Substring(0, 11) + "...") : ""; // o.NameDisplayCombobox = !string.IsNullOrEmpty(o.NameDisplayCombobox) ? (o.NameDisplayCombobox.Length < 11 ? o.NameDisplayCombobox : o.NameDisplayCombobox.Substring(0, 11) + "...") : ""; //}); data = data.OrderBy(o => o.ReportingCodeName).ToList(); ViewBag.ListAccountXero = data; //ViewBag.ListAccountXero = new SelectList(data, "Code", "NameDisplayCombobox", "ReportingCodeName", 1); } } } } } return(PartialView("_SubPayment", group)); }
public ActionResult Import(PaymentMethodModels model) { try { if (model.ListStores == null) { ModelState.AddModelError("ListStores", CurrentUser.GetLanguageTextFromKey("Please choose store")); return(View(model)); } if (model.ExcelUpload == null || model.ExcelUpload.ContentLength <= 0) { ModelState.AddModelError("ExcelUpload", CurrentUser.GetLanguageTextFromKey("Excel filename cannot be null")); return(View(model)); } ImportModel importModel = new ImportModel(); string msg = ""; StatusResponse response = _factory.Import(model.ExcelUpload, model.ListStores, ref importModel, ref msg); if (!response.Status) { ModelState.AddModelError("", response.MsgError); return(View(model)); } // Delete File Excel and File Zip Image CommonHelper.DeleteFileFromServer(CommonHelper.GetFilePath(model.ExcelUpload)); //if (!ModelState.IsValid) // return View(model); if (msg.Equals("")) { return(View("ImportDetail", importModel)); } else { _logger.Error("PaymentMethod_Import: " + msg); ModelState.AddModelError("ExcelUpload", msg); return(View(model)); } } catch (Exception e) { _logger.Error("PaymentMethod_Import: " + e); //return new HttpStatusCodeResult(400, e.Message); ModelState.AddModelError("ExcelUpload", CurrentUser.GetLanguageTextFromKey("Import file have error.")); return(View(model)); } }
public PartialViewResult Edit(string id, string StoreID) { PaymentMethodModels model = GetDetail(id, StoreID); if (!string.IsNullOrEmpty(model.StoreID)) { var InfoStore = CurrentUser.listStore.Where(o => o.ID.Equals(model.StoreID)).FirstOrDefault(); if (InfoStore != null) { var InfoXero = InfoStore.ThirdParty; if (InfoXero != null) { if (!string.IsNullOrEmpty(InfoXero.ApiURL)) { var data = _facXero.GetListXeroSetting(InfoXero.IPAddress, InfoXero.ThirdPartyID, InfoXero.ApiURL, null); if (data != null) { data = data.Select(o => new XeroDTO { AccountID = o.AccountID, Name = o.Name, Code = o.Code, ReportingCodeName = o.ReportingCodeName, NameDisplayCombobox = o.Code + "-" + o.Name, }).OrderBy(o => o.ReportingCodeName).ToList(); //if ((model.Name.ToLower().Equals("cash") || model.Code == (byte)Commons.EPaymentCode.Cash || model.Name.ToLower().Equals("gift card") || model.Code == (byte)Commons.EPaymentCode.GiftCard)) //{ //} //else //{ // data.ForEach(o => // { // o.ReportingCodeName = !string.IsNullOrEmpty(o.ReportingCodeName) ? (o.ReportingCodeName.Length < 11 ? o.ReportingCodeName : o.ReportingCodeName.Substring(0, 11) + "...") : ""; // o.NameDisplayCombobox = !string.IsNullOrEmpty(o.NameDisplayCombobox) ? (o.NameDisplayCombobox.Length < 11 ? o.NameDisplayCombobox : o.NameDisplayCombobox.Substring(0, 11) + "...") : ""; // }); //} data = data.OrderBy(o => o.ReportingCodeName).ToList(); ViewBag.ListAccountXero = data; //ViewBag.ListAccountXero = new SelectList(data, "Code", "NameDisplayCombobox", "ReportingCodeName", 1); } } } } } return(PartialView("_Edit", model)); }
public ActionResult Export(PaymentMethodModels model) { try { if (model.ListStores == null) { ModelState.AddModelError("ListStores", CurrentUser.GetLanguageTextFromKey("Please choose store.")); return(View(model)); } XLWorkbook wb = new XLWorkbook(); var ws = wb.Worksheets.Add("Sheet1"); StatusResponse response = _factory.Export(ref ws, model.ListStores); if (!response.Status) { ModelState.AddModelError("", response.MsgError); return(View(model)); } ViewBag.wb = wb; Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.Charset = System.Text.UTF8Encoding.UTF8.WebName; Response.ContentEncoding = System.Text.UTF8Encoding.UTF8; Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AddHeader("content-disposition", String.Format(@"attachment;filename={0}.xlsx", CommonHelper.GetExportFileName("PaymentMethod").Replace(" ", "_"))); using (var memoryStream = new System.IO.MemoryStream()) { wb.SaveAs(memoryStream); memoryStream.WriteTo(HttpContext.Response.OutputStream); memoryStream.Close(); } HttpContext.Response.End(); return(RedirectToAction("Export")); } catch (Exception e) { _logger.Error("PaymentMethod_Export: " + e); //return new HttpStatusCodeResult(400, e.Message); ModelState.AddModelError("ListStores", CurrentUser.GetLanguageTextFromKey("Import file have error.")); return(View(model)); } }
public PaymentMethodModels GetDetail(string id, string StoreID) { try { PaymentMethodModels model = _factory.GetListPaymentMethod(StoreID, id)[0]; if (model.ListChild != null) { for (int i = 0; i < model.ListChild.Count; i++) { model.ListChild[i].OffSet = i; } } return(model); } catch (Exception ex) { _logger.Error("PaymentMethod_Detail: " + ex); return(null); } }
public PaymentMethodModels GetDetail(string Id) { var model = new PaymentMethodModels(); try { model = _factory.GetData().Where(x => x.ID == Id).FirstOrDefault(); if (model.ListChild != null) { for (int i = 0; i < model.ListChild.Count; i++) { var item = model.ListChild[i]; item.OffSet = i; } } } catch (Exception ex) { NSLog.Logger.Error("GetDetail", ex); } return(model); }
public ActionResult Delete(PaymentMethodModels model) { try { string msg = ""; var result = _factory.DeletePaymentMethod(model.ID, model.StoreID, ref msg); if (!result) { //ModelState.AddModelError("Name", "Have a error when you delete a Category"); ModelState.AddModelError("Name", msg); Response.StatusCode = (int)HttpStatusCode.BadRequest; return(PartialView("_Delete", model)); } return(new HttpStatusCodeResult(HttpStatusCode.OK)); } catch (Exception ex) { _logger.Error("PaymentMethod_Delete: " + ex); ModelState.AddModelError("Name", CurrentUser.GetLanguageTextFromKey("Have an error when you delete a Payment Method")); Response.StatusCode = (int)HttpStatusCode.BadRequest; return(PartialView("_Delete", model)); } }
// IMPORT public StatusResponse Import(HttpPostedFileBase excelFile, List <string> lstStore, ref ImportModel importModel, ref string msg) { StatusResponse Response = new StatusResponse(); DataTable dt = new DataTable(); FileInfo[] lstFileImg = new FileInfo[] { }; Response = ProcessDataImport(ref dt, excelFile, "SBSettingPayment.xlsx", out lstFileImg); if (!Response.Status) { msg = Response.MsgError; return(Response); } List <PaymentMethodModels> listData = new List <PaymentMethodModels>(); ImportItem itemErr = null; bool flagInsert = true; string msgError = ""; foreach (var item in lstStore) { foreach (DataRow row in dt.Rows) { try { flagInsert = true; msgError = ""; string rowText = ""; for (int i = 0; i < dt.Columns.Count; i++) { rowText += row[i].ToString().Trim(); } if (string.IsNullOrEmpty(rowText)) { continue; } PaymentMethodModels model = new PaymentMethodModels(); model.Index = row[0].ToString(); // 1 - Payment Method Name model.Name = row[1].ToString().Trim().Replace(" ", " "); // 2 - Parent Method Name model.ParentName = row[2].ToString().Trim().Replace(" ", " "); // 3 - IsActive model.IsActive = GetBoolValue(dt.Columns[3].ColumnName.Replace("#", "."), row[0].ToString(), row[3].ToString()); // 4 - Confirmation Code string IsHasConfirmCode = row[4].ToString().Equals("") ? _AttributeForLanguage.CurrentUser.GetLanguageTextFromKey("no") : row[4].ToString(); model.IsHasConfirmCode = GetBoolValue(dt.Columns[4].ColumnName.Replace("#", "."), row[0].ToString(), IsHasConfirmCode); // 5 - NumberOfCopies int NumberOfCopies = 0; int.TryParse(row[5].ToString(), out NumberOfCopies); model.NumberOfCopies = NumberOfCopies; //6 - double FixedAmount = 0; double.TryParse(row[6].ToString(), out FixedAmount); model.FixedAmount = FixedAmount; // 7 - Confirmation Code string IsGiveBackChange = row[7].ToString().Equals("") ? _AttributeForLanguage.CurrentUser.GetLanguageTextFromKey("no") : row[7].ToString(); model.IsGiveBackChange = GetBoolValue(dt.Columns[7].ColumnName.Replace("#", "."), row[0].ToString(), IsGiveBackChange); // 8 - Confirmation Code string IsAllowKickDrawer = row[8].ToString().Equals("") ? _AttributeForLanguage.CurrentUser.GetLanguageTextFromKey("no") : row[8].ToString(); model.IsAllowKickDrawer = GetBoolValue(dt.Columns[8].ColumnName.Replace("#", "."), row[0].ToString(), IsAllowKickDrawer); // 9 - Confirmation Code string IsIncludeOnSale = row[9].ToString().Equals("") ? _AttributeForLanguage.CurrentUser.GetLanguageTextFromKey("no") : row[9].ToString(); model.IsIncludeOnSale = GetBoolValue(dt.Columns[9].ColumnName.Replace("#", "."), row[0].ToString(), IsIncludeOnSale); // 10 - Confirmation Code string IsShowOnPos = row[10].ToString().Equals("") ? _AttributeForLanguage.CurrentUser.GetLanguageTextFromKey("no") : row[10].ToString(); model.IsShowOnPos = GetBoolValue(dt.Columns[10].ColumnName.Replace("#", "."), row[0].ToString(), IsShowOnPos); // 11 - Store model.StoreID = item; // 12 - Confirmation Code model.GLAccountCode = row[12].ToString().Trim().Replace(" ", " "); ////Insert List //if (model.ParentName.Equals("")) //Parent //{ // listData.Add(model); //} //else //Child { var parent = listData.Where(x => x.Name.Equals(model.ParentName) && x.StoreID.Equals(item)).FirstOrDefault(); if (parent != null) { if (parent.ListChild == null) { parent.ListChild = new List <PaymentMethodModels>(); } parent.ListChild.Add(new PaymentMethodModels { Name = model.Name, ParentName = model.ParentName, IsActive = model.IsActive, IsHasConfirmCode = model.IsHasConfirmCode, StoreID = item }); } } //=== if (flagInsert) { listData.Add(model); } else { itemErr = new ImportItem(); itemErr.Name = model.Name; itemErr.ListFailStoreName.Add(""); itemErr.ListErrorMsg.Add(_AttributeForLanguage.CurrentUser.GetLanguageTextFromKey("Row") + ":" + model.Index + msgError); importModel.ListImport.Add(itemErr); } } catch (Exception e) { importModel.ListImport.Add(new ImportItem { Name = _AttributeForLanguage.CurrentUser.GetLanguageTextFromKey("Payment Method"), ListFailStoreName = lstStore, ListErrorMsg = new List <string> { e.Message } }); } } } Response.Status = true; //===================== //try //{ listData = listData.Where(x => string.IsNullOrEmpty(x.ParentName)).ToList(); PaymentMethodApiModels paraBody = new PaymentMethodApiModels(); paraBody.AppKey = Commons.AppKey; paraBody.AppSecret = Commons.AppSecret; paraBody.CreatedUser = Commons.CreateUser; paraBody.RegisterToken = new RegisterTokenModels(); paraBody.ListPaymentMethod = listData; //==================== var result = (ResponseApiModels)ApiResponse.Post <ResponseApiModels>(Commons.ImportPaymentMethod, null, paraBody); if (result != null) { dynamic data = result.Data; var lstC = data["ListProperty"]; var lstContent = JsonConvert.SerializeObject(lstC); var listError = JsonConvert.DeserializeObject <List <ImportResult> >(lstContent); foreach (ImportResult itemError in listError) { ImportItem item = new ImportItem(); item.Name = itemError.Property; item.ListFailStoreName.Add(itemError.StoreName); item.ListErrorMsg.Add(_AttributeForLanguage.CurrentUser.GetLanguageTextFromKey("Row") + ": " + itemError.Index + "<br/>" + _AttributeForLanguage.CurrentUser.GetLanguageTextFromKey(itemError.Error)); importModel.ListImport.Add(item); } if (importModel.ListImport.Count == 0) { ImportItem item = new ImportItem(); item.Name = _AttributeForLanguage.CurrentUser.GetLanguageTextFromKey("Payment Method"); item.ListSuccessStoreName.Add(_AttributeForLanguage.CurrentUser.GetLanguageTextFromKey("Import Payment Method Successful")); importModel.ListImport.Add(item); } } return(Response); }
public ActionResult Create(PaymentMethodModels model) { try { if (model.ListChild != null) { model.ListChild = model.ListChild.Where(x => x.Status != (byte)Commons.EStatus.Deleted).ToList(); if (model.ListChild.Count <= 0 && model.Code == 0) { ModelState.AddModelError("ErrorSubPayment", "Payment Method must have as least or equal to one Sub Payment Method"); } } else { var ischeck = model.ListChild.GroupBy(o => o.Name).Any(g => g.Count() > 1); if (ischeck) { ModelState.AddModelError("errorCardName", "This name is duplicated to an existed payment method. Please try again"); } } if (!ModelState.IsValid) { Response.StatusCode = (int)HttpStatusCode.BadRequest; return(View("Create", model)); } byte[] photoByte = null; /*** Processing Image *****/ if (model.PictureUpload != null && model.PictureUpload.ContentLength > 0) { Byte[] imgByte = new Byte[model.PictureUpload.ContentLength]; model.PictureUpload.InputStream.Read(imgByte, 0, model.PictureUpload.ContentLength); model.PictureByte = imgByte; model.ImageURL = Guid.NewGuid() + Path.GetExtension(model.PictureUpload.FileName); model.PictureUpload = null; photoByte = imgByte; //Save Image on Server var originalDirectory = new DirectoryInfo(string.Format("{0}Uploads\\", Server.MapPath(@"\"))); var path = string.Format("{0}{1}", originalDirectory, model.ImageURL); MemoryStream ms = new MemoryStream(photoByte, 0, photoByte.Length); ms.Write(photoByte, 0, photoByte.Length); System.Drawing.Image imageTmp = System.Drawing.Image.FromStream(ms, true); ImageHelper.Me.SaveCroppedImage(imageTmp, path, model.ImageURL, ref photoByte); model.PictureByte = photoByte; FTP.Upload(model.ImageURL, model.PictureByte); ImageHelper.Me.TryDeleteImageUpdated(path); } /*** Processing Image ListChild *****/ if (model.ListChild != null && model.ListChild.Count > 0) { for (int i = 0; i < model.ListChild.Count; i++) { if (model.ListChild[i].PictureUpload != null && model.ListChild[i].PictureUpload.ContentLength > 0) { Byte[] imgByte = new Byte[model.ListChild[i].PictureUpload.ContentLength]; model.ListChild[i].PictureUpload.InputStream.Read(imgByte, 0, model.ListChild[i].PictureUpload.ContentLength); model.ListChild[i].PictureByte = imgByte; model.ListChild[i].ImageURL = Guid.NewGuid() + Path.GetExtension(model.ListChild[i].PictureUpload.FileName); model.ListChild[i].PictureUpload = null; photoByte = imgByte; //Save Image ListChild on Server var originalDirectory = new DirectoryInfo(string.Format("{0}Uploads\\", Server.MapPath(@"\"))); var path = string.Format("{0}{1}", originalDirectory, model.ListChild[i].ImageURL); MemoryStream ms = new MemoryStream(photoByte, 0, photoByte.Length); ms.Write(photoByte, 0, photoByte.Length); System.Drawing.Image imageTmp = System.Drawing.Image.FromStream(ms, true); ImageHelper.Me.SaveCroppedImage(imageTmp, path, model.ListChild[i].ImageURL, ref photoByte); model.ListChild[i].PictureByte = photoByte; FTP.Upload(model.ListChild[i].ImageURL, model.ListChild[i].PictureByte); ImageHelper.Me.TryDeleteImageUpdated(path); } } } string msg = ""; bool result = _factory.CreateOrEdit(model, ref msg); if (result) { return(RedirectToAction("Index")); } else { if (msg.Equals("This payment method name existed. Please try again.")) { ModelState.AddModelError("Name", msg); } else { ModelState.AddModelError("errorCardName", msg); } Response.StatusCode = (int)HttpStatusCode.BadRequest; return(View(model)); } } catch (Exception ex) { NSLog.Logger.Error("Create : ", ex); return(new HttpStatusCodeResult(400, ex.Message)); } }
public ActionResult Create() { PaymentMethodModels model = new PaymentMethodModels(); return(View(model)); }
public ActionResult Edit(PaymentMethodModels model) { try { if (string.IsNullOrEmpty(model.Name)) { ModelState.AddModelError("Name", CurrentUser.GetLanguageTextFromKey("Payment method name is required")); } if (model.ListChild != null && model.ListChild.Count > 0) { model.ListChild.ForEach(x => { if (string.IsNullOrEmpty(x.Name)) { ModelState.AddModelError("ListChild[" + x.OffSet + "].Name", CurrentUser.GetLanguageTextFromKey("Sub payment method name is required")); } }); model.ListChild = model.ListChild.Where(x => x.Status != (byte)Commons.EStatus.Deleted).ToList(); foreach (var item in model.ListChild) { if (!string.IsNullOrEmpty(item.ImageURL)) { item.ImageURL = item.ImageURL.Replace(Commons._PublicImages, "").Replace(Commons.Image100_100, ""); } if (item.PictureUpload != null && item.PictureUpload.ContentLength > 0) { Byte[] imgByte = new Byte[item.PictureUpload.ContentLength]; item.PictureUpload.InputStream.Read(imgByte, 0, item.PictureUpload.ContentLength); item.PictureByte = imgByte; item.ImageURL = Guid.NewGuid() + Path.GetExtension(item.PictureUpload.FileName); item.PictureUpload = null; item.photoByte = imgByte; } } } if (!ModelState.IsValid) { if (model.ListChild != null) { model.ListChild.ForEach(x => { if ((ModelState["PictureUpload"]) != null && (ModelState["PictureUpload"]).Errors.Count > 0) { x.ImageURL = ""; } }); } Response.StatusCode = (int)HttpStatusCode.BadRequest; if (string.IsNullOrEmpty(model.Name)) { model.Name = ""; } return(PartialView("_Edit", model)); } //==================== string msg = ""; var result = _factory.InsertOrUpdatePaymentMethod(model, ref msg); if (result) { if (model.ListChild != null) { byte[] photoByte = null; //Save Image on Server model.ListChild.ForEach(x => { if (!string.IsNullOrEmpty(x.ImageURL) && x.PictureByte != null) { var originalDirectory = new DirectoryInfo(string.Format("{0}Uploads\\", Server.MapPath(@"\"))); var path = string.Format("{0}{1}", originalDirectory, x.ImageURL); MemoryStream ms = new MemoryStream(x.photoByte, 0, x.photoByte.Length); ms.Write(x.photoByte, 0, x.photoByte.Length); System.Drawing.Image imageTmp = System.Drawing.Image.FromStream(ms, true); photoByte = x.photoByte; ImageHelper.Me.SaveCroppedImage(imageTmp, path, x.ImageURL, ref photoByte); x.PictureByte = x.photoByte; FTP.Upload(x.ImageURL, x.PictureByte); ImageHelper.Me.TryDeleteImageUpdated(path); } }); } return(RedirectToAction("Index")); } else { ModelState.AddModelError("Name", msg); Response.StatusCode = (int)HttpStatusCode.BadRequest; return(PartialView("_Edit", model)); } } catch (Exception ex) { _logger.Error("PaymentMethod_Edit: " + ex); return(new HttpStatusCodeResult(400, ex.Message)); } }
public new PartialViewResult View(string id) { PaymentMethodModels model = GetDetail(id); return(PartialView("_View", model)); }
public PartialViewResult Edit(string id) { PaymentMethodModels model = GetDetail(id); return(PartialView("_Edit", model)); }
public PartialViewResult Delete(string id, string StoreID) { PaymentMethodModels model = GetDetail(id, StoreID); return(PartialView("_Delete", model)); }
public bool InsertOrUpdatePaymentMethod(PaymentMethodModels model, ref string msg) { try { PaymentMethodApiModels paraBody = new PaymentMethodApiModels(); paraBody.AppKey = Commons.AppKey; paraBody.AppSecret = Commons.AppSecret; paraBody.CreatedUser = Commons.CreateUser; paraBody.RegisterToken = new RegisterTokenModels(); //======= PaymentMethodModels PayMethodDTO = new PaymentMethodModels { ID = model.ID, Name = model.Name, ParentName = model.ParentName, IsActive = model.IsActive, IsHasConfirmCode = model.IsHasConfirmCode, StoreID = model.StoreID, StoreName = model.StoreName, Code = model.Code, NumberOfCopies = model.NumberOfCopies, FixedAmount = model.FixedAmount, Sequence = model.Sequence, IsGiveBackChange = model.IsGiveBackChange, IsAllowKickDrawer = model.IsAllowKickDrawer, IsIncludeOnSale = model.IsIncludeOnSale, IsShowOnPos = model.IsShowOnPos, ListChild = model.ListChild, GLAccountCode = model.GLAccountCode }; paraBody.PayMethodDTO = PayMethodDTO; paraBody.ID = model.ID; paraBody.StoreID = model.StoreID; //==================== var result = (ResponseApiModels)ApiResponse.Post <ResponseApiModels>(Commons.CreateOrEditPaymentMethod, null, paraBody); if (result != null) { if (result.Success) { return(true); } else { msg = result.Message; msg = _AttributeForLanguage.CurrentUser.GetLanguageTextFromKey(msg); _logger.Error(result.Message); return(false); } } else { msg = result.ToString(); _logger.Error(result); return(false); } } catch (Exception e) { _logger.Error("PaymentMethod_InsertOrUpdate: " + e); msg = e.ToString(); return(false); } }