Пример #1
0
        public void BindSrchMember()
        {
            try
            {
                var db    = new FitnessCenterEntities();
                var query = (from a in db.Memberships
                             join b in db.Leads on a.LeadId equals b.ID
                             where a.MembershipNo != ""
                             orderby b.firstName + " " + b.lastName ascending
                             select new { a.MembershipNo, MemberName = b.firstName + " " + b.lastName }).ToList();

                //foreach (var item in query)
                // {
                ddlSrchMember.DataSource     = query;
                ddlSrchMember.DataTextField  = "MemberName";
                ddlSrchMember.DataValueField = "membershipUniqueId";
                ddlSrchMember.DataBind();
                ddlSrchMember.Items.Insert(0, new ListItem("Select Member", "0"));
                //}
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
        public ActionResult AddCustomer(Customer t)
        {
            if (ModelState.IsValid)
            {
                if (db.Users.Where(x => x.EMail == t.EMail).FirstOrDefault() == null)
                {
                    t.RegistrationDate = DateTime.Now;
                    db.Customers.Add(t);
                    db.SaveChanges();

                    using (FitnessCenterEntities ff = new FitnessCenterEntities()) {
                        User u = new User();
                        u.EMail     = t.EMail;
                        u.FirstName = t.FirstName;
                        u.LastName  = t.LastName;
                        u.Password  = t.Password;
                        u.Role      = "Customer";
                        ff.Users.Add(u);
                        ff.SaveChanges();
                        TempData["Success"] = u.FirstName + " " + u.LastName + " added successfully.";
                    }

                    return(RedirectToAction("ManageCustomer", "Staff"));
                }
                else
                {
                    TempData["Error"] = t.EMail + " is already registered to the system.";
                    return(RedirectToAction("ManageCustomer", "Staff"));
                }
            }
            return(View());
        }
Пример #3
0
        private void BindRoles()
        {
            try
            {
                FitnessCenterEntities db = new FitnessCenterEntities();

                var qryEmployees = from emp in db.Users
                                   where emp.UserTypeId != 7 && emp.UserTypeId != 8 && emp.UserTypeId != 9 &&
                                   emp.UserTypeId != 1 && emp.isActive == true && emp.isDeleted == false
                                   select new
                {
                    FullName = emp.FirstName + " " + emp.LastName,
                    emp.ID
                };

                ddlUsers.DataSource     = qryEmployees;
                ddlUsers.DataTextField  = "FullName";
                ddlUsers.DataValueField = "ID";
                ddlUsers.DataBind();
                ddlUsers.Items.Insert(0, new ListItem("Select Staff", "0"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #4
0
        public ActionResult MyProfile(Customer c)
        {
            if (ModelState.IsValid)
            {
                var toBeUpdated = db.Customers.Find(c.ID);
                toBeUpdated.Address  = c.Address;
                toBeUpdated.Password = c.Password;
                toBeUpdated.Phone    = c.Phone;
                db.Entry(toBeUpdated).CurrentValues.SetValues(toBeUpdated);
                db.SaveChanges();

                using (FitnessCenterEntities ff = new FitnessCenterEntities())
                {
                    User first = ff.Users.Find(int.Parse(Session["UserID"].ToString()));
                    first.Password = c.Password;
                    ff.Entry(first).CurrentValues.SetValues(first);
                    ff.SaveChanges();
                }
                return(RedirectToAction("MyProfile", "Customer"));
            }
            User     uFirst = db.Users.Find(int.Parse(Session["UserID"].ToString()));
            Customer fCust  = db.Customers.Where(x => x.EMail == uFirst.EMail).FirstOrDefault();

            return(View(fCust));
        }
Пример #5
0
        private void ItemVisibility(long GroupId)
        {
            try
            {
                pnlItems.Controls.Clear();
                string            ltrItemLIString = string.Empty;
                List <ItemMaster> lstGetItem      = new FitnessCenterEntities().ItemMasters.Where(x => x.isDeleted == false && x.groupId == GroupId).ToList();
                foreach (var items in lstGetItem)
                {
                    Button btnItem = new Button();
                    btnItem.Text = items.name.ToString();
                    btnItem.ID   = "btnItem" + items.ID.ToString();
                    btnItem.Attributes.Add("data-id", items.ID.ToString());
                    btnItem.Click += new EventHandler(buttonItem_Click);

                    pnlItems.Controls.Add(btnItem);
                    if (items.ID % 2 == 1)
                    {
                        btnItem.CssClass = " btn btn1";
                    }
                    else
                    {
                        btnItem.CssClass = "btn btn2";
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #6
0
        public ActionResult AddCustomer(Customer t)
        {
            if (ModelState.IsValid)
            {

                if (db.Users.Where(x => x.EMail == t.EMail).FirstOrDefault() == null) {

                t.RegistrationDate = DateTime.Now;
                db.Customers.Add(t);
                db.SaveChanges();

                using (FitnessCenterEntities ff = new FitnessCenterEntities()) {
                User u = new User();
                u.EMail = t.EMail;
                u.FirstName = t.FirstName;
                u.LastName = t.LastName;
                u.Password = t.Password;
                u.Role = "Customer";
                ff.Users.Add(u);
                ff.SaveChanges();
                TempData["Success"] = u.FirstName + " " + u.LastName + " added successfully.";
                }

                return RedirectToAction("ManageCustomer", "Staff");
                }
                else
                {
                    TempData["Error"] = t.EMail + " is already registered to the system." ;
                    return RedirectToAction("ManageCustomer", "Staff");
                }
            }
            return View();
        }
        protected void grdMain_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "DetailPayment")
            {
                AgreementNumber = Convert.ToString(e.CommandArgument);
                //pnlDisclaimerDetails.Visible = true;
                PannelVisibility(true, true, true, false);
                BindGrid();
            }
            else if (e.CommandName == "SMSLead")
            {
                txtMsgSMS.Text  = "";
                AgreementNumber = Convert.ToString(e.CommandArgument);
                string jScript = "";
                jScript  = "$('#MsgBoxModal5').removeClass('hide');";
                jScript += "$('#masteroverlay5').removeClass('hide');";
                jScript += "$('#MsgBoxModal5').fadeIn(300);";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "transfer_SMS", jScript, true);

                var  objPayment = new FitnessCenterEntities().Payments.FirstOrDefault(x => x.MembershipId == M);
                long LeadId     = objPayment.LeadId;
                Lead objLead    = LeadController.GetLeadById(LeadId);
                txtSmS.Text     = objLead.mobileNumber;
                txtMsgSMS.Text  = "Your Due Amount is: " + Convert.ToString(objPayment.remainingAmount);
                txtMsgSMS.Text += "\nPlease Paid Before This Date: " + objPayment.DueAmountDate;
            }
        }
        protected void grdExpiredMembers_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "SMSLead")
                {
                    txtMsgSMS.Text = "";
                    MembershipId   = Convert.ToInt64(e.CommandArgument.ToString());
                    string jScript = "";
                    jScript  = "$('#MsgBoxModal5').removeClass('hide');";
                    jScript += "$('#masteroverlay5').removeClass('hide');";
                    jScript += "$('#MsgBoxModal5').fadeIn(300);";
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "transfer_SMS", jScript, true);

                    var  objMember = new FitnessCenterEntities().Memberships.FirstOrDefault(x => x.ID == MembershipId);
                    long LeadId    = objMember.LeadId;
                    Lead objLead   = LeadController.GetLeadById(LeadId);
                    txtSmS.Text     = objLead.mobileNumber;
                    txtMsgSMS.Text  = "YOUR EXPIRY DATE IS: " + objMember.ExpiryDate;
                    txtMsgSMS.Text += "\nPLEASE RENEW YOUR MEMBERSHIP BEFORE YOUR MEMBERSHIP EXPIRED";
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        protected void txtQty_TextChanged(object sender, EventArgs e)
        {
            long ItemId    = Convert.ToInt64(drpItems.SelectedValue);
            var  Inventory = new FitnessCenterEntities().ItemMasters.FirstOrDefault(x => x.isDeleted == false && x.ID == ItemId);

            if (Convert.ToInt64(txtQty.Text) > Inventory.Inventory)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "err_msg", "MessageBox('Error','You Have Not Enough Stock For This Item ')", true);
                txtQty.Text = "";
            }
        }
 public static bool IsPackageName(string PackageName)
 {
     try
     {
         var objPackageName = new FitnessCenterEntities().PackageMasters.FirstOrDefault(x => x.PackageName == PackageName && x.isDeleted == false);
         return(objPackageName == null ? false : true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #11
0
 public static bool IsCodeExists(string ItemCode, long GroupId, long ClubId)
 {
     try
     {
         var objItems = new FitnessCenterEntities().ItemMasters.FirstOrDefault(x => x.isDeleted == false && x.code == ItemCode && x.GroupMaster.clubId == ClubId && x.groupId == GroupId);
         return(objItems == null ? false : true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #12
0
 public static bool IsLeadExists(string MobileNo)
 {
     try
     {
         var obj = new FitnessCenterEntities().Leads.FirstOrDefault(x => x.isActive == true && x.isDeleted == false && x.mobileNumber == MobileNo);
         return(obj == null ? false : true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #13
0
 public static bool IsNameExists(string GroupName, long ClubId)
 {
     try
     {
         var objGroups = new FitnessCenterEntities().GroupMasters.FirstOrDefault(x => x.isDeleted == false && x.name == GroupName && x.clubId == ClubId);
         return(objGroups == null ? false : true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public static bool IsNameExists(string PackageName)
 {
     try
     {
         var objTowel = new FitnessCenterEntities().TowelHiringPackages.FirstOrDefault(x => x.isDeleted == false && x.packageName == PackageName);
         return(objTowel == null ? false : true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #15
0
 public static bool IsEmailExists(string Email)
 {
     try
     {
         var objUser = new FitnessCenterEntities().Users.FirstOrDefault(x => x.Email == Email && x.isDeleted == false);
         return(objUser == null ? false : true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #16
0
 public static bool IsUserNameExists(string Username, string MobileNo)
 {
     try
     {
         var objUser = new FitnessCenterEntities().Users.FirstOrDefault(x => x.UserName == Username && x.Mobile == MobileNo && x.isDeleted == false && x.isActive == true);
         return(objUser == null ? false : true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #17
0
 public static bool IsMemberExists(string AgreementNo)
 {
     try
     {
         var obj = new FitnessCenterEntities().Memberships.FirstOrDefault(x => x.isActive == true && x.isDeleted == false && x.AgreementNo == AgreementNo);
         return(obj == null ? false : true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #18
0
 public static bool IsLeadType(string LeadType)
 {
     try
     {
         var objLeadType = new FitnessCenterEntities().LeadTypeMasters.FirstOrDefault(x => x.LeadTypeName == LeadType && x.isDeleted == false);
         return(objLeadType == null ? false : true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #19
0
 public void DeleteAccessMasterByUser(long UserId)
 {
     try
     {
         using (var context = new FitnessCenterEntities())
         {
             context.ExecuteStoreCommand("delete from AccessMaster where userid={0}", UserId);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #20
0
 public void DeleteUserTargetHard(int UserTargetId)
 {
     try
     {
         using (var context = new FitnessCenterEntities())
         {
             context.ExecuteStoreCommand("delete from UserTargets where ID={0}", UserTargetId);
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #21
0
 public void DeleteAllTargetByUser(long UserId)
 {
     try
     {
         using (var context = new FitnessCenterEntities())
         {
             context.ExecuteStoreCommand("delete UserTargets where userid={0}", UserId);
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public void DeleteAllDisclaimerQuestionAnswerByDisclaimerId(long DisclaimerId)
 {
     try
     {
         using (var context = new FitnessCenterEntities())
         {
             context.ExecuteStoreCommand("Delete from DisclaimerQuestionAnswers where disclaimerId={0}", DisclaimerId);
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #23
0
 public void DeleteAllExrciseCardLevelSets(long exrciseCardId)
 {
     try
     {
         using (var context = new FitnessCenterEntities())
         {
             context.ExecuteStoreCommand("Delete from ExrciseCardLevelSets where exrciseCardId={0}", exrciseCardId);
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #24
0
 public void DeleteLeadTypeByLeadTypeId(long leadTypeId)
 {
     try
     {
         using (var context = new FitnessCenterEntities())
         {
             context.ExecuteStoreCommand("delete from UserTargets where leadTypeId={0}", leadTypeId);
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #25
0
 public void DeleteAllLeadQuestionAnswerByLeadId(long LeadId)
 {
     try
     {
         using (var context = new FitnessCenterEntities())
         {
             context.ExecuteStoreCommand("Delete from LeadQuestionAnswers where leadId={0}", LeadId);
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #26
0
 public void DeleteAllAssignExerciseByMemberId(long MemberId)
 {
     try
     {
         using (var context = new FitnessCenterEntities())
         {
             context.ExecuteStoreCommand("Delete from AssignExercise where memberId={0}", MemberId);
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #27
0
 protected void txtRfid_TextChanged(object sender, EventArgs e)
 {
     try
     {
         if (txtRfid.Text == "")
         {
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "succ_msg", "MessageBox('Error','Please Enter RFID Number');", true);
             ClearValues();
             PanelVisibility(false, false);
         }
         else
         {
             var  objMember = new FitnessCenterEntities().Memberships.FirstOrDefault(x => x.isActive == true && x.isDeleted == false && x.RFIDCardNumber == txtRfid.Text);
             bool isPaid    = true;
             MemberId = objMember.ID;
             List <MemberJuiceMaster> lstRech = JuiceRechargeController.GetRechargesByMemberId(MemberId);
             if (lstRech != null && lstRech.Count > 0)
             {
                 foreach (var obj in lstRech)
                 {
                     if (!obj.isPaid)
                     {
                         isPaid = false;
                         break;
                     }
                     else
                     {
                         isPaid = true;
                     }
                 }
             }
             if (isPaid)
             {
                 PanelVisibility(true, false);
                 BindMemberValues();
                 BindGrid();
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "err_msg", "MessageBox('Error','Previous Payment is not paid by this Member. Recharge fail');", true);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #28
0
        public ActionResult DeleteCustomer(Customer s)
        {
            using (FitnessCenterEntities fe = new FitnessCenterEntities())
            {
                s = db.Customers.Find(s.ID);
                User u = fe.Users.Where(x => x.EMail == s.EMail).FirstOrDefault();
                fe.Users.Attach(u);
                fe.Users.Remove(u);
            }

            db.Customers.Attach(s);
            db.Customers.Remove(s);
            db.SaveChanges();
            TempData["Success"] = s.FirstName + " " + s.LastName + " deleted successfully.";
            return(RedirectToAction("ManageCustomer", "Staff"));
        }
Пример #29
0
 public void DeleteSliderImages(long SliderId)
 {
     try
     {
         using (var context = new FitnessCenterEntities())
         {
             var objFacility = context.HomepageSliders.SingleOrDefault(x => x.ID == SliderId);
             objFacility.isDeleted = true;
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #30
0
 public void DeletePTPMember(long PTPMemberMasterId)
 {
     try
     {
         using (var context = new FitnessCenterEntities())
         {
             var objPTPMember = context.PTPMemberMasters.SingleOrDefault(x => x.ID == PTPMemberMasterId);
             objPTPMember.isDelete   = true;
             objPTPMember.deleteDate = DateTime.Now;
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public void DeletePackage(long PackageId)
 {
     try
     {
         using (var context = new FitnessCenterEntities())
         {
             var objTowel = context.TowelHiringPackages.Single(x => x.ID == PackageId);
             objTowel.deleteDate = DateTime.Now;
             objTowel.isDeleted  = true;
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #32
0
        public ActionResult DeleteCustomer(Customer s)
        {
            using (FitnessCenterEntities fe = new FitnessCenterEntities())
            {
                s = db.Customers.Find(s.ID);
                User u = fe.Users.Where(x => x.EMail == s.EMail).FirstOrDefault();
                fe.Users.Attach(u);
                fe.Users.Remove(u);
            }

            db.Customers.Attach(s);
            db.Customers.Remove(s);
            db.SaveChanges();
            TempData["Success"] = s.FirstName + " " + s.LastName + " deleted successfully.";
            return RedirectToAction("ManageCustomer", "Staff");
        }
        public ActionResult DeleteStaff(Staff s)
        {
            using (FitnessCenterEntities fe = new FitnessCenterEntities())
            {
                s.EMail = fe.Staffs.Where(x => x.ID == s.ID).FirstOrDefault().EMail;

                User u = fe.Users.Where(x => x.EMail == s.EMail).FirstOrDefault();
                if (u != null)
                {
                    fe.Users.Attach(u);
                    fe.Users.Remove(u);
                    fe.SaveChanges();

                }

            }

            //birden ço kreport u olursa hepsini silmek lazım

            /*      using (FitnessCenterEntities fe2 = new FitnessCenterEntities())
                  {
                      Report r = db.Reports.Find(s.ID);
                      if (r != null)
                      {
                         // ((IObjectContextAdapter)fe2).ObjectContext.Detach(s);
                          fe2.Reports.Attach(db.Reports.Where(x=>x.SenderID == s.ID).FirstOrDefault());
                          fe2.Reports.Remove(r);
                          fe2.SaveChanges();

                      }
                  }*/

            Report r = db.Reports.Where(x => x.SenderID == s.ID).FirstOrDefault();
            if (r != null)
            {
                db.Reports.Attach(r);
                db.Reports.Remove(r);
                db.SaveChanges();
            }
            db.Staffs.Attach(s);
            db.Staffs.Remove(s);
            db.SaveChanges();
            TempData["Success"] = "Deleted successfully.";
            return RedirectToAction("ManageStaff", "Manager");
        }
        public ActionResult MyProfile(Customer c)
        {
            if (ModelState.IsValid) {
            var toBeUpdated = db.Customers.Find(c.ID);
            toBeUpdated.Address = c.Address;
            toBeUpdated.Password = c.Password;
            toBeUpdated.Phone = c.Phone;
            db.Entry(toBeUpdated).CurrentValues.SetValues(toBeUpdated);
            db.SaveChanges();

            using (FitnessCenterEntities ff = new FitnessCenterEntities())
            {

                User first = ff.Users.Find(int.Parse(Session["UserID"].ToString()));
                first.Password = c.Password;
                ff.Entry(first).CurrentValues.SetValues(first);
                ff.SaveChanges();

            }
            return RedirectToAction("MyProfile", "Customer");
            }
            User uFirst = db.Users.Find(int.Parse(Session["UserID"].ToString()));
            Customer fCust = db.Customers.Where(x => x.EMail == uFirst.EMail).FirstOrDefault();
            return View(fCust);
        }
        public ActionResult EditStaff(Staff s)
        {
            if (ModelState.IsValid)
            {
                User search = db.Users.Where(x => x.EMail == s.EMail).FirstOrDefault();
                Staff sys = db.Staffs.Where(x => x.EMail == s.EMail).FirstOrDefault();
                if (s.Equals(sys)) return RedirectToAction("ManageStaff", "Manager");

                else if (search != null)
                {
                    TempData["Error"] = search.EMail + " is already registered to the system.";
                    return View();
                }
                else if (search != null && search.EMail == s.EMail)
                {
                    var toBeUpdatedfromUsers = db.Users.Where(x => x.EMail == s.EMail).FirstOrDefault();
                    var toBeUpdated = db.Staffs.Find(s.ID);
                    db.Entry(toBeUpdated).CurrentValues.SetValues(s);
                    db.SaveChanges();

                    using (FitnessCenterEntities ff = new FitnessCenterEntities())
                    {
                        toBeUpdatedfromUsers.EMail = s.EMail;
                        toBeUpdatedfromUsers.FirstName = s.FirstName;
                        toBeUpdatedfromUsers.LastName = s.LastName;
                        toBeUpdatedfromUsers.Password = s.Password;
                        ff.Entry(toBeUpdatedfromUsers).CurrentValues.SetValues(toBeUpdatedfromUsers);
                    }
                    TempData["Success"] = s.FirstName + " " + s.LastName + " is edited successfully.";
                    return RedirectToAction("ManageStaff", "Manager");
                }
            }
            return View();
        }
        public ActionResult MyProfile(Trainer c)
        {
            {
                var toBeUpdated = db.Trainers.Find(c.ID);
                toBeUpdated.Address = c.Address;
                toBeUpdated.Password = c.Password;
                toBeUpdated.Phone = c.Phone;
                db.Entry(toBeUpdated).CurrentValues.SetValues(toBeUpdated);
                db.SaveChanges();

                using (FitnessCenterEntities ff = new FitnessCenterEntities())
                {
                    User first = ff.Users.Find(int.Parse(Session["UserID"].ToString()));
                    first.Password = c.Password;
                    ff.Entry(first).CurrentValues.SetValues(first);
                    ff.SaveChanges();
                }
                return RedirectToAction("MyProfile", "Trainer");
            }
        }