public ActionResult saveJobSiteDetails(PRJ01_Headers JobDetails)
        {
            JobDetails.CommID = (string)Session["CommID"];
            var result = ProjectDAL.saveJobStatus(JobDetails);

            if (result > 0)
            {
                Session["PRJID"]       = result;
                Session["JobStatusId"] = JobDetails.JobStatusId;
            }
            return(Json(result));
        }
Beispiel #2
0
        public static CustomerProfileViewModel getCustomerProfile(int id)
        {
            DataSet dataSet = SqlHelper.ExecuteDataset(_myConnection, CommandType.StoredProcedure,
                                                       "spATL_CRM_Cont_Profile", new SqlParameter("@ContId", id));

            CustomerProfileViewModel profile = new CustomerProfileViewModel();

            if (dataSet.Tables.Count > 0)
            {
                if (dataSet.Tables[0].Rows.Count > 0)
                {
                    var contact = dataSet.Tables[0].Rows;
                    profile.sal02_Contact                               = new SAL02_Contacts();
                    profile.sal02_Contact.SalContId                     = Convert.ToInt32(contact[0]["SalContId"]);
                    profile.sal02_Contact.SalContFirstName              = Common.ToTitleCase(contact[0]["SalContFirstName"].FormatTrim());
                    profile.sal02_Contact.SalContLastName               = Common.ToTitleCase(contact[0]["SalContLastName"].FormatTrim());
                    profile.sal02_Contact.SalContAddress                = contact[0]["SalContAddress"].FormatTrim();
                    profile.sal02_Contact.SalContCity                   = contact[0]["SalContCity"].FormatTrim();
                    profile.sal02_Contact.SalContState                  = contact[0]["SalContState"].FormatTrim();
                    profile.sal02_Contact.SalContZip                    = contact[0]["SalContZip"].FormatTrim();
                    profile.sal02_Contact.SalContPhone                  = contact[0]["SalContPhone"].FormatTrim();
                    profile.sal02_Contact.SalContPhoneExt               = contact[0]["SalContPhoneExt"].FormatTrim();
                    profile.sal02_Contact.SalContFax                    = contact[0]["SalContFax"].FormatTrim();
                    profile.sal02_Contact.SalContMobile                 = contact[0]["SalContMobile"].FormatTrim();
                    profile.sal02_Contact.SalContEmail                  = contact[0]["SalContEmail"].FormatTrim();
                    profile.sal02_Contact.SalContActiveFlag             = contact[0]["SalContActiveFlag"].FormatTrim() == "Y" ? "Yes" : "No";
                    profile.sal02_Contact.SAL01_Company                 = new SAL01_Company();
                    profile.sal02_Contact.SAL01_Company.SalCompName     = contact[0]["SalCompName"].FormatTrim();
                    profile.sal02_Contact.PRJ06_LedSource               = new PRJ06_LedSource();
                    profile.sal02_Contact.PRJ06_LedSource.LedSourceName = contact[0]["LedSourceName"].FormatTrim();
                    if (contact[0]["SalContDateCreated"] != DBNull.Value)
                    {
                        profile.sal02_Contact.SalContDateCreated = Convert.ToDateTime(contact[0]["SalContDateCreated"]);
                    }
                }
                profile.sal03_ResAppointments = new List <SAL03_ResAppointments>();
                if (dataSet.Tables[1].Rows.Count > 0)
                {
                    var schedule = dataSet.Tables[1].Rows;
                    for (int i = 0; i < schedule.Count; i++)
                    {
                        SAL03_ResAppointments objResAppointments = new SAL03_ResAppointments();
                        if (schedule[i]["SalApptStartDate"] != DBNull.Value)
                        {
                            objResAppointments.SalApptStartDate = schedule[i]["SalApptStartDate"].FormatTrim();
                        }
                        if (schedule[i]["SalApptStartTime"] != DBNull.Value)
                        {
                            objResAppointments.SalApptStartTime = AppointmentsDAL.getComboLookupValue("Setup40_Time", "Setup40TimeID", "Setup40Time", (schedule[i]["SalApptStartTime"]).FormatTrim());
                        }
                        profile.sal03_ResAppointments.Add(objResAppointments);
                    }
                }

                profile.prj01_Headers = new List <PRJ01_Headers>();
                if (dataSet.Tables[2].Rows.Count > 0)
                {
                    var projects = dataSet.Tables[2].Rows;
                    for (int i = 0; i < projects.Count; i++)
                    {
                        PRJ01_Headers objProjetcs = new PRJ01_Headers();
                        objProjetcs.PRJID = Convert.ToInt32(projects[i]["PRJID"]);
                        if (projects[i]["PRJDateActivated"] != DBNull.Value)
                        {
                            objProjetcs.PRJDateActivated = Convert.ToDateTime(projects[i]["PRJDateActivated"]);
                        }
                        objProjetcs.CommID      = projects[i]["CommID"].FormatTrim();
                        objProjetcs.JobNumber   = projects[i]["JobNumber"].FormatTrim();
                        objProjetcs.ProjectName = projects[i]["ProjectName"].FormatTrim();
                        objProjetcs.JobStatusId = projects[i]["JobStatusId"].FormatTrim();
                        objProjetcs.PRJNotes    = projects[i]["PRJNotes"].FormatTrim();
                        profile.prj01_Headers.Add(objProjetcs);
                    }
                }
                profile.projectNotes = new List <Notes>();
                if (dataSet.Tables[3].Rows.Count > 0)
                {
                    var notes = dataSet.Tables[3].Rows;
                    for (int i = 0; i < notes.Count; i++)
                    {
                        Notes objNotes = new Notes();
                        if (notes[i]["PRJDateEntered"] != DBNull.Value)
                        {
                            objNotes.PRJDateEntered = Convert.ToDateTime(notes[i]["PRJDateEntered"]);
                        }
                        objNotes.PRJNotes = notes[i]["PRJNotes"].FormatTrim();
                        profile.projectNotes.Add(objNotes);
                    }
                }
            }

            return(profile);
        }