Exemple #1
0
 public PaymentType Get(int paymentTypeID)
 {
     using (var ctx = new FitnessDataContext())
     {
         return(ctx.PaymentTypes.SingleOrDefault(row => row.ID == paymentTypeID));
     }
 }
Exemple #2
0
 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);
     }
 }
Exemple #3
0
 public void Delete(int[] paymentTypesID)
 {
     using (var ctx = new FitnessDataContext())
     {
         ctx.PaymentTypes.DeleteAllOnSubmit(ctx.PaymentTypes.Where(row => paymentTypesID.Contains(row.ID)));
         ctx.SubmitChanges();
     }
 }
Exemple #4
0
        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);
        }
Exemple #5
0
 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();
     }
 }
Exemple #6
0
        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);
        }
Exemple #7
0
 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);
     }
 }
Exemple #8
0
 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();
     }
 }
Exemple #9
0
 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();
     }
 }
Exemple #10
0
    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();
    }
Exemple #11
0
 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();
         }
     }
 }
Exemple #12
0
    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();
    }
Exemple #13
0
    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();
            }
        }
    }
Exemple #14
0
 public FormAccessProvider(FitnessDataContext context)
 {
     this.ctx = context;
 }
Exemple #15
0
 public BankProvider(FitnessDataContext context)
 {
     ctx = context;
 }
Exemple #16
0
 public ClassProvider(FitnessDataContext context)
 {
     this.ctx = context;
 }
 public ProspectProvider(FitnessDataContext context)
 {
     this.ctx = context;
 }
Exemple #18
0
 public EmployeeProvider(FitnessDataContext context)
 {
     this.ctx = context;
 }
 public BranchProvider(FitnessDataContext context)
 {
     this.ctx = context;
 }
Exemple #20
0
 public MonthlyClosingProvider(FitnessDataContext context)
 {
     this.ctx = context;
 }
 public SchoolProvider(FitnessDataContext context)
 {
     ctx = context;
 }
 public SecurityProvider(FitnessDataContext context)
 {
     this.context = context;
 }
Exemple #23
0
 public AutoNumberProvider(FitnessDataContext context)
 {
     this.ctx = context;
 }
Exemple #24
0
 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;
 }
Exemple #28
0
 public PersonProvider(FitnessDataContext context)
 {
     this.ctx = context;
 }
 public ItemTypeProvider(FitnessDataContext context)
 {
     this.ctx = context;
 }
 public BillingTypeProvider(FitnessDataContext context)
 {
     this.ctx = context;
 }