public bool InsertOrUpdateGeneraInvoice(GeneralSettingModels model) { try { GeneralSettingApiModels paraBody = new GeneralSettingApiModels(); paraBody.AppKey = Commons.AppKey; paraBody.AppSecret = Commons.AppSecret; paraBody.CreatedUser = Commons.CreateUser; paraBody.RegisterToken = new RegisterTokenModels(); if (model.ListInvoice[0].Setting != null) { paraBody.Setting = model.ListInvoice[0].Setting; } paraBody.ID = model.InvoiceID; paraBody.StoreID = model.StoreID; if (model.InvoiceID == "0") { paraBody.ID = null; paraBody.Mode = (int)Commons.EStatus.Deleted; } else { paraBody.Mode = (int)Commons.EStatus.Actived; } NSLog.Logger.Info("InsertOrUpdateGeneraInvoice request", paraBody); //==================== var result = (ResponseApiModels)ApiResponse.Post <ResponseApiModels>(Commons.SettingOtherPrintSettingSave, null, paraBody); NSLog.Logger.Info("InsertOrUpdateGeneraInvoice result", result); if (result != null) { if (result.Success) { return(true); } else { NSLog.Logger.Info("InsertOrUpdateGeneraInvoice fail", result); //_logger.Error(result.Message); return(false); } } else { NSLog.Logger.Info("InsertOrUpdateGeneraInvoice error", result); return(false); } } catch (Exception e) { NSLog.Logger.Error("InsertOrUpdateGeneraInvoice ex", e); return(false); } }
public bool InsertOrUpdateGeneralSetting(GeneralSettingModels model) { try { GeneralSettingApiModels paraBody = new GeneralSettingApiModels(); paraBody.AppKey = Commons.AppKey; paraBody.AppSecret = Commons.AppSecret; paraBody.CreatedUser = Commons.CreateUser; paraBody.RegisterToken = new RegisterTokenModels(); paraBody.ID = model.ID; paraBody.StoreID = model.StoreID; paraBody.ListSettings = model.ListSettings; paraBody.Mode = 1; //==================== var result = (ResponseApiModels)ApiResponse.Post <ResponseApiModels>(Commons.SaveGeneralSetting, null, paraBody); if (result != null) { if (result.Success) { return(true); } else { NSLog.Logger.Info("InsertOrUpdate_Setting", result); return(false); } } else { NSLog.Logger.Info("InsertOrUpdate_Setting", result); return(false); } } catch (Exception e) { NSLog.Logger.Error("GeneralSetting_InsertOrUpdate: ", e); return(false); } }
public GeneralSettingModels GetInvoicePrintSetting(string StoreID = null, string ID = null) { GeneralSettingModels resultData = new GeneralSettingModels(); try { GeneralSettingApiModels paraBody = new GeneralSettingApiModels(); paraBody.AppKey = Commons.AppKey; paraBody.AppSecret = Commons.AppSecret; paraBody.CreatedUser = Commons.CreateUser; paraBody.StoreID = StoreID; paraBody.ID = ID; paraBody.Mode = 1; var result = (ResponseApiModels)ApiResponse.Post <ResponseApiModels>(Commons.SettingGetOtherPrintSetting, null, paraBody); if (result.Success) { dynamic data = result.Data; var lst = data["ListInvoice"]; var lstContent = JsonConvert.SerializeObject(lst /*result.RawData*/); resultData.ListInvoice = JsonConvert.DeserializeObject <List <InvoiceDTO> >(lstContent); } else { resultData.MessageInvoice = result.Message; } return(resultData); } catch (Exception e) { NSLog.Logger.Error("DeliverySetting_GetList: ", e); return(resultData); } }
public ActionResult Edit(LocationModels model) { try { if (string.IsNullOrEmpty(model.StoreID)) { ModelState.AddModelError("StoreID", CurrentUser.GetLanguageTextFromKey("Please choose store")); } if (string.IsNullOrEmpty(model.Region)) { ModelState.AddModelError("Region", CurrentUser.GetLanguageTextFromKey("Please choose region")); } List <SettingDTO> ListSettings = new List <SettingDTO>(); ListSettings.Add(new SettingDTO { SettingId = Commons.ESetting.Region.ToString("d"), Value = model.Region.ToString() }); // Malaysia, there are some settings: if (model.Region.ToLower().Equals("my")) { ListSettings.Add(new SettingDTO { SettingId = Commons.ESetting.PrintRoundingAmount.ToString("d"), Value = model.IsPrintRoundingAmount.ToString().ToLower() }); ListSettings.Add(new SettingDTO { SettingId = Commons.ESetting.PrintTaxCode.ToString("d"), Value = model.IsPrintTaxCode.ToString().ToLower() }); ListSettings.Add(new SettingDTO { SettingId = Commons.ESetting.PrintSummaryTax.ToString("d"), Value = model.IsPrintSummaryTax.ToString().ToLower() }); ListSettings.Add(new SettingDTO { SettingId = Commons.ESetting.PrintCustomerClaimTax.ToString("d"), Value = model.IsPrintCustomerClaimTax.ToString().ToLower() }); } //============== GeneralSettingModels objSetting = new GeneralSettingModels(); objSetting.ListSettings = ListSettings; if (!ModelState.IsValid) { Response.StatusCode = (int)HttpStatusCode.BadRequest; return(PartialView("_Edit", model)); } //==================== objSetting.StoreID = model.StoreID; var result = _Genfactory.InsertOrUpdateGeneralSetting(objSetting); if (result) { return(RedirectToAction("Index")); } else { return(PartialView("_Edit", model)); } } catch (Exception ex) { _logger.Error("Location_Edit: " + ex); return(new HttpStatusCodeResult(400, ex.Message)); } }