public ActionResult DeleteConfirmed(int id)
        {
            TBACCOUNTMASTER tbaccountmaster = db.TBACCOUNTMASTERs.Find(id);

            db.TBACCOUNTMASTERs.Remove(tbaccountmaster);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #2
0
        public ActionResult EditAccountMaster(int id = 0)
        {
            TBACCOUNTMASTER obj = dbContext.TBACCOUNTMASTERs.Where(x => x.ACCOUNTID == id).FirstOrDefault();

            if (obj == null)
            {
                return(HttpNotFound());
            }
            ViewBag.accountTypeList = GetAccountType();
            ViewBag.BSPositiveList  = GetBSGroupPositive();
            ViewBag.BSNegativeList  = GetBSGroupNegative();
            ViewBag.AccountList     = dbContext.TBACCOUNTMASTERs.ToList();
            return(View("AccountMaster", obj));
        }
        // GET: /AccountMaster/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TBACCOUNTMASTER tbaccountmaster = db.TBACCOUNTMASTERs.Find(id);

            if (tbaccountmaster == null)
            {
                return(HttpNotFound());
            }
            return(View(tbaccountmaster));
        }
 public ActionResult Edit([Bind(Include = "ACCOUNTID,ACCOUNTTYPEID,OPENING_BALANCE,OPENINGTYPE,BSIDPOSITIVE,BSIDNEGATIVE,ADDRESS1,ADDRESS2,ADDRESS3,EMAIL,TINNO,MOBILENO")] TBACCOUNTMASTER tbaccountmaster)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tbaccountmaster).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ACCOUNTTYPEID = new SelectList(db.TBACCOUNTTYPEMASTERs, "ACCOUNTTYPEID", "ACCOUNTTYPENAME", tbaccountmaster.ACCOUNTTYPEID);
     ViewBag.BSIDNEGATIVE  = new SelectList(db.TBBALANCESHEETGROUPs, "BALANCESHEETGRPID", "BALANCESHEETGROUPNM", tbaccountmaster.BSIDNEGATIVE);
     ViewBag.BSIDPOSITIVE  = new SelectList(db.TBBALANCESHEETGROUPs, "BALANCESHEETGRPID", "BALANCESHEETGROUPNM", tbaccountmaster.BSIDPOSITIVE);
     ViewBag.ACCOUNTID     = new SelectList(db.TBACCOUNTMASTERs, "ACCOUNTID", "OPENINGTYPE", tbaccountmaster.ACCOUNTID);
     ViewBag.ACCOUNTID     = new SelectList(db.TBACCOUNTMASTERs, "ACCOUNTID", "OPENINGTYPE", tbaccountmaster.ACCOUNTID);
     return(View(tbaccountmaster));
 }
        // GET: /AccountMaster/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TBACCOUNTMASTER tbaccountmaster = db.TBACCOUNTMASTERs.Find(id);

            if (tbaccountmaster == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ACCOUNTTYPEID = new SelectList(db.TBACCOUNTTYPEMASTERs, "ACCOUNTTYPEID", "ACCOUNTTYPENAME", tbaccountmaster.ACCOUNTTYPEID);
            ViewBag.BSIDNEGATIVE  = new SelectList(db.TBBALANCESHEETGROUPs, "BALANCESHEETGRPID", "BALANCESHEETGROUPNM", tbaccountmaster.BSIDNEGATIVE);
            ViewBag.BSIDPOSITIVE  = new SelectList(db.TBBALANCESHEETGROUPs, "BALANCESHEETGRPID", "BALANCESHEETGROUPNM", tbaccountmaster.BSIDPOSITIVE);
            ViewBag.ACCOUNTID     = new SelectList(db.TBACCOUNTMASTERs, "ACCOUNTID", "OPENINGTYPE", tbaccountmaster.ACCOUNTID);
            ViewBag.ACCOUNTID     = new SelectList(db.TBACCOUNTMASTERs, "ACCOUNTID", "OPENINGTYPE", tbaccountmaster.ACCOUNTID);
            return(View(tbaccountmaster));
        }
Exemple #6
0
        public ActionResult AccountMasterSaveChanges(AcountMasterVM obj)
        {
            if (obj.ACCOUNTNAME != null)
            {
                if (obj.ACCOUNTID > 0)
                {
                    TBACCOUNTMASTER objbrand = dbContext.TBACCOUNTMASTERs.Where(x => x.ACCOUNTID == obj.ACCOUNTID).FirstOrDefault();
                    objbrand.ACCOUNTTYPEID   = obj.ACCOUNTTYPEID;
                    objbrand.ACCOUNTNAME     = obj.ACCOUNTNAME;
                    objbrand.ADDRESS1        = obj.ADDRESS1;
                    objbrand.ADDRESS2        = obj.ADDRESS2;
                    objbrand.ADDRESS3        = obj.ADDRESS3;
                    objbrand.BSIDPOSITIVE    = obj.BSIDPOSITIVE;
                    objbrand.BSIDNEGATIVE    = obj.BSIDNEGATIVE;
                    objbrand.EMAIL           = obj.EMAIL;
                    objbrand.MOBILENO        = obj.MOBILENO;
                    objbrand.OPENING_BALANCE = obj.OPENING_BALANCE;
                    objbrand.OPENINGTYPE     = obj.OPENINGTYPE;
                    objbrand.TINNO           = obj.TINNO;
                }
                else
                {
                    TBACCOUNTMASTER objTBACCOUNTMASTER = JsonConvert.DeserializeObject <TBACCOUNTMASTER>(JsonConvert.SerializeObject(obj));
                    dbContext.TBACCOUNTMASTERs.Add(objTBACCOUNTMASTER);
                    dbContext.SaveChanges();
                    var id = dbContext.TBACCOUNTMASTERs.OrderByDescending(x => x.ACCOUNTID).FirstOrDefault();

                    if (obj.OPENINGTYPE == "0")
                    {
                        TBDEBIT objDebit = new TBDEBIT();
                        objDebit.FNEntryCode = Convert.ToInt32(id.ACCOUNTID);
                        objDebit.STType      = "OPENI";
                        objDebit.HeadCode    = Convert.ToInt32(id.ACCOUNTID);
                        objDebit.FNAmount    = obj.OPENING_BALANCE;
                        objDebit.FNDate      = Convert.ToDateTime("1-4-2016");
                        objDebit.Description = "OPENING BALANCE AGAINST " + obj.ACCOUNTNAME;
                        dbContext.TBDEBITs.Add(objDebit);
                        dbContext.SaveChanges();
                    }
                    else
                    {
                        TBCREDIT objCredit = new TBCREDIT();
                        objCredit.FNEntryCode = Convert.ToInt32(id.ACCOUNTID);
                        objCredit.STType      = "OPENI";
                        objCredit.HeadCode    = Convert.ToInt32(id.ACCOUNTID);
                        objCredit.FDAmount    = obj.OPENING_BALANCE;
                        objCredit.FDDate      = Convert.ToDateTime("1-4-2016");
                        objCredit.Description = "OPENING BALANCE AGAINST " + obj.ACCOUNTNAME;
                        dbContext.TBCREDITs.Add(objCredit);
                        dbContext.SaveChanges();
                    }
                }
            }
            else
            {
                ViewBag.accountTypeList = GetAccountType();
                ViewBag.BSPositiveList  = GetBSGroupPositive();
                ViewBag.BSNegativeList  = GetBSGroupNegative();
                ViewBag.AccountList     = dbContext.TBACCOUNTMASTERs.ToList();
                return(View("AccountMaster", obj));
            }

            return(RedirectToAction("AccountMaster"));
        }