Esempio n. 1
0
        public BranchesView GetBranchView(int id)
        {
            BranchesView branch = new BranchesView();

            branch = GetBranchesViews().Where(o => o.BranchID.Equals(id)).FirstOrDefault();
            return(branch);
        }
Esempio n. 2
0
 public void AddBranch(BranchesView BV)
 {
     using (CMSProjectEntities db = new CMSProjectEntities())
     {
         BranchList branch = new BranchList();
         branch.StreetAddress = BV.StreetAddress;
         branch.City          = BV.City;
         branch.State         = BV.State;
         branch.Pincode       = BV.Pincode;
         branch.Active        = true;
         db.BranchLists.Add(branch);
         db.SaveChanges();
     }
 }
Esempio n. 3
0
 public void UpdateBranch(BranchesView BV)
 {
     using (CMSProjectEntities db = new CMSProjectEntities())
     {
         BranchList branch = new BranchList();
         branch.BranchID        = BV.BranchID;
         branch.StreetAddress   = BV.StreetAddress;
         branch.City            = BV.City;
         branch.State           = BV.State;
         branch.Pincode         = BV.Pincode;
         branch.Active          = (bool)BV.Active;
         db.Entry(branch).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
Esempio n. 4
0
        public ActionResult AddOrEditB(BranchesView BV)
        {
            DataManager DM = new DataManager();

            if (BV.BranchID == 0)
            {
                DM.AddBranch(BV);
                return(Json(new { success = true, message = "Added Successfully!" }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                DM.UpdateBranch(BV);
                return(Json(new { success = true, message = "Updated Successfully!" }, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 5
0
        public ActionResult DeleteB(int id)
        {
            DataManager  DM = new DataManager();
            BranchesView BV = new BranchesView();

            BV = DM.GetBranchView(id);
            using (CMSProjectEntities db = new CMSProjectEntities())
            {
                BranchList branch = new BranchList();
                branch.BranchID        = BV.BranchID;
                branch.StreetAddress   = BV.StreetAddress;
                branch.City            = BV.City;
                branch.State           = BV.State;
                branch.Pincode         = BV.Pincode;
                branch.Active          = (bool)BV.Active;
                db.Entry(branch).State = System.Data.Entity.EntityState.Deleted;
                db.SaveChanges();
                return(Json(new { success = true, message = "Deleted Successfully" }, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 6
0
        public List <BranchesView> GetBranchesViews()
        {
            List <BranchesView> BV = new List <BranchesView>();

            using (CMSProjectEntities db = new CMSProjectEntities())
            {
                var branchlist = db.BranchLists.ToList();
                foreach (BranchList BL in branchlist)
                {
                    BranchesView branchesView = new BranchesView();
                    branchesView.BranchID      = BL.BranchID;
                    branchesView.StreetAddress = BL.StreetAddress;
                    branchesView.City          = BL.City;
                    branchesView.State         = BL.State;
                    branchesView.Pincode       = BL.Pincode;
                    branchesView.Active        = BL.Active;
                    BV.Add(branchesView);
                }
            }
            return(BV);
        }
Esempio n. 7
0
 private void BranchButton_Click(object sender, RoutedEventArgs e)
 {
     DataContext = new BranchesView();
 }