private void loadData() { try { m_user = (GeneralSetup)r_gensetupRep.GetById(new GeneralSetup(1)); companyNameTextBox.Text = m_user.COMPANY_NAME; addresstextBox.Text = m_user.ADDRESS; emailKryptonTextBox.Text = m_user.EMAIL; faxKryptonTextBox.Text = m_user.FAX; phoneKryptonTextBox.Text = m_user.PHONE; regDatekryptonDateTimePicker.Value = m_user.REG_DATE; taxNokryptonTextBox.Text = m_user.TAX_NO; websiteKryptonTextBox.Text = m_user.WEBSITE; startEntryPeriodkryptonComboBox1.Text = m_user.START_ENTRY_PERIOD.ToString(); foreach (string kys in m_user.AUTONUMBER_LIST.Keys) { AutoNumberSetup f = m_user.AUTONUMBER_LIST[kys]; int t = gridAutonumber.Rows.Add( f.FORM_CODE, f.PREFIX, f.START, f.DIGIT, f.INITIAL_AUTO_NUMBER, f.AUTONUMBER_SETUP_TYPE ); gridAutonumber.Rows[t].Tag = f; } } catch (Exception x) { } }
public ActionResult GeneralSetup(GeneralSetupVM vm) { int companyid = Convert.ToInt32(Session["CurrentCompanyID"].ToString()); GeneralSetup v = new GeneralSetup(); v = db.GeneralSetups.Where(cc => cc.BranchId == vm.BranchId && cc.SetupTypeID == vm.SetupTypeID).FirstOrDefault(); if (v == null) { v = new GeneralSetup(); int max = (from d in db.GeneralSetups orderby d.SetupID descending select d.SetupID).FirstOrDefault(); v.SetupID = max + 1;; v.BranchId = vm.BranchId; v.AcCompanyId = companyid; v.SetupTypeID = vm.SetupTypeID; //v.Text1 = vm.TextDoc; if (v.SetupTypeID != 1) { v.Text1 = vm.TextDoc; } else if (v.SetupID == 1) { v.Text1 = vm.Text1; v.Text2 = vm.Text2; v.Text3 = vm.Text3; v.Text4 = vm.Text4; v.Text5 = vm.Text5; } db.GeneralSetups.Add(v); db.SaveChanges(); } else { if (v.SetupTypeID != 1) { v.Text1 = vm.TextDoc; } else if (v.SetupID == 1) //invoice footer { v.Text1 = vm.Text1; // Doc; v.Text2 = vm.Text2; v.Text3 = vm.Text3; v.Text4 = vm.Text4; v.Text5 = vm.Text5; } db.Entry(v).State = EntityState.Modified; db.SaveChanges(); } return(RedirectToAction("Index")); }
public void ClearForm() { try { companyNameTextBox.Text = ""; addresstextBox.Text = ""; gridAutonumber.Rows.Clear(); m_user = new GeneralSetup(); errorProvider1.Clear(); } catch (Exception x) { KryptonMessageBox.Show(x.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public ActionResult GeneralSetup(int id) { int setuptypeid = 0; if (Session["SetupTypeID"] != null) { setuptypeid = Convert.ToInt32(Session["SetupTypeID"].ToString()); } else { Session["SetupTypeID"] = 1; Session["SetupBranchID"] = id; setuptypeid = 1; } GeneralSetup v = new GeneralSetup(); GeneralSetupVM vm = new GeneralSetupVM(); v = db.GeneralSetups.Where(cc => cc.BranchId == id && cc.SetupTypeID == setuptypeid).FirstOrDefault(); if (v == null) { vm.SetupID = 0; vm.BranchId = id; vm.SetupTypeID = setuptypeid; // db.GeneralSetupTypes.FirstOrDefault().ID; vm.TextDoc = ""; vm.Text1 = ""; vm.Text2 = ""; vm.Text3 = ""; vm.Text4 = ""; vm.Text5 = ""; } else { vm.SetupID = v.SetupID; vm.BranchId = v.BranchId; vm.SetupTypeID = v.SetupTypeID; vm.TextDoc = v.Text1; vm.Text1 = v.Text1; vm.Text2 = v.Text2; vm.Text3 = v.Text3; vm.Text4 = v.Text4; vm.Text5 = v.Text5; } ViewBag.SetupType = db.GeneralSetupTypes.ToList(); return(View(vm)); }