示例#1
0
        //private labourCtl db = new labourCtl();
        //{privateVariables}



        public ActionResult Create()
        {
            using (labourCtl db = new labourCtl()){
                Session["CreatePreviousURL"] = Convert.ToString(ControllerContext.HttpContext.Request.UrlReferrer);
                return(View());
            }
        }
示例#2
0
        public ActionResult Create(labourClass Obj_labour, string command)
        {
            using (labourCtl db = new labourCtl()){
                if (ModelState.IsValid)
                {
                    db.insert(Obj_labour);
                    if (command.ToLower().Trim() == "save")
                    {
                        string sesionval = Convert.ToString(Session["CreatePreviousURL"]);
                        if (!string.IsNullOrEmpty(sesionval))
                        {
                            Session.Remove("CreatePreviousURL");
                            return(Redirect(sesionval));
                        }
                        else
                        {
                            return(RedirectToAction("Index"));
                        }
                    }
                    else
                    {
                        ModelState.Clear();
                        return(View());
                    }
                }

                return(View(Obj_labour));
            }
        }
示例#3
0
 public ActionResult EditTableRowDelete(Int32 Labourid)
 {
     using (labourCtl db = new labourCtl()){
         db.delete(Labourid);
         return(RedirectToAction("EditTable"));
     }
 }
示例#4
0
 public ActionResult Delete(Int32 Labourid)
 {
     using (labourCtl db = new labourCtl()){
         db.delete(Labourid);
         return(RedirectToAction("Index"));
     }
 }
示例#5
0
 public ActionResult Edit(Int32 Labourid)
 {
     using (labourCtl db = new labourCtl()){
         labourClass obj_labour = db.selectById(Labourid);
         Session["EditPreviousURL"] = Convert.ToString(ControllerContext.HttpContext.Request.UrlReferrer);
         return(View(obj_labour));
     }
 }
示例#6
0
 public ActionResult EditTableRowsDelete(string records)
 {
     using (labourCtl db = new labourCtl()){
         foreach (string id in records.Trim(',').Split(','))
         {
             if (!string.IsNullOrEmpty(id.Trim()))
             {
                 db.delete(Convert.ToInt32(id));
             }
         }
         return(View());
     }
 }
示例#7
0
 public ActionResult Edit(labourClass Obj_labour)
 {
     using (labourCtl db = new labourCtl()){
         if (ModelState.IsValid)
         {
             db.update(Obj_labour);
             string sesionval = Convert.ToString(Session["EditPreviousURL"]);
             if (!string.IsNullOrEmpty(sesionval))
             {
                 Session.Remove("EditPreviousURL");
                 return(Redirect(sesionval));
             }
             else
             {
                 return(RedirectToAction("Index"));
             }
         }
         return(View(Obj_labour));
     }
 }
示例#8
0
 public ActionResult SaveRecords(FormCollection model)
 {
     if (ModelState.IsValid)
     {
         using (labourCtl db = new labourCtl()){
             var LabouridArray   = model.GetValues("item.Labourid");
             var LabournameArray = model.GetValues("item.Labourname");
             for (Int32 i = 0; i < LabouridArray.Length; i++)
             {
                 labourClass obj_update = db.selectById(Convert.ToInt32(LabouridArray[i]));
                 if (!string.IsNullOrEmpty(Convert.ToString(LabouridArray)))
                 {
                     obj_update.Labourid = Convert.ToInt32(LabouridArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(LabournameArray)))
                 {
                     obj_update.Labourname = Convert.ToString(LabournameArray[i]);
                 }
                 db.update(obj_update);
             }
         }
     }
     return(RedirectToAction("EditTable"));
 }
示例#9
0
 public ActionResult Details(Int32 Labourid)
 {
     using (labourCtl db = new labourCtl()){ labourClass obj_labour = db.selectById(Labourid);
                                             return(View(obj_labour)); }
 }
示例#10
0
 public ActionResult EditTableLazyLoading(Int64 StartIndex, Int64 EndIndex, string Search)
 {
     using (labourCtl db = new labourCtl()){
         return(PartialView(db.selectIndexLazyLoading(StartIndex, EndIndex, Search)));
     }
 }
示例#11
0
 public Int32 EditTablePagingCount(Int64 PageSize, Int64 PageIndex, string Search)
 {
     using (labourCtl db = new labourCtl()){ return(db.selectIndexPagingCount(PageSize, PageIndex, Search)); }
 }
示例#12
0
 public ActionResult EditTablePaging(Int64 PageSize, Int64 PageIndex, string Search)
 {
     using (labourCtl db = new labourCtl()){ return(PartialView(db.selectIndexPaging(PageSize, PageIndex, Search))); }
 }