Esempio n. 1
0
        public int Update(TenancyItem model)
        {
            TenancyMaster objten = new TenancyMaster();

            objten              = Dbcontext.TenancyMasters.SingleOrDefault(m => m.TnID == model.TnID);
            objten.TnNo         = model.TnNo;
            objten.TDate        = model.TDate;
            objten.Address      = model.Address;
            objten.FromDate     = model.FromDate;
            objten.ToDate       = model.ToDate;
            objten.LandLord     = model.LandLord;
            objten.Others       = model.Others;
            objten.Period       = model.Period;
            objten.Phone        = model.Phone;
            objten.Remarks      = model.Remarks;
            objten.Rent         = model.Rent;
            objten.Status       = model.Status;
            objten.Subject      = model.Subject;
            objten.TnTypeCompId = model.TnTypeCompId;
            objten.TnTypeEmpId  = model.TnTypeEmpId;
            objten.TnTypeId     = model.TnTypeId;
            objten.TnType       = model.TnType;
            objten.Terms        = model.Terms;
            return(Dbcontext.SaveChanges());
        }
Esempio n. 2
0
        public TenancyItem GetByid(int id)
        {
            Mapper.CreateMap <TenancyMaster, TenancyItem>();
            TenancyMaster dbTenancy = Dbcontext.TenancyMasters.SingleOrDefault(m => m.TnID == id);
            TenancyItem   objItem   = Mapper.Map <TenancyItem>(dbTenancy);

            return(objItem);
        }
Esempio n. 3
0
        public int Insert(TenancyItem model)
        {
            Mapper.CreateMap <TenancyItem, TenancyMaster>();
            TenancyMaster dbTenancy = Mapper.Map <TenancyMaster>(model);

            Dbcontext.TenancyMasters.Add(dbTenancy);
            return(Dbcontext.SaveChanges());
        }
Esempio n. 4
0
        public void Save(TenancyItem model)
        {
            TenancyDocument objTenancy = new TenancyDocument();

            objTenancy.FileName    = model.FileName;
            objTenancy.FileUrl     = model.FileUrl;
            objTenancy.TenId       = model.TenId;
            objTenancy.CreatedDate = System.DateTime.Now;
            Dbcontext.TenancyDocuments.Add(objTenancy);
            Dbcontext.SaveChanges();
        }
Esempio n. 5
0
        public void DocUpdate(TenancyItem model)
        {
            TenancyDocument objTenancy = new TenancyDocument();

            objTenancy = Dbcontext.TenancyDocuments.SingleOrDefault(m => m.TenId == model.TenId);

            objTenancy.FileName    = model.FileName;
            objTenancy.FileUrl     = model.FileUrl;
            objTenancy.TenId       = model.TenId;
            objTenancy.CreatedDate = System.DateTime.Now;

            Dbcontext.SaveChanges();
        }
Esempio n. 6
0
        public ActionResult Edit(int id)
        {
            objTenancyService = new TenancyService();
            objTenancyItem    = new TenancyItem();

            // string strid = objTenancyService.Decrypt(id.ToString());
            //string strid = id.ToString();
            //int Tid = Convert.ToInt32(strid);

            objTenancyItem = objTenancyService.GetByid(id);

            //CompanyBind
            List <CompanyItem> lstCompany = new List <CompanyItem>();

            lstCompany = objTenancyService.GetCompany();
            objTenancyItem.ListCompany = new List <CompanyItem>();
            objTenancyItem.ListCompany.AddRange(lstCompany);

            //Employee Bind
            List <EmployeeItem> lstEmp = new List <EmployeeItem>();

            lstEmp = objTenancyService.GetEmployee();
            objTenancyItem.ListEmployee = new List <EmployeeItem>();
            objTenancyItem.ListEmployee.AddRange(lstEmp);

            // ListGrid bind

            List <TenancyItem> ListTenancy = new List <TenancyItem>();

            ListTenancy = objTenancyService.getTenancyDoc(id);
            objTenancyItem.ListTenancy = new List <TenancyItem>();
            objTenancyItem.ListTenancy.AddRange(ListTenancy);

            //TenancyType
            List <clsMasterData> lstTT = new List <clsMasterData>();

            lstTT = objTenancyService.GetTenancyType();
            objTenancyItem.ListTT = new List <clsMasterData>();
            objTenancyItem.ListTT.AddRange(lstTT);

            //ViewBag.Menuid = objTenancyService.Decrypt(Request.QueryString["menuid"]);
            ViewBag.Menuid = (Request.QueryString["menuid"]);

            return(View(objTenancyItem));
        }
Esempio n. 7
0
        public ActionResult Create()
        {
            objTenancyService = new TenancyService();
            objTenancyItem    = new TenancyItem();

            //CompanyBind
            List <CompanyItem> lstCompany = new List <CompanyItem>();

            lstCompany = objTenancyService.GetCompany();
            objTenancyItem.ListCompany = new List <CompanyItem>();
            objTenancyItem.ListCompany.AddRange(lstCompany);

            //Employee Bind
            List <EmployeeItem> lstEmp = new List <EmployeeItem>();

            lstEmp = objTenancyService.GetEmployee();
            objTenancyItem.ListEmployee = new List <EmployeeItem>();
            objTenancyItem.ListEmployee.AddRange(lstEmp);

            // ListGrid bind
            int cid = 0;

            if (Session["CompID"] != null)
            {
                cid = Convert.ToInt32(Session["CompID"].ToString());
            }
            List <TenancyItem> ListTenancy = new List <TenancyItem>();

            ListTenancy = objTenancyService.GetAll(cid);

            objTenancyItem.ListTenancy = new List <TenancyItem>();
            //  objTenancyItem.ListTenancy.Add(new TenancyItem{TnID=Encrypt(ListTenancy)})
            objTenancyItem.ListTenancy.AddRange(ListTenancy);

            //TenancyType
            List <clsMasterData> lstTT = new List <clsMasterData>();

            lstTT = objTenancyService.GetTenancyType();
            objTenancyItem.ListTT = new List <clsMasterData>();
            objTenancyItem.ListTT.AddRange(lstTT);

            ViewBag.Menuid = (Request.QueryString["menuid"]);
            return(View(objTenancyItem));
        }
Esempio n. 8
0
        //Tenacy

        public ActionResult TenancyReport()
        {
            ViewBag.Menuid = Request.QueryString["menuId"];
            TenancyItem   objAllItem   = new TenancyItem();
            ReportService objclsmethod = new ReportService();
            int           cid          = 0;

            if (Session["CompID"] != null)
            {
                cid = Convert.ToInt32(Session["CompID"].ToString());
            }
            List <TenancyItem> objMaster = objclsmethod.gettenacny(cid);

            objAllItem.ListTenancy = new List <TenancyItem>();
            objAllItem.ListTenancy.AddRange(objMaster);


            return(View("TenancyReport", objAllItem));
            //return View();
        }
Esempio n. 9
0
 public ActionResult delete(int id, int menuid)
 {
     try
     {
         //int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString());
         TenancyService objTenService = new TenancyService();
         TenancyItem    objDoc        = new TenancyItem();
         objDoc = objTenService.GetByid(id);
         db.TenancyMasters.Remove(db.TenancyMasters.Find(id));
         db.SaveChanges();
         //ViewBag.Empid = Empid;
         ViewBag.Menuid = Request.QueryString["menuId"];
     }
     catch (Exception ex)
     {
         ViewBag.ErrorMsg = "First Delete This Tenancy No's All Documents. ";
         //ViewBag.Action = "Create";
         //ViewBag.Controller = "TenancyController";
         //ViewBag.view = "Tenancy" + id + menuid;
         return(View("Error"));
     }
     return(RedirectToAction("Create", new { @id = id, @menuId = Request.QueryString["menuId"] }));
 }
Esempio n. 10
0
        public ActionResult Edit(TenancyItem model, HttpPostedFileBase[] files)
        {
            objTenancyService = new TenancyService();
            objTenancyItem    = new TenancyItem();
            string uid = null;

            if (Session["UserId"] != null)
            {
                uid = Session["UserId"].ToString();
            }
            model.UpdatedBy   = uid;
            model.UpdatedDate = System.DateTime.Now;
            objTenancyService.Update(model);


            if (files != null)
            {
                //string s = objTenancyService.Getid();
                string s       = Convert.ToString(model.TnID);
                string strtext = "Tenancy";
                foreach (HttpPostedFileBase file in files)
                {
                    if (file != null)
                    {
                        string filename   = System.IO.Path.GetFileName(file.FileName);
                        string folderPath = Server.MapPath("~/UploadedDocs/") + strtext;
                        //  obj.EmpId = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString());
                        string destinationPath    = folderPath;
                        string employeeFolderPath = destinationPath + "/" + s;
                        // create folder if it is not exist
                        if (!Directory.Exists(folderPath))
                        {
                            Directory.CreateDirectory(folderPath);
                            if (!Directory.Exists(employeeFolderPath))
                            {
                                Directory.CreateDirectory(employeeFolderPath);
                                // create emp id folder of not exist
                            }
                        }
                        else
                        {
                            if (!Directory.Exists(employeeFolderPath))
                            {
                                Directory.CreateDirectory(employeeFolderPath);
                                // create emp id folder of not exist
                            }
                        }
                        destinationPath = employeeFolderPath;
                        /*Saving the file in server folder*/
                        //file.SaveAs(Server.MapPath("~/Images/" + filename));
                        string fileNewName = Guid.NewGuid() + Path.GetExtension(file.FileName);

                        file.SaveAs(Path.Combine(destinationPath, fileNewName));
                        objTenancyItem.UpdatedBy   = uid;
                        objTenancyItem.UpdatedDate = System.DateTime.Now;
                        objTenancyItem.TenId       = Convert.ToInt32(s);
                        objTenancyItem.FileUrl     = Path.Combine("/UploadedDocs/" + strtext + "/" + s + "/", fileNewName);
                        objTenancyItem.FileName    = Path.GetFileNameWithoutExtension(file.FileName);
                        objTenancyService.Save(objTenancyItem);
                        //string filepathtosave = "Images/" + filename;
                        /*HERE WILL BE YOUR CODE TO SAVE THE FILE DETAIL IN DATA BASE*/
                    }
                }
            }

            return(RedirectToAction("Edit", new { @menuId = model.Viewbagidformenu }));
        }