public ActionResult Create() { var menuId = Convert.ToInt32(RouteData.Values["menuId"].ToString()); var userId = Convert.ToInt32(Session["UserID"]); var userPrev = UniqueCode.MenuPermission(menuId, userId); ViewBag.UserViewPrivilige = userPrev.EnableView; try { var cpv = new ViewModelVoucherMaster(); ViewBag.VoucherNo = TempData["VoucherNo"]; ViewBag.Company = Convert.ToInt32(TempData["Company"]); ViewBag.VoucherDate = TempData["VoucherDate"]; return(View(cpv)); } catch (Exception ex) { return(JavaScript(string.Format("UYResult('{0}','{1}')", ex.Message, "failure"))); } }
protected void btnShow_Click(object sender, EventArgs e) { try { if (dpStartdate.Value != "" && dpEnddate.Value != "" && (hdnAcCode.Value != "" || chkAll.Checked) && ddlLevel.Value != "") { var ledgerValue = hdnAcCode.Value; if (chkAll.Checked) { ledgerValue = "All"; } ReportViewer1.Report = new TrialBalanceAllLevel(); (ReportViewer1.Report as TrialBalanceAllLevel).pvparam = Convert.ToInt32(Session["CompanyId"].ToString()); (ReportViewer1.Report as TrialBalanceAllLevel).pvparam1 = UniqueCode.GetDateFormat_MM_dd_yyy(dpStartdate.Value); (ReportViewer1.Report as TrialBalanceAllLevel).pvparam2 = UniqueCode.GetDateFormat_MM_dd_yyy(dpEnddate.Value); (ReportViewer1.Report as TrialBalanceAllLevel).pvparam3 = ledgerValue; (ReportViewer1.Report as TrialBalanceAllLevel).pvparam4 = ddlLevel.Value; ReportViewer1.RefreshReport(); Page.ClientScript.RegisterStartupScript(this.GetType(), "myScript", "BindAccountCode();", true); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "myScript", "WarningMessage();", true); } } catch (Exception ex) { throw ex; } }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var menuId = Convert.ToInt32(RouteData.Values["menuId"].ToString()); var userId = Convert.ToInt32(Session["UserID"]); var userPrev = UniqueCode.MenuPermission(menuId, userId); ViewBag.UserViewPrivilige = userPrev.EnableView; ViewBag.UserAddPrivilige = userPrev.EnableInsert; try { var voucher = new ViewModelVoucherMaster(); voucher = voucher.GetVoucherById(Convert.ToInt32(id), (int)EmVoucherType.BankVoucher); if (voucher == null) { return(HttpNotFound()); } return(View(voucher)); } catch (Exception ex) { return(JavaScript(string.Format("UYResult('{0}','{1}')", ex.Message, "failure"))); } }
//Private #region # 验证服务器机器 —— void AuthenticateMachine() /// <summary> /// 验证服务器机器 /// </summary> private void AuthenticateMachine() { bool authenticateMachine = true; #if DEBUG authenticateMachine = false; #endif if (authenticateMachine) { License?license = LicenseReader.GetLicense(); if (license == null) { throw new NoPermissionException("未找到许可证,请联系系统管理员!"); } string uniqueCode = UniqueCode.Compute(); bool equal = string.Equals(license.Value.UniqueCode, uniqueCode, StringComparison.CurrentCultureIgnoreCase); if (!equal) { throw new NoPermissionException("许可证授权与本机不匹配,请联系系统管理员!"); } if (DateTime.Today > license.Value.LicenseExpiredDate) { throw new NoPermissionException("许可证授权已过期,请联系系统管理员!"); } } }
public ViewModelVoucherMaster GetVoucherById(int id, int type) { ViewModelVoucherMaster voucherMaster = null; using (var _db = new ERP_Entities()) { voucherMaster = (from vm in _db.AccVoucherMasters.Include(vd => vd.AccVoucherDetails) where vm.VoucherTypeId == type && vm.Id == id && vm.IsActive == true select new { Id = vm.Id, VoucherNo = vm.VoucherNo, VoucherDate = vm.VoucherDate, CompanyId = vm.CompanyId, Narration = vm.Narration, PaymentTo = vm.PaymentTo, VoucherDetails = vm.AccVoucherDetails }).ToList().Select(x => new ViewModelVoucherMaster() { Id = x.Id, VoucherNo = x.VoucherNo, VoucherDate = x.VoucherDate, VoucherDateStr = UniqueCode.GetDateFormat_dd_mm_yyyy(x.VoucherDate), CompanyId = x.CompanyId, Narration = x.Narration, PaymentTo = x.PaymentTo, TotalCreditAmount = UniqueCode.sumCredit(x.Id), TotalDebitAmount = UniqueCode.sumDebit(x.Id), VoucherDetails = UniqueCode.GetVoucherDetailsByMasterId(x.Id) }).SingleOrDefault(); } return(voucherMaster); }
public ActionResult Create(ViewModelAC2 vmAC2) { try { var aC2 = vmAC2.viewModelEntity(); var autoNumber = UniqueCode.GetAutoNumber("AC2"); aC2.Id = Convert.ToInt32(autoNumber); aC2.AC2ManualCode = UniqueCode.GetAccountLedgerCode("AL2", autoNumber); aC2.IsActive = true; aC2.Transfered = false; aC2.DateAdded = DateTime.Now; aC2.AddedBy = Convert.ToInt32(Session["UserID"]); aC2.DateUpdated = DateTime.Now; aC2.UpdatedBy = Convert.ToInt32(Session["UserID"]); if (ModelState.IsValid) { _db.AccAC2.Add(aC2); _db.SaveChanges(); } //ModelState.Clear(); return(JavaScript(string.Format("UYResult('{0}','{1}','{2}','{3}')", "Data saved successfully.", "success", "redirect", Url.Content("~/Accounting/AC2/Create")))); } catch (Exception ex) { return(JavaScript(string.Format("UYResult('{0}','{1}')", ex.Message, "failure"))); } }
protected void btnShow_Click(object sender, EventArgs e) { try { if (dpStartdate.Value != "" && dpEnddate.Value != "" && ddlAccountCode.Value != "") { ReportViewer1.Report = new LedgerBook(); (ReportViewer1.Report as LedgerBook).pvparam = UniqueCode.GetDateFormat_MM_dd_yyy(dpStartdate.Value); (ReportViewer1.Report as LedgerBook).pvparam1 = UniqueCode.GetDateFormat_MM_dd_yyy(dpEnddate.Value); (ReportViewer1.Report as LedgerBook).pvparam2 = ddlAccountCode.Value; (ReportViewer1.Report as LedgerBook).companyId = Convert.ToInt32(Session["CompanyID"].ToString()); ReportViewer1.RefreshReport(); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "myScript", "WarningMessage();", true); } } catch (Exception ex) { throw ex; } }
public ActionResult Index() { var menuId = Convert.ToInt32(RouteData.Values["menuId"].ToString()); var userId = Convert.ToInt32(Session["UserID"]); var userPrev = UniqueCode.MenuPermission(menuId, userId); ViewBag.UserAddPrivilige = userPrev.EnableInsert; ViewBag.UserEditPrivilige = userPrev.EnableUpdate; try { var ac3List = (from ac3 in _db.AccAC3 join ac1 in _db.AccAC1 on ac3.AC1Id equals ac1.Id join ac2 in _db.AccAC2 on ac3.AC2Id equals ac2.Id select new ViewModelAC3 { Id = ac3.Id, AC3Name = ac3.AC3Name, AC3ManualCode = ac3.AC3ManualCode, AC1Name = ac1.AC1Name, AC2Name = ac2.AC2Name } ).ToList(); return(View(ac3List)); } catch (Exception ex) { return(JavaScript(string.Format("UYResult('{0}','{1}')", ex.Message, "failure"))); } }
public ActionResult Create() { var menuId = Convert.ToInt32(RouteData.Values["menuId"].ToString()); var userId = Convert.ToInt32(Session["UserID"]); var userPrev = UniqueCode.MenuPermission(menuId, userId); ViewBag.UserViewPrivilige = userPrev.EnableView; var autoNumber = UniqueCode.GetAutoNumber("AC2"); ViewBag.Code = UniqueCode.GetAccountLedgerCode("AL2", autoNumber); try { return(View()); } catch (Exception ex) { return(JavaScript(string.Format("UYResult('{0}','{1}')", ex.Message, "failure"))); } }
protected void btnShow_Click(object sender, EventArgs e) { try { if (dpStartdate.Value != "" && dpEnddate.Value != "" && ddlCompanyName.SelectedValue != "") { ReportViewer1.Report = new ContraStatReport(); (ReportViewer1.Report as ContraStatReport).pvparam = UniqueCode.GetDateFormat_MM_dd_yyy(dpStartdate.Value); (ReportViewer1.Report as ContraStatReport).pvparam1 = UniqueCode.GetDateFormat_MM_dd_yyy(dpEnddate.Value); if (ddlAccountCode.Value == "" || ddlAccountCode.Value == String.Empty) { (ReportViewer1.Report as ContraStatReport).pvparam2 = null; } else { (ReportViewer1.Report as ContraStatReport).pvparam2 = ddlAccountCode.Value; } (ReportViewer1.Report as ContraStatReport).pvparam4 = ddlCompanyName.SelectedValue; ReportViewer1.RefreshReport(); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "myScript", "WarningMessage();", true); } } catch (Exception ex) { throw ex; } }
private ServiceProvider RegisterServices() { IServiceCollection services = new ServiceCollection(); var iConfig = GetIConfigurationBase(); services.AddSingleton <IConfiguration>(iConfig); services.AddSingleton <IEncryptionService, EncryptionService>(); services.AddSingleton <ICustomerService, CustomerService>(); UniqueCode uniqueCode = new UniqueCode(); // services.AddSingleton<KeyInfo>( new KeyInfo(uniqueCode.Key, "mEsWQgKRUBtkyFJzZZQGlw==")); services.AddSingleton <KeyInfo>(new KeyInfo(uniqueCode.Key, "mEsWQgKRUBtkyFJzZZQGlw==")); services.AddDataProtection(); //services.AddDataProtection() // .UseCryptographicAlgorithms(new AuthenticatedEncryptorConfiguration // { // EncryptionAlgorithm = EncryptionAlgorithm.AES_256_GCM, // ValidationAlgorithm = ValidationAlgorithm.HMACSHA512 // }); return(services.BuildServiceProvider()); }
public ActionResult Edit(int?id) { var menuId = Convert.ToInt32(RouteData.Values["menuId"].ToString()); var userId = Convert.ToInt32(Session["UserID"]); var userPrev = UniqueCode.MenuPermission(menuId, userId); ViewBag.UserViewPrivilige = userPrev.EnableView; ViewBag.UserAddPrivilige = userPrev.EnableInsert; if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } try { AccCostCenterInfo costCenter = db.AccCostCenterInfoes.Find(id); if (costCenter == null) { return(HttpNotFound()); } return(View(costCenter)); } catch (Exception ex) { return(JavaScript(string.Format("UYResult('{0}','{1}')", ex.Message, "failure"))); } }
protected void btnShowReport_Click(object sender, EventArgs e) { //if (ddlHDONo.SelectedValue != "0") //{ // ReportViewer1.Report = new rpt_HDOMasterDetail(); // (ReportViewer1.Report as rpt_HDOMasterDetail).pramHDONo = ddlHDONo.SelectedValue.ToString();// "PI-00000155-Revise-2"; // ReportViewer1.RefreshReport(); //} //else //{ // Page.ClientScript.RegisterStartupScript(this.GetType(), "myScript", "WarningMessage();", true); // ReportViewer1.Report = new rpt_HDOMasterDetail(); // //(ReportViewer1.Report as rpt_HDOMasterDetail).pramHDONo = ddlHDONo.SelectedValue.ToString();// "PI-00000155-Revise-2"; // ReportViewer1.RefreshReport(); //} if (txtStartDate.Text != "" && txtEndDate.Text != "" && ddlCompany.SelectedValue != "") { ReportViewer1.Report = new rptHDOSummary(); (ReportViewer1.Report as rptHDOSummary).StartDate = UniqueCode.GetDateFormat_MM_dd_yyy(txtStartDate.Text); (ReportViewer1.Report as rptHDOSummary).EndDate = UniqueCode.GetDateFormat_MM_dd_yyy(txtEndDate.Text); (ReportViewer1.Report as rptHDOSummary).CreateBy = Convert.ToInt16(Session["UserID"]); (ReportViewer1.Report as rptHDOSummary).CompanyID = Convert.ToInt16(ddlCompany.SelectedValue); ReportViewer1.RefreshReport(); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "myScript", "WarningMessage();", true); } }
public void AddUniqueCode(int userId) { UniqueCode newCode = new UniqueCode(); newCode.UserID = userId; newCode.ActivationCode = RandomString(6); _db.UniqueCodes.Add(newCode); _db.SaveChanges(); }
public override int GetHashCode() { unchecked { var hashCode = NationId.GetHashCode(); hashCode = (hashCode * 397) ^ RulerName.GetHashCode(); hashCode = (hashCode * 397) ^ UniqueCode.GetHashCode(); return(hashCode); } }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var menuId = Convert.ToInt32(RouteData.Values["menuId"].ToString()); var userId = Convert.ToInt32(Session["UserID"]); var userPrev = UniqueCode.MenuPermission(menuId, userId); ViewBag.UserViewPrivilige = userPrev.EnableView; ViewBag.UserAddPrivilige = userPrev.EnableInsert; try { var ac5List = (from ac5 in _db.AccACDetails join ac1 in _db.AccAC1 on ac5.AC1Id equals ac1.Id join ac2 in _db.AccAC2 on ac5.AC2Id equals ac2.Id join ac3 in _db.AccAC3 on ac5.AC3Id equals ac3.Id join ac4 in _db.AccAC4 on ac5.AC4Id equals ac4.Id where ac5.Id == id select new ViewModelAC5 { Id = ac5.Id, AC1Id = ac5.AC1Id, AC2Id = ac5.AC2Id, AC3Id = ac5.AC3Id, AC4Id = ac5.AC4Id, ACName = ac5.ACName, ACode = ac5.ACode, AC4Name = ac4.AC4Name, AC3Name = ac3.AC3Name, AC1Name = ac1.AC1Name, AC2Name = ac2.AC2Name } ).SingleOrDefault(); if (ac5List == null) { return(HttpNotFound()); } return(View(ac5List)); } catch (Exception ex) { return(JavaScript(string.Format("UYResult('{0}','{1}')", ex.Message, "failure"))); } }
protected void btnShowReport_Click(object sender, EventArgs e) { if (txtStartDate.Text != "" && txtEndDate.Text != "" && ddlCompany.SelectedValue != "") { ReportViewer1.Report = new rptFabricDeliveryStatement(); (ReportViewer1.Report as rptFabricDeliveryStatement).StartDate = UniqueCode.GetDateFormat_MM_dd_yyy(txtStartDate.Text); (ReportViewer1.Report as rptFabricDeliveryStatement).EndDate = UniqueCode.GetDateFormat_MM_dd_yyy(txtEndDate.Text); (ReportViewer1.Report as rptFabricDeliveryStatement).CompanyID = Convert.ToInt16(ddlCompany.SelectedValue); ReportViewer1.RefreshReport(); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "myScript", "WarningMessage();", true); } }
protected void btnShow_Click(object sender, EventArgs e) { try { string accountHead = ""; if (chkAll.Checked) { accountHead = "All"; } if (dpStartdate.Value != "" && dpEnddate.Value != "" && ddlCompanyName.SelectedValue != "") { ReportViewer1.Report = new TrialBalanveLevel15(); (ReportViewer1.Report as TrialBalanveLevel15).pvparam = ddlCompanyName.SelectedValue; (ReportViewer1.Report as TrialBalanveLevel15).pvparam1 = UniqueCode.GetDateFormat_MM_dd_yyy(dpStartdate.Value); (ReportViewer1.Report as TrialBalanveLevel15).pvparam2 = UniqueCode.GetDateFormat_MM_dd_yyy(dpEnddate.Value); if (ddlAccountCode.Value == "" || ddlAccountCode.Value == String.Empty) { (ReportViewer1.Report as TrialBalanveLevel15).pvparam3 = "All"; } else { (ReportViewer1.Report as TrialBalanveLevel15).pvparam3 = ddlAccountCode.Value; } ReportViewer1.RefreshReport(); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "myScript", "WarningMessage();", true); } } catch (Exception ex) { throw ex; } }
public NDbResult <UniqueCode> IncreaseUniqueId([FromBody] string value) { NDbResult <UniqueCode> result; if (string.IsNullOrWhiteSpace(value)) { result = new NDbResult <UniqueCode>(); result.ParameterIsNull(); } else { result = UniqueCode.IncreaseUniqueId(value); } return(result); }
public AccAC3 MakeAc3(int userId) { var aC3 = AC3Entity(); var autoNumber = UniqueCode.GetAutoNumber("AC3"); aC3.Id = Convert.ToInt32(autoNumber); aC3.AC3ManualCode = UniqueCode.GetAccountLedgerCode("AL3", autoNumber); aC3.IsActive = true; aC3.Transfered = false; aC3.DateAdded = DateTime.Now; aC3.AddedBy = userId; aC3.DateUpdated = DateTime.Now; aC3.UpdatedBy = userId; return(aC3); }
protected void btnShowReport_Click(object sender, EventArgs e) { if (txtStartDate.Text != "" && txtEndDate.Text != "" && ddlCompany.SelectedValue != "") { ReportViewer1.Report = new rptQuotationDetail(); (ReportViewer1.Report as rptQuotationDetail).startDate = UniqueCode.GetDateFormat_MM_dd_yyy(txtStartDate.Text); (ReportViewer1.Report as rptQuotationDetail).endDate = UniqueCode.GetDateFormat_MM_dd_yyy(txtEndDate.Text); (ReportViewer1.Report as rptQuotationDetail).createdBy = Convert.ToInt16(Session["UserID"]); (ReportViewer1.Report as rptQuotationDetail).companyId = Convert.ToInt16(ddlCompany.SelectedValue); ReportViewer1.RefreshReport(); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "myScript", "WarningMessage();", true); } }
private bool AssignCode(string strUniqueCode, string strEmail) { bool blnCodeUpdated = false; using (_context) { UniqueCode newCode = new UniqueCode(); DateTime datToday = DateTime.Today; newCode.uniCode = strUniqueCode; newCode.uniEmail = strEmail; newCode.uniAssignDate = datToday; _context.UniqueCodes.Add(newCode); _context.SaveChanges(); blnCodeUpdated = true; } return(blnCodeUpdated); }
protected void btnShow_Click(object sender, EventArgs e) { if (dpStartdate.Value != "" && dpEnddate.Value != "" && ddlCompanyName.SelectedValue != "") { ReportViewer1.Report = new IncomeStatementReport(); (ReportViewer1.Report as IncomeStatementReport).pvparam1 = UniqueCode.GetDateFormat_MM_dd_yyy(dpStartdate.Value); (ReportViewer1.Report as IncomeStatementReport).pvparam2 = UniqueCode.GetDateFormat_MM_dd_yyy(dpEnddate.Value); (ReportViewer1.Report as IncomeStatementReport).pvparam = Convert.ToInt32(ddlCompanyName.SelectedValue); ReportViewer1.RefreshReport(); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "myScript", "WarningMessage();", true); } }
public AccAC4 MakeAc4(int userId) { var ac4 = AC4Entity(); var autoNumber1 = UniqueCode.GetAutoNumber("AC4"); ac4.Id = Convert.ToInt32(autoNumber1); ac4.AC1Id = ac4.AC1Id; ac4.AC2Id = ac4.AC2Id; ac4.AC3Id = ac4.AC3Id; ac4.AC4ManualCode = UniqueCode.GetAccountLedgerCode("AL4", autoNumber1); ac4.AC4Name = ac4.AC4Name; ac4.IsActive = true; ac4.Transfered = false; ac4.DateAdded = DateTime.Now; ac4.AddedBy = userId; ac4.DateUpdated = DateTime.Now; ac4.UpdatedBy = userId; return(ac4); }
public ActionResult Index() { try { var menuId = Convert.ToInt32(RouteData.Values["menuId"].ToString()); var userId = Convert.ToInt32(Session["UserID"]); var userPrev = UniqueCode.MenuPermission(menuId, userId); ViewBag.UserAddPrivilige = userPrev.EnableInsert; ViewBag.UserEditPrivilige = userPrev.EnableUpdate; return(View(db.AccCostCenterInfoes.ToList())); } catch (Exception ex) { return(JavaScript(string.Format("UYResult('{0}','{1}')", ex.Message, "failure"))); } }
public AccACDetail MakeAc5(int userId) { var autoNumber2 = UniqueCode.GetAutoNumber("AC5"); Ac5.Id = Convert.ToInt32(autoNumber2); Ac5.AC1Id = AC1Id; Ac5.AC2Id = AC2Id; Ac5.AC3Id = AC3Id; Ac5.ACName = ACName; Ac5.AC4Id = AC4Id; Ac5.ACode = UniqueCode.GetAccountLedgerCode("AL5", autoNumber2); Ac5.IsActive = true; Ac5.Transfered = false; Ac5.DateAdded = DateTime.Now; Ac5.AddedBy = userId; Ac5.DateUpdated = DateTime.Now; Ac5.UpdatedBy = userId; return(Ac5); }
public ActionResult Index() { var menuId = Convert.ToInt32(RouteData.Values["menuId"].ToString()); var userId = Convert.ToInt32(Session["UserID"]); var userPrev = UniqueCode.MenuPermission(menuId, userId); ViewBag.UserAddPrivilige = userPrev.EnableInsert; ViewBag.UserEditPrivilige = userPrev.EnableUpdate; try { var vm = new ViewModelVoucherMaster(); var vmList = vm.GetVoucherListByType((int)EmVoucherType.ContraVoucher); return(View(vmList)); } catch (Exception ex) { return(JavaScript(string.Format("UYResult('{0}','{1}')", ex.Message, "failure"))); } }
/// <summary> /// 加载本机机器码按钮点击事件 /// </summary> private void Btn_LoadLocalMachine_Click(object sender, EventArgs e) { string uniqueCode = UniqueCode.Compute(); this.Txt_UniqueCode.Text = uniqueCode; }
public ActionResult GetLedger(string query, string type) { return(Json(UniqueCode.GetLedgerList(query, type), JsonRequestBehavior.AllowGet)); }
public UniqueCode GetCodeByUserID(int id) { UniqueCode uc = new UniqueCode(); uc = _db.UniqueCodes.FirstOrDefault(df => df.UserID == id); return uc; }
public void SendActivationEmail(int id, string mailTo) { UniqueCode usrCode = new UniqueCode(); usrCode = _db.GetCodeByUserID(id); string usrUniqueCode = usrCode.ActivationCode; UserRegistration uName = new UserRegistration(); uName = _db.GetRegistrationById(id); string userName = uName.FirstName; string body = string.Empty; using (StreamReader reader = new StreamReader(Server.MapPath("~/Email/WelcomeEmailTemplate.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{RegisteredUSR}", userName); body = body.Replace("{UserCode}", usrUniqueCode); this.SendFormattedEmail(mailTo, body); }
public string VoucherEdit(int userId, EmVoucherType type, string voucherCode) { try { if (VoucherDetails == null) { return("Please Provide Cash Payment Voucher Detail Information"); } if (TotalDebitAmount != TotalCreditAmount) { return("Total Debit Amount and Credit Amount must be Equal"); } if (TotalDebitAmount == 0 && TotalCreditAmount == 0) { return("Total Debit Amount and Credit Amount Zero (0) Not Allow"); } using (var _db = new ERP_Entities()) { var oldVm = _db.AccVoucherMasters.SingleOrDefault(r => r.Id == Id); if (oldVm == null) { return("Voucher not found for existing voucher no!"); } _db.Database.ExecuteSqlCommand("exec VoucherHistoryInsert {0}", oldVm.Id); oldVm.Narration = Narration; oldVm.PaymentTo = PaymentTo; oldVm.UpdatedDate = DateTime.Now; oldVm.VoucherTypeId = (int)type; if (type == EmVoucherType.BankVoucher) { oldVm.ChequeNo = ChequeNo; oldVm.ChequeDate = UniqueCode.GetDateFormat_MM_dd_yyy(ChequeDateStr); } var newDate = UniqueCode.GetDateFormat_MM_dd_yyy(VoucherDateStr); if (newDate != oldVm.VoucherDate) { oldVm.VoucherDate = newDate; oldVm.VoucherNo = UniqueCode.VoucherCodeGenerate(type, voucherCode, oldVm.VoucherDate, oldVm.CompanyId); oldVm.SerialNo = Convert.ToInt32(UniqueCode.GetVoucherSerialByMonth(type, oldVm.VoucherDate)); } var oldVd = _db.AccVoucherDetails.Where(p => p.VMasterId == Id); _db.AccVoucherDetails.RemoveRange(oldVd); foreach (var vDetail in VoucherDetails) { if (vDetail.CostCenterId != 0 && vDetail.AC5Id != 0) { if ((vDetail.DebitAmount == 0) && (vDetail.CreditAmount == 0)) { return("Please provide at lest one amount(Debit or Credit)"); } vDetail.TransactionType = vDetail.DebitAmount != 0 ? "Debit" : "Credit"; vDetail.VoucherNo = oldVm.VoucherNo; vDetail.VMasterId = oldVm.Id; vDetail.IsActive = true; _db.AccVoucherDetails.Add(vDetail.VoucherDetailEntity()); } else { return("Provide LedgerInfo and CostCenter in all field"); } } _db.Entry(oldVm).State = EntityState.Modified; _db.SaveChanges(); } // end using return("ok"); } catch { return("Please provide all information"); } }
public ServiceDataProtection(IDataProtectionProvider dataProtectionProvider, UniqueCode uniqueCode) { _protector = dataProtectionProvider.CreateProtector(uniqueCode.SecrectKey); _uniqueCode = uniqueCode; }