コード例 #1
0
        public DataReturn SaveAttachmentInJobFile(JobFileClass model)
        {
            DataReturn obj = new DataReturn();

            try
            {
                JobFile fj = db.JobFile.SingleOrDefault(m => m.JobKey == model.JobKey && m.DocumentTypeKey == model.DocumentTypeKey);
                if (fj == null)
                {
                }
                else
                {
                    db.JobFile.Remove(fj);
                    db.SaveChanges();
                    db = new RCSdbEntities();
                }
                JobFile invoice = new JobFile();
                Job     job     = db.Job.Find(model.JobKey);
                invoice.FileKey         = Guid.NewGuid();
                invoice.JobKey          = (Guid)model.JobKey;
                invoice.DocumentTypeKey = model.DocumentTypeKey;
                //invoice.AddedBy = GlobalClass.LoginUser.PersonnelKey;
                invoice.AddedOn = System.DateTime.Now;
                if (string.IsNullOrEmpty(model.Comment))
                {
                    invoice.Comment = "--";
                }
                else
                {
                    invoice.Comment = model.Comment;
                }
                invoice.Title   = model.Title;
                invoice.Remarks = db.DocumentType.Find(model.DocumentTypeKey).TName + " is Added by " + GlobalClass.LoginUser.Cname;

                invoice.FileContent = model.FileContent;
                invoice.FileType    = model.FileType;
                invoice.IsDelete    = false;
                invoice.IsFileNew   = true;
                db.JobFile.Add(invoice);
                db.SaveChanges();

                obj.flag = 1;
                obj.mess = "Data has been updated successfully.";
            }
            catch (Exception ex)
            {
                obj.mess = ex.ToString();
                obj.flag = 0;
            }
            obj.key = model.JobKey;
            return(obj);
        }
コード例 #2
0
        internal DataReturn SaveEstimateRemarks(PreviewSalesInvoiceClass model)
        {
            DataReturn obj = new DataReturn();

            try
            {
                JobSalesInvoiceEstimateStatus st = new JobSalesInvoiceEstimateStatus();
                st.Pkey        = Guid.NewGuid();
                st.InvoiceKey  = model.EstimateObj.InvoiceKey;
                st.CreatedDate = System.DateTime.Now;
                st.CustomerKey = GlobalClass.LoginUser.CustomerKey;
                st.JobKey      = model.EstimateObj.JobKey;
                st.Remark      = model.EstimateObj.Remark;
                if (model.EstimateStatus == 1)
                {
                    st.Accept   = true;
                    st.Decline  = false;
                    st.Resubmit = false;
                    st.Remark   = GlobalClass.LoginUser.Cname + " accepted this quote. " + st.Remark;
                }
                if (model.EstimateStatus == 2)
                {
                    st.Accept   = false;
                    st.Decline  = true;
                    st.Resubmit = false;
                }
                if (model.EstimateStatus == 3)
                {
                    st.Accept   = false;
                    st.Decline  = false;
                    st.Resubmit = true;
                }
                st.IsSeen = false;
                db.JobSalesInvoiceEstimateStatus.Add(st);
                db.SaveChanges();
                obj.key  = model.EstimateObj.InvoiceKey;
                obj.flag = 1;
                obj.mess = "Data has been Saved";
            }
            catch (Exception ex)
            {
                obj.flag = 0;
                obj.mess = ex.ToString();
            }
            return(obj);
        }
コード例 #3
0
        public ActionResult UpdateJobStatus(Guid JobStatusKey, Guid JobKey)
        {
            JsonResult result = new JsonResult();
            int        x      = 0;

            try
            {
                Job job = db.Job.Find(JobKey);
                job.JobStatusKey = JobStatusKey;
                db.SaveChanges();
                x = 1;
            }
            catch (Exception ex)
            {
                string sgh = ex.ToString();
            }
            result.Data = x;
            result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            return(result);
        }
コード例 #4
0
        public ActionResult Delete(Guid id)
        {
            if (GlobalClass.SystemSession)
            {
                var Jobrq = db.JobRequestAttachments.Where(f => f.RequestKey == id).ToList();
                db.JobRequestAttachments.RemoveRange(Jobrq);
                db.SaveChanges();
                db = new RCSdbEntities();
                JobRequest obj = db.JobRequest.Find(id);
                db.JobRequest.Remove(obj);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            else
            {
                Exception e = new Exception("Sorry, your Session has Expired");
                return(View("Error", new HandleErrorInfo(e, "Home", "Logout")));
            }
        }
コード例 #5
0
        public DataReturn AddUserToLogin(CustomerLoginClass model)
        {
            DataReturn xx = new DataReturn();

            try
            {
                CustomerLogin obj = db.CustomerLogin.Find(model.UserKey);
                obj.Username = model.Username;
                obj.Password = model.Password;
                db.SaveChanges();

                GlobalClass.UserDetail = obj;
                xx.key  = model.ContactObj.CustomerKey;
                xx.mess = "Data is Saved Successfully";
                xx.flag = 1;
            }
            catch (Exception ex)
            {
                xx.mess = ex.Message.ToString();
                xx.flag = 0;
            }
            return(xx);
        }
コード例 #6
0
        internal DataReturn SaveMainData(JobRequestObject obj)
        {
            DataReturn model = new DataReturn();

            try
            {
                JobRequest _job = new JobRequest();
                _job.RequestKey     = Guid.NewGuid();
                _job.LocationKey    = obj.LocationKey;
                _job.CustomerKey    = GlobalClass.LoginUser.CustomerKey;
                _job.CContactKey    = obj.CContactKey;
                _job.TradeKey       = obj.TradeKey;
                _job.JobPriorityKey = obj.JobPriorityKey;
                _job.ServiceNeeded  = obj.ServiceNeeded;
                if (string.IsNullOrEmpty(obj.ServiceNeededByOrOn))
                {
                    _job.ServiceNeededByOrOn = "Service Needed by";
                }
                else
                {
                    _job.ServiceNeededByOrOn = obj.ServiceNeededByOrOn;
                }
                if (obj.DNEamount == null)
                {
                    _job.DNEamount = 0;
                }
                else
                {
                    _job.DNEamount = obj.DNEamount;
                }
                if (string.IsNullOrEmpty(obj.SpecialNote))
                {
                    _job.SpecialNote = "n/a";
                }
                else
                {
                    _job.SpecialNote = obj.SpecialNote;
                }
                _job.ServiceDate = obj.ServiceDate;
                if (string.IsNullOrEmpty(obj.ServiceByTime))
                {
                    _job.ServiceByTime = "--";
                }
                else
                {
                    _job.ServiceByTime = obj.ServiceByTime;
                }

                if (string.IsNullOrEmpty(obj.SVCLocationContact))
                {
                    _job.SVCLocationContact = "--";
                }
                else
                {
                    _job.SVCLocationContact = obj.SVCLocationContact;
                }

                if (string.IsNullOrEmpty(obj.SvcLocationContactPhone))
                {
                    _job.SvcLocationContactPhone = "--";
                }
                else
                {
                    _job.SvcLocationContactPhone = obj.SvcLocationContactPhone;
                }

                _job.EntryDatetime = DateTime.Now;
                _job.IsRequest     = true;
                _job.Isviewed      = false;
                db.JobRequest.Add(_job);
                db.SaveChanges();
                model.flag = 1;
                model.key  = _job.RequestKey;
                model.mess = "Data has been saved successfully.";
            }
            catch (Exception ex)
            {
                model.flag = 0;
                model.mess = ex.Message.ToString();
            }
            return(model);
        }