public PaymentType Get(int paymentTypeID) { using (var ctx = new FitnessDataContext()) { return(ctx.PaymentTypes.SingleOrDefault(row => row.ID == paymentTypeID)); } }
public string GetDescription(int paymentTypeID) { using (var ctx = new FitnessDataContext()) { return(ctx.PaymentTypes.Any(row => row.ID == paymentTypeID) ? ctx.PaymentTypes.Single(row => row.ID == paymentTypeID).Description : String.Empty); } }
public void Delete(int[] paymentTypesID) { using (var ctx = new FitnessDataContext()) { ctx.PaymentTypes.DeleteAllOnSubmit(ctx.PaymentTypes.Where(row => paymentTypesID.Contains(row.ID))); ctx.SubmitChanges(); } }
public string GetValue(string key) { string result = String.Empty; using (FitnessDataContext ctx = new FitnessDataContext()) { result = ctx.Configurations.SingleOrDefault(config => config.Key == key).Value; } return(result); }
public void SetValue(string key, string value) { using (FitnessDataContext ctx = new FitnessDataContext()) { var configuration = ctx.Configurations.SingleOrDefault(config => config.Key == key); configuration.Key = key; configuration.Value = value; ctx.SubmitChanges(); } }
public string Generate(int branchID, string formCode, int month, int year) { string result = String.Empty; int currentNumber = GetLastNumber(formCode, branchID, year); string branchCode; using (var ctx = new FitnessDataContext()) branchCode = ctx.Branches.SingleOrDefault(row => row.ID == branchID).Code; currentNumber++; if (formCode == "CO") { // contract result = String.Format("{0}-{1}-{2}", branchCode.ToUpper(), Convert.ToString(year).Substring(2, 2), currentNumber.ToString("00000")); } else if (formCode == "CU") { result = String.Format("{0}{1}", branchCode.ToUpper(), currentNumber.ToString("000000")); } else if (formCode == "OR") { result = String.Format("{0}-{1}{2}-{3}", branchCode.ToUpper(), month.ToString("00"), Convert.ToString(year).Substring(2, 2), currentNumber.ToString("00000")); } else if (formCode == "BL") { result = String.Format("{0}-{1}{2}-{3}", branchCode.ToUpper(), month.ToString("00"), Convert.ToString(year).Substring(2, 2), currentNumber.ToString("00000")); } else { result = String.Format("{0}/{1}{2}{3}/{4}", formCode, branchCode.ToUpper(), month.ToString("00"), Convert.ToString(year).Substring(2, 2), currentNumber.ToString("000")); } return(result); }
public void Add( string description, bool isActive) { using (var ctx = new FitnessDataContext()) { PaymentType pay = new PaymentType(); pay.Description = description; pay.IsActive = isActive; EntityHelper.SetAuditFieldForInsert(pay, HttpContext.Current.User.Identity.Name); ctx.PaymentTypes.InsertOnSubmit(pay); } }
public void Update( int id, string description, bool isActive) { using (var ctx = new FitnessDataContext()) { PaymentType pay = ctx.PaymentTypes.Single(row => row.ID == id); pay.Description = description; pay.IsActive = isActive; EntityHelper.SetAuditFieldForUpdate(pay, HttpContext.Current.User.Identity.Name); ctx.SubmitChanges(); } }
void IBasicCommand.Read(int id) { mvwForm.SetActiveView(viwAddEdit); using (var ctx = new FitnessDataContext()) { Alert entity = ctx.Alerts.Single(row => row.ID == id); txtDescription.Text = entity.Description; CalendarPopup1.SelectedValue = entity.StartDate; chkInfinite.Checked = !entity.EndDate.HasValue; CalendarPopup2.SelectedValue = entity.EndDate.HasValue ? entity.EndDate : null; chkActive.Checked = entity.Active; txtDescription.Focus(); } }
protected void Page_Load(object sender, EventArgs e) { using (var ctx = new FitnessDataContext()) { ctx.Connection.Open(); lblBrowser.Text = String.Format("{0} - {1} {2}", Request.Browser.Type, Request.Browser.Version, Request.Browser.Platform); lblDatabase.Text = ctx.Connection.Database; lblDatabaseServer.Text = ctx.Connection.DataSource; lblServerVersion.Text = ctx.Connection.ServerVersion; lblSecurityProvider.Text = UserManagement.GetSecurityProviderName(); } bulBranch.DataSource = userProvider.GetCurrentActiveBranches(User.Identity.Name); bulBranch.DataTextField = "Name"; bulBranch.DataBind(); }
private void Create(string formCode, int branchID, int year) { using (var ctx = new FitnessDataContext()) { AutoNumber autoNumber = ctx.AutoNumbers.SingleOrDefault(row => row.FormCode == formCode && row.BranchID == branchID && row.Year == year); if (autoNumber == null) { autoNumber = new AutoNumber(); autoNumber.BranchID = branchID; autoNumber.FormCode = formCode; autoNumber.Year = year; autoNumber.LastNumber = 0; ctx.AutoNumbers.InsertOnSubmit(autoNumber); ctx.SubmitChanges(); } } }
void IBasicCommand.Delete() { int[] arrayOfID = DynamicControlBinding.GetRowIdForDeletion(gvwMaster); try { using (var ctx = new FitnessDataContext()) { ctx.Alerts.DeleteAllOnSubmit(ctx.Alerts.Where(row => arrayOfID.Contains(row.ID))); ctx.SubmitChanges(); } } catch (Exception ex) { DynamicControlBinding.SetLabelTextWithCssClass(lblStatus, ex.Message, LabelStyleNames.ErrorMessage); ApplicationLogger.Write(ex); } ((IBasicCommand)this).Refresh(); }
void IBasicCommand.Save() { if (this.IsValid) { try { using (var ctx = new FitnessDataContext()) { Alert entity = RowID == 0 ? new Alert() : ctx.Alerts.Single(row => row.ID == RowID); entity.Description = txtDescription.Text; entity.StartDate = CalendarPopup1.SelectedValue.Value; entity.EndDate = chkInfinite.Checked ? null : CalendarPopup2.SelectedValue; entity.Active = chkActive.Checked; if (RowID == 0) { EntityHelper.SetAuditFieldForInsert(entity, User.Identity.Name); ctx.Alerts.InsertOnSubmit(entity); } else { EntityHelper.SetAuditFieldForUpdate(entity, User.Identity.Name); } ctx.SubmitChanges(); } DynamicControlBinding.SetLabelTextWithCssClass(lblStatus, "Data has been saved.", LabelStyleNames.InfoMessage); } catch (Exception ex) { DynamicControlBinding.SetLabelTextWithCssClass(lblStatus, ex.Message, LabelStyleNames.ErrorMessage); ApplicationLogger.Write(ex); } finally { ((IBasicCommand)this).Refresh(); } } }
public FormAccessProvider(FitnessDataContext context) { this.ctx = context; }
public BankProvider(FitnessDataContext context) { ctx = context; }
public ClassProvider(FitnessDataContext context) { this.ctx = context; }
public ProspectProvider(FitnessDataContext context) { this.ctx = context; }
public EmployeeProvider(FitnessDataContext context) { this.ctx = context; }
public BranchProvider(FitnessDataContext context) { this.ctx = context; }
public MonthlyClosingProvider(FitnessDataContext context) { this.ctx = context; }
public SchoolProvider(FitnessDataContext context) { ctx = context; }
public SecurityProvider(FitnessDataContext context) { this.context = context; }
public AutoNumberProvider(FitnessDataContext context) { this.ctx = context; }
public PaymentTypeProvider(FitnessDataContext context) { this.ctx = context; }
public ItemAccountProvider(FitnessDataContext context) { this.ctx = context; }
public TemplateTextProvider(FitnessDataContext ctx) { this.ctx = ctx; }
public CustomerStatusProvider(FitnessDataContext context) { this.ctx = context; }
public PersonProvider(FitnessDataContext context) { this.ctx = context; }
public ItemTypeProvider(FitnessDataContext context) { this.ctx = context; }
public BillingTypeProvider(FitnessDataContext context) { this.ctx = context; }