Exemple #1
0
        public ActionResult SaveDateEdit()
        {
            string            strRet;
            uls_dbDataContext db = new uls_dbDataContext();

            string strDt        = Request.Form["hdnSvcDate"];
            string strTotCrews  = Request.Form["ddlEditCrews"];
            string strSvcsSched = Request.Form["hdnSvcsSched"];
            bool   blnAvail     = Request.Form["chkAvail"] == "on" ? true : false;

            try
            {
                svc_schedule_day ssd;

                ssd           = db.svc_schedule_days.Single(s => s.svc_sched_dt == Convert.ToDateTime(strDt));
                ssd.available = blnAvail;
                ssd.tot_crews = Convert.ToInt32(strTotCrews);

                db.SubmitChanges();

                strRet = "Success";
            }
            catch (Exception ex)
            {
                string msg = ex.Message;

                strRet = msg;
            }
            finally
            {
                db.Dispose();
            }

            return(Content(strRet));
        }
Exemple #2
0
        public ActionResult EditAssign(Nullable <int> id, FormCollection formValues)
        {
            // this method used just for delete now
            uls_dbDataContext db    = new uls_dbDataContext();
            electronics_assgn elecA = new electronics_assgn();

            try
            {
                string strOper = formValues.GetValues("oper")[0];


                string strElectID = formValues.GetValues("id")[0];
//                string strQualID = formValues.GetValues("strQualID")[0];

                if (strOper == "del")
                {
                    elecA = db.electronics_assgns.Single(e => e.assign_id == Convert.ToInt32(strElectID));

                    db.electronics_assgns.DeleteOnSubmit(elecA);


                    db.SubmitChanges();
                }

                return(Content("Success"));
            }
            catch (Exception ex)
            {
                string strErr = ex.Message;
                return(Content(strErr));
            }
        }
Exemple #3
0
        public ActionResult SaveAdminForemen()
        {
            uls_dbDataContext db = new uls_dbDataContext();

            string strName = Request.Form["txtForemanName"];

            try
            {
                svc_foreman svcf;

                svcf                = new svc_foreman();
                svcf.active_flg     = true;
                svcf.svc_foreman_nm = strName;
                db.svc_foremans.InsertOnSubmit(svcf);

                db.SubmitChanges();

                int intNewID = svcf.svc_foreman_id;

                return(Content("Success" + "," + Convert.ToString(intNewID)));
            }
            catch (Exception ex)
            {
                string strErr = ex.Message;
                return(Content("Failure"));
            }
        }
Exemple #4
0
        public ActionResult SvcDaysGridData(string sidx, string sord, int page, int rows)
        {
            string fromDate = Request.QueryString["fromDate"];
            string todate   = Request.QueryString["toDate"];

            uls_dbDataContext ulsdb_dc = new uls_dbDataContext();
            var svc_days = ulsdb_dc.GetGridSvcDays(sidx, sord, fromDate, todate);

            var dataJson = new
            {
                total    =
                    page = 1,
                records  = 10000,
                rows     = (from s in svc_days
                            select new
                {
                    id = String.Format("{0:MMddyyyy}", s.svc_sched_dt),
                    cell = new string[] {
                        String.Format("{0:MM/dd/yyyy}", s.svc_sched_dt),
                        String.Format("{0:dddd}", s.svc_sched_dt),
                        Convert.ToString(s.tot_crews),
                        Convert.ToString(s.cur_svcs_sched),
                        Convert.ToString(s.available)
                    }
                }).ToArray()
            };

            return(Json(dataJson, JsonRequestBehavior.AllowGet));
        }
Exemple #5
0
        public ActionResult ResetPassword()
        {
            string            strRet;
            uls_dbDataContext db = new uls_dbDataContext();

            string strUser = Request.Form["hdnID"];
            string strPwd  = Request.Form["txtPassword"];

            try
            {
                string strRandomPwd = Membership.Provider.ResetPassword(strUser, null);

                Membership.Provider.ChangePassword(strUser, strRandomPwd, strPwd);

                strRet = "Success";
            }
            catch (Exception ex)
            {
                string msg = ex.Message;

                strRet = msg;
            }
            finally
            {
                db.Dispose();
            }

            return(Content(strRet));
        }
Exemple #6
0
        public ActionResult AddUser()
        {
            string            strRet;
            uls_dbDataContext db = new uls_dbDataContext();

            string strUser = Request.Form["txtUserID"];
            string strPwd  = Request.Form["txtPassword"];

            try
            {
                Membership.CreateUser(strUser, strPwd, "*****@*****.**");

                strRet = "Success";
            }
            catch (Exception ex)
            {
                string msg = ex.Message;

                strRet = msg;
            }
            finally
            {
                db.Dispose();
            }

            return(Content(strRet));
        }
Exemple #7
0
        public ActionResult SaveAppt()
        {
            string            strRet;
            uls_dbDataContext db = new uls_dbDataContext();

            string strID      = Request.Form["hdnSvcid"];
            string strComment = Request.Form["txtComments"];

            try
            {
                svc_appointment sa;

                sa          = db.svc_appointments.Single(s => s.svc_id == Convert.ToInt32(strID));
                sa.comments = strComment;

                db.SubmitChanges();

                strRet = "Success";
            }
            catch (Exception ex)
            {
                string msg = ex.Message;

                strRet = msg;
            }
            finally
            {
                db.Dispose();
            }

            return(Content(strRet));
        }
Exemple #8
0
        public ActionResult Edit(Nullable <int> id, FormCollection formValues)
        {
            // this method used just for delete now
            uls_dbDataContext db = new uls_dbDataContext();

            try
            {
                string strOper          = formValues.GetValues("oper")[0];
                string strElectrinicsID = formValues.GetValues("intElectronicsID")[0];

                electronic equip;

                if (strOper == "del")
                {
                    equip = db.electronics.Single(e => e.electronics_id == strElectrinicsID);

                    db.electronics.DeleteOnSubmit(equip);
                }

                db.SubmitChanges();


                return(Content("Success"));
            }
            catch (Exception ex)
            {
                string strErr = ex.Message;
                return(Content(strErr));
            }
        }
Exemple #9
0
        public ActionResult GetNewCrewNum()
        {
            uls_dbDataContext db = new uls_dbDataContext();

            int intMax = db.GetMaxCrewNum();

            return(Content((intMax + 1).ToString()));
        }
Exemple #10
0
        public ActionResult GetSvcForemen()
        {
            uls_dbDataContext db = new uls_dbDataContext();

            var list = db.GetSvcForeman();

            ViewData["SvcForemen"] = list;

            return(PartialView("SvcForemen", ViewData));
        }
        public ActionResult SaveAdmin()
        {
            string strRet;

            uls_dbDataContext db = new uls_dbDataContext();

            string adminType = Request.Form["hdnAdminType"];
            string strID;
            string strDescr     = Request.Form["txtDescription"];
            string strCompany   = Request.Form["ddlAdminCompany"];
            string strOperation = Request.Form["hdnAdminOper"];

            try
            {
                if (adminType == "AdminCertifications")
                {
                    qualification qual;

                    if (strOperation == "Add")
                    {
                        strID = Request.Form["txtID"];

                        qual             = new qualification();
                        qual.qualID      = strID;
                        qual.qualDesc    = strDescr;
                        qual.qualCompany = strCompany;


                        db.qualifications.InsertOnSubmit(qual);
                    }
                    else
                    {
                        strID         = Request.Form["hdnAdminID"];
                        qual          = db.qualifications.Single(q => q.qualID == strID);
                        qual.qualDesc = strDescr;
                    }
                }

                db.SubmitChanges();

                strRet = "Success";
            }
            catch (Exception ex)
            {
                string msg = ex.Message;

                strRet = msg;
            }
            finally
            {
                db.Dispose();
            }

            return(Content(strRet));
        }
Exemple #12
0
        public ActionResult Directions()
        {
            uls_dbDataContext ulsdb_dc = new uls_dbDataContext();

            ViewData["DefaultFroms"] = ulsdb_dc.GetDefaultFroms();

            ViewData["OfficeLocations"] = new SelectList(ulsdb_dc.GetOfficeLocations(), "location_address", "location_name");

//            ViewData["Title"] = "Directions";

            return(View());
        }
        public ActionResult SaveWRAdmin()
        {
            string strRet;

            uls_dbDataContext db = new uls_dbDataContext();

            string strWRComment = Request.Form["txtWarnComments"];
            string strOperation = Request.Form["hdnWROper"];
            string strType      = Request.Form["hdnWRType"];
            string strDate      = Request.Form["dtWarning"];
            string strEmpID     = Request.Form["hdnWREmpID"];

            try
            {
                empWarnRecognition eWR;

                if (strOperation == "Add")
                {
                    eWR = new empWarnRecognition();
                    eWR.empQualWarnRecogDate = Convert.ToDateTime(strDate);
                    eWR.comment         = strWRComment;
                    eWR.employeeID      = Convert.ToInt32(strEmpID);
                    eWR.empWarnRecogFlg = Convert.ToChar(strType);


                    db.empWarnRecognitions.InsertOnSubmit(eWR);
                }
                else
                {
                    string strId = Request.Form["hdnEmailAdminID"];

                    eWR = db.empWarnRecognitions.Single(w => w.employeeID == Convert.ToInt32(strEmpID) && w.empQualWarnRecogDate == Convert.ToDateTime(strDate) && w.empWarnRecogFlg == Convert.ToChar(strType));

                    eWR.comment = strWRComment;
                }

                db.SubmitChanges();

                strRet = "Success";
            }
            catch (Exception ex)
            {
                string msg = ex.Message;

                strRet = msg;
            }
            finally
            {
                db.Dispose();
            }

            return(Content(strRet));
        }
Exemple #14
0
        public ActionResult Electronics(string div)
        {
            if (div != null)
            {
                uls_dbDataContext ulsdb = new uls_dbDataContext();

                if (div == "1")
                {
                    default_div dd = ulsdb.default_divs.Single(e => e.user_id == User.Identity.Name);
                    if (dd.div == "ULS-PA2" || dd.div == "ULS-PA-RO")
                    {
                        Session["division"] = "ULS-PA";
                    }
                    else
                    {
                        Session["division"] = dd.div;
                    }

                    dd.lst_log_on = DateTime.Now;
                    ulsdb.SubmitChanges();

                    //                    Session["division"] = (from dd in ulsdb.default_divs
                    //                                where dd.user_id == User.Identity.Name
                    //                                select dd.div).SingleOrDefault<System.String>();

                    //                    Session["default_division"] = Session["division"];
                    Session["default_division"] = dd.div;
                }
                else if (div == "2") // coming from report viewer page
                {
                    //                    m_strDiv = Convert.ToString(Session["division"]);
                }
                else
                {
                    Session["division"] = div;
                }

                //                Session["division"] = m_strDiv;
                ViewData["division"]         = Session["division"];
                ViewData["default_division"] = Session["default_division"];
            }

            if (Convert.ToString(Session["default_division"]) == "" || Session["default_division"] == null)
            {
                return(RedirectToAction("InvalidUser", "EquipTrack"));
            }
            else
            {
                return(View());
            }
        }
Exemple #15
0
        public ActionResult AddSvcDates()
        {
            string            strRet;
            uls_dbDataContext db = new uls_dbDataContext();

            string strDtFrom   = Request.Form["dtDaysFrom"];
            string strDtTo     = Request.Form["dtDaysTo"];
            string strTotCrews = Request.Form["ddlCrews"];

            int intDaysToAdd = Convert.ToDateTime(strDtTo).Subtract(Convert.ToDateTime(strDtFrom)).Days;

            try
            {
                svc_schedule_day ssd;
                svc_schedule_day ssd2;

                int count;

                for (count = 0; count < intDaysToAdd; count = count + 1)
                {
                    ssd2 = db.svc_schedule_days.SingleOrDefault(s => s.svc_sched_dt == Convert.ToDateTime(strDtFrom).AddDays(count));
                    if (ssd2 != null)
                    {
                        continue;
                    }
                    ssd = new svc_schedule_day();
                    ssd.svc_sched_dt   = Convert.ToDateTime(strDtFrom).AddDays(count);
                    ssd.tot_crews      = Convert.ToInt32(strTotCrews);
                    ssd.available      = String.Format("{0:ddd}", ssd.svc_sched_dt) == "Sat" || String.Format("{0:ddd}", ssd.svc_sched_dt) == "Sun" ? false : true;
                    ssd.cur_svcs_sched = 0;
                    db.svc_schedule_days.InsertOnSubmit(ssd);
                }

                db.SubmitChanges();

                strRet = "Success";
            }
            catch (Exception ex)
            {
                string msg = ex.Message;

                strRet = msg;
            }
            finally
            {
                db.Dispose();
            }

            return(Content(strRet));
        }
Exemple #16
0
        public ActionResult SelectSvcDate()
        {
            string        strPastDate = "";
            string        strDay      = "";
            string        strDate     = "";
            string        strSpaces   = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
            List <string> availDts    = new List <string>();

            uls_dbDataContext ulsdb_dc = new uls_dbDataContext();

            if (Session["PastServiceDate"] != null)
            {
                strPastDate = Convert.ToString(Session["PastServiceDate"]);
                DateTime pastDt = Convert.ToDateTime(strPastDate);
                strDay = String.Format("{0:ddd}", pastDt).ToUpper();
            }

            if (strPastDate.Length > 0)
            {
                availDts.Add(strDay + Server.HtmlDecode(strSpaces) + strPastDate);
            }
            else
            {
                IEnumerable <DateTime> availDates = ulsdb_dc.GetAvailSvcDates();

                foreach (DateTime dt in availDates)
                {
                    strDay  = String.Format("{0:ddd}", dt).ToUpper();
                    strDate = String.Format("{0:MM/dd/yyyy}", dt);
                    availDts.Add(strDay + Server.HtmlDecode(strSpaces) + strDate);
                }
            }



            ViewData["AvailableDates"] = new SelectList(availDts);
            ViewData["SaveResultMsg"]  = Session["SaveResultMsg"];

            svc_contact sc = ulsdb_dc.svc_contacts.Single(s => s.contact_id == 1);

            ViewData["ContactName"]  = sc.contact_name;
            ViewData["ContactPhone"] = sc.contact_number;
            ViewData["ContactEmail"] = sc.contact_email;
            ViewData["NotifyEmail1"] = sc.notify1_email;
            ViewData["NotifyEmail2"] = sc.notify2_email;
            ViewData["NotifyEmail3"] = sc.notify3_email;

            return(View());
        }
Exemple #17
0
        public ActionResult SvcAdmin()
        {
            uls_dbDataContext db = new uls_dbDataContext();
            svc_contact       sc = db.svc_contacts.Single(s => s.contact_id == 1);

            ViewData["ContactName"]  = sc.contact_name;
            ViewData["ContactPhone"] = sc.contact_number;
            ViewData["ContactEmail"] = sc.contact_email;
            ViewData["NotifyEmail1"] = sc.notify1_email;
            ViewData["NotifyEmail2"] = sc.notify2_email;
            ViewData["NotifyEmail3"] = sc.notify3_email;


            return(View());
        }
        public ActionResult SaveEmailAdmin()
        {
            string strRet;

            uls_dbDataContext db = new uls_dbDataContext();

            string adminType    = Request.Form["hdnEmailAdminType"];
            string strEmail     = Request.Form["txtAdminEmail"];
            string strOperation = Request.Form["hdnEmailAdminOper"];

            try
            {
                if (adminType == "AdminEmailNotifications")
                {
                    qual_notification qual;

                    if (strOperation == "Add")
                    {
                        qual       = new qual_notification();
                        qual.email = strEmail;

                        db.qual_notifications.InsertOnSubmit(qual);
                    }
                    else
                    {
                        string strId = Request.Form["hdnEmailAdminID"];
                        qual       = db.qual_notifications.Single(q => q.id == Convert.ToInt32(strId));
                        qual.email = strEmail;
                    }
                }

                db.SubmitChanges();

                strRet = "Success";
            }
            catch (Exception ex)
            {
                string msg = ex.Message;

                strRet = msg;
            }
            finally
            {
                db.Dispose();
            }

            return(Content(strRet));
        }
Exemple #19
0
        public ActionResult DeleteUser(string id)
        {
            uls_dbDataContext db = new uls_dbDataContext();
            string            strRet;

            try
            {
                Membership.DeleteUser(id);
                strRet = "Success";
            }
            catch (Exception ex)
            {
                string strEx = ex.Message;
                strRet = strEx;
            }

            return(Content(strRet));
        }
        public ActionResult EditQual(Nullable <int> id, FormCollection formValues)
        {
            // this method used just for delete now
            uls_dbDataContext db   = new uls_dbDataContext();
            Qualifications    qual = new Qualifications();

            try
            {
                string strOper = formValues.GetValues("oper")[0];

//                string[] strParms = formValues.GetValues("strData")[0].Split('|');

//                string strEmployeeID = strParms[0];
//                string strQualID = strParms[1];

                string strEmployeeID = formValues.GetValues("intEmployeeID")[0];
                string strQualID     = formValues.GetValues("strQualID")[0];

                empQual empQ;

                if (strOper == "del")
                {
                    string[] arrQualids;

                    arrQualids = strQualID.Split(',');

                    foreach (string strQid in arrQualids)
                    {
                        empQ = db.empQuals.Single(e => e.employeeId == Convert.ToInt32(strEmployeeID) && e.qualId == strQid);

                        db.empQuals.DeleteOnSubmit(empQ);
                    }

                    db.SubmitChanges();
                }

                return(Content("Success"));
            }
            catch (Exception ex)
            {
                string strErr = ex.Message;
                return(Content(strErr));
            }
        }
        public ActionResult Edit(Nullable <int> id, FormCollection formValues)
        {
            // this method used just for delete now
            uls_dbDataContext db   = new uls_dbDataContext();
            Qualifications    qual = new Qualifications();

            int intQualCnt = 0;

            try
            {
                string strOper       = formValues.GetValues("oper")[0];
                string strEmployeeID = formValues.GetValues("id")[0];

                employee emp;

                if (strOper == "del")
                {
                    intQualCnt = qual.GetQualCount(strEmployeeID);

                    if (intQualCnt == 0)
                    {
                        emp = db.employees.Single(e => e.employeeID == Convert.ToInt32(strEmployeeID));

                        db.employees.DeleteOnSubmit(emp);

                        db.SubmitChanges();
                    }
                }

                if (intQualCnt == 0)
                {
                    return(Content("Success"));
                }
                else
                {
                    return(Content("Failure to delete- make sure qualifications for this employee are deleted first!"));
                }
            }
            catch (Exception ex)
            {
                string strErr = ex.Message;
                return(Content(strErr));
            }
        }
Exemple #22
0
        public ActionResult DeleteElectronicsMake(string id)
        {
            uls_dbDataContext db = new uls_dbDataContext();
            string            strRet;

            try
            {
                electronics_make_avt make = db.electronics_make_avts.Single(et => et.make_id == Convert.ToInt32(id));
                db.electronics_make_avts.DeleteOnSubmit(make);
                db.SubmitChanges();
                strRet = "Success";
            }
            catch (Exception)
            {
                strRet = "Failure";
            }

            return(Content(strRet));
        }
        public ActionResult DeleteAdminEmail(string id)
        {
            uls_dbDataContext db = new uls_dbDataContext();
            string            strRet;

            try
            {
                qual_notification qual = db.qual_notifications.Single(q => q.id == Convert.ToInt32(id));
                db.qual_notifications.DeleteOnSubmit(qual);
                db.SubmitChanges();
                strRet = "Success";
            }
            catch (Exception)
            {
                strRet = "Failure";
            }

            return(Content(strRet));
        }
Exemple #24
0
        public ActionResult SvcAppointmentsGridData(string sidx, string sord, int page, int rows)
        {
            string fromDate = Request.QueryString["fromDate"];
            string todate   = Request.QueryString["toDate"];

            uls_dbDataContext ulsdb_dc = new uls_dbDataContext();
            var svc_days = ulsdb_dc.GetGridSvcAppointments(sidx, sord, fromDate, todate);

            var dataJson = new
            {
                total    =
                    page = 1,
                records  = 10000,
                rows     = (from s in svc_days
                            select new
                {
                    id = Convert.ToString(s.svc_id),
                    cell = new string[] {
                        String.Format("{0:MM/dd/yyyy}", s.svc_date),
                        String.Format("{0:dddd}", s.svc_date),
                        Convert.ToString(s.street_address),
                        Convert.ToString(s.last_name),
//                            String.Format("{0:(###) ###-####}", s.home_phone),
                        Regex.Replace(s.home_phone, @"(\d{3})(\d{3})(\d{4})", "$1-$2-$3"),
                        Convert.ToString(s.crew),
                        Convert.ToString(s.svc_id),
                        s.first_name,
                        s.city,
                        s.state,
                        s.zip,
//                            String.Format("{0:(###) ###-####}", s.other_phone),
                        Regex.Replace(s.other_phone, @"(\d{3})(\d{3})(\d{4})", "$1-$2-$3"),
                        s.email,
                        Convert.ToString(s.reschedule),
                        s.comments
                    }
                }).ToArray()
            };

            return(Json(dataJson, JsonRequestBehavior.AllowGet));
        }
Exemple #25
0
        public ActionResult SaveContact()
        {
            string            strRet;
            uls_dbDataContext db = new uls_dbDataContext();

            string strName         = Request.Form["txtName"];
            string strPhone        = Request.Form["txtPhone"];
            string strEmail        = Request.Form["txtEmail"];
            string strEmailNotify1 = Request.Form["txtEmailNotif1"];
            string strEmailNotify2 = Request.Form["txtEmailNotif2"];
            string strEmailNotify3 = Request.Form["txtEmailNotif3"];

            try
            {
                svc_contact sc = db.svc_contacts.Single(s => s.contact_id == 1);

                sc.contact_name   = strName;
                sc.contact_number = strPhone;
                sc.contact_email  = strEmail;
                sc.notify1_email  = strEmailNotify1;
                sc.notify2_email  = strEmailNotify2;
                sc.notify3_email  = strEmailNotify3;

                db.SubmitChanges();

                strRet = "Success";
            }
            catch (Exception ex)
            {
                string msg = ex.Message;

                strRet = msg;
            }
            finally
            {
                db.Dispose();
            }

            return(Content(strRet));
        }
        public ActionResult DeleteWR(string id, string type, string date)
        {
            uls_dbDataContext db = new uls_dbDataContext();
            string            strRet;

            try
            {
                empWarnRecognition eWR = db.empWarnRecognitions.Single(w => w.employeeID == Convert.ToInt32(id) && w.empQualWarnRecogDate == Convert.ToDateTime(date) && w.empWarnRecogFlg == Convert.ToChar(type));

                db.empWarnRecognitions.DeleteOnSubmit(eWR);
                db.SubmitChanges();
                strRet = "Success";
            }
            catch (Exception ex)
            {
                string strEX = ex.Message;

                strRet = "Failure";
            }

            return(Content(strRet));
        }
Exemple #27
0
        //
        // GET: /Service/

        public ActionResult Index()
        {
            uls_dbDataContext db = new uls_dbDataContext();
            svc_contact       sc = db.svc_contacts.Single(s => s.contact_id == 1);

            ViewData["ContactName"]  = sc.contact_name;
            ViewData["ContactPhone"] = sc.contact_number;
            ViewData["ContactEmail"] = sc.contact_email;

            Session["SaveResultMsg"]  = "";
            Session["SaveResultName"] = "";

            if (Session["emailVal"] == null)
            {
                ViewData["emailVal"] = "Yes";
            }
            else
            {
                ViewData["emailVal"] = Session["emailVal"];
            }

            return(View());
        }
Exemple #28
0
        public ActionResult GetAdminForemen(string sidx, string sord, int page, int rows)
        {
            uls_dbDataContext db = new uls_dbDataContext();

            var forem = db.GetGridSvcForemen();

            var dataJson = new
            {
                total    =
                    page = 1,
                records  = 10000,
                rows     = (from f in forem
                            select new
                {
                    id = f.svc_foreman_id,
                    cell = new string[] {
                        f.svc_foreman_nm
                    }
                }).ToArray()
            };

            return(Json(dataJson, JsonRequestBehavior.AllowGet));
        }
Exemple #29
0
        public ActionResult DeleteService(string id)
        {
            uls_dbDataContext db = new uls_dbDataContext();
            string            strRet;

            try
            {
                svc_appointment svc = db.svc_appointments.Single(s => s.svc_id == Convert.ToInt32(id));

                svc_schedule_day svcd = db.svc_schedule_days.Single(d => d.svc_sched_dt == Convert.ToDateTime(svc.svc_date));

                svcd.cur_svcs_sched = svcd.cur_svcs_sched > 0 ? svcd.cur_svcs_sched - 1 : 0;

                db.svc_appointments.DeleteOnSubmit(svc);
                db.SubmitChanges();
                strRet = "Success";
            }
            catch (Exception ex)
            {
                strRet = "Failure: " + ex.Message;
            }

            return(Content(strRet));
        }
Exemple #30
0
        public ActionResult SaveCrewEdit()
        {
            uls_dbDataContext db = new uls_dbDataContext();

            string strOper      = Request.Form["hdnCrewOper"];
            string strCrewNum   = Request.Form["hdnCrewNum"];
            string strForemanID = Request.Form["ddlSvcFormen"];

            try
            {
                svc_crew svcc;

                if (strOper == "Add")
                {
                    svcc          = new svc_crew();
                    svcc.crew_num = Convert.ToInt32(strCrewNum);
                    db.svc_crews.InsertOnSubmit(svcc);
                }
                else
                {
                    svcc = db.svc_crews.Single(c => c.crew_num == Convert.ToInt32(strCrewNum));
                }


                svcc.svc_foreman_id = Convert.ToInt32(strForemanID);

                db.SubmitChanges();

                return(Content("Success"));
            }
            catch (Exception ex)
            {
                string strErr = ex.Message;
                return(Content("Failure: " + strErr));
            }
        }