Beispiel #1
0
        public PartialViewResult UpdateCustomerAddress(Int32 id)
        {
            SRLogRepository            objdata     = new SRLogRepository();
            SR_Log_DatabaseSQLEntities db          = new SR_Log_DatabaseSQLEntities();
            tblCustAddress             custaddress = db.tblCustAddresses.Where(x => x.Id == id).FirstOrDefault();
            CustomerAddressViewModel   address     = new CustomerAddressViewModel();

            address.Address1 = custaddress.Address1;
            address.Address2 = custaddress.Address2;
            address.City     = custaddress.City;
            address.State    = custaddress.State;
            address.ZipCode  = custaddress.ZipCode;
            address.Country  = custaddress.Country;
            address.SiteName = custaddress.SiteName;
            if (custaddress.IsPrimaryAddress == true)
            {
                address.IsPrimaryAddress = true;
            }
            else
            {
                address.IsPrimaryAddress = false;
            }
            //address.IsPrimaryAddress = custaddress.IsPrimaryAddress;
            address.ProjectManagerList = objdata.GetGroupUser();
            address.ProjectManager     = custaddress.ProjectManager;
            address.Id         = custaddress.Id;
            address.CustomerId = custaddress.CustomerId;

            ViewBag.Adddisable        = false;
            ViewBag.CustomerId        = custaddress.CustomerId;
            ViewBag.CustomerAddressId = custaddress.Id;
            return(PartialView("CreateCustomerAddress", address));
        }
Beispiel #2
0
        public PartialViewResult CreateCustomerAddress(int customerid)
        {
            CustomerAddressViewModel custaddress = new CustomerAddressViewModel();
            SRLogRepository          objdata     = new SRLogRepository();

            custaddress.CustomerId         = customerid;
            ViewBag.CustomerId             = customerid;
            ViewBag.CustomerAddressId      = 0;
            custaddress.IsPrimaryAddress   = false;
            custaddress.ProjectManagerList = objdata.GetGroupUser();
            return(PartialView(custaddress));
        }
        public ActionResult EditQuote(string id)
        {
            SRLogRepository    objdata = new SRLogRepository();
            QuoteLogRepository _repos  = new QuoteLogRepository();
            int QuoteId = Convert.ToInt32(id);

            QuoteLogViewModel objcre = _repos.GetQuoteRecords(QuoteId);

            objcre.CustomerList   = objdata.GetCustomer();
            objcre.GroupUsersList = objdata.GetGroupUser();
            bool bExistEstimator = false;

            foreach (var i in objcre.GroupUsersList)
            {
                if (i.UserName == objcre.Estimator)
                {
                    bExistEstimator = true;
                }
            }
            if (bExistEstimator == false)
            {
                tblGroupUser g = new tblGroupUser();
                g.UserName   = objcre.Estimator;
                g.Userid     = objcre.Estimator;
                g.Group_Name = "";

                objcre.GroupUsersList.Add(g);
            }
            objcre.emailids = _repos.GetEmailInfo();

            ViewBag.UpdateDisable = false;
            if (Convert.ToString(Session["SR_Log_ReadOnly"]) == "True" && Convert.ToString(Session["Bid_Log_ReadOnly"]) == "True")
            {
                ViewBag.UpdateDisable = true;
            }
            objcre.Id       = QuoteId;
            ViewBag.UId     = objcre.UID;
            ViewBag.QuoteId = objcre.Id;
            return(View("Create", objcre));
        }
        public ActionResult Create()
        {
            QuoteLogRepository _mainrepo = new QuoteLogRepository();
            QuoteLogViewModel  objcre    = new QuoteLogViewModel();
            // QuoteLogRepository objdata = new QuoteLogRepository();
            SRLogRepository objdata = new SRLogRepository();

            objcre.CustomerList   = objdata.GetCustomer();
            objcre.GroupUsersList = objdata.GetGroupUser();
            objcre.emailids       = _mainrepo.GetEmailInfo();

            ViewBag.UpdateDisable = false;



            objcre.Id = 0;

            if (Convert.ToString(Session["SR_Log_ReadOnly"]) == "True" && Convert.ToString(Session["Bid_Log_ReadOnly"]) == "True")
            {
                ViewBag.UpdateDisable = true;
            }

            return(View(objcre));
        }
        public ActionResult Create(QuoteLogViewModel model, FormCollection form)
        {
            QuoteLogRepository _repo   = new QuoteLogRepository();
            SRLogRepository    objdata = new SRLogRepository();

            ModelState.Remove("Id");

            if (ModelState.IsValid)
            {
                SR_Log_DatabaseSQLEntities objdb1 = new SR_Log_DatabaseSQLEntities();

                string hdnCustomer = "";
                if (string.IsNullOrEmpty(form["hdnCustomer"]) == false)
                {
                    hdnCustomer = Convert.ToString(form["hdnCustomer"]).ToUpper();
                }
                else
                {
                    hdnCustomer = Convert.ToString(form["hdnCustomer"]);
                }

                string hdnCustUpdate = Convert.ToString(form["hdnCustUpdate"]);

                if (!string.IsNullOrEmpty(hdnCustUpdate))
                {
                    //Add or Update Customer
                    tblCustomer cu = (from cust in objdb1.tblCustomers
                                      where cust.CustomerName == hdnCustomer
                                      select cust).FirstOrDefault();
                    CommonFunctions c = new CommonFunctions();
                    if (cu == null)
                    {
                        tblCustomer custad = new tblCustomer();
                        custad.CustomerName = hdnCustomer;
                        custad.DateAdded    = c.GetCurrentDate();
                        custad.IsInActive   = false;
                        custad.Notes        = null;
                        objdb1.tblCustomers.Add(custad);
                        objdb1.SaveChanges();
                    }
                }
                model.BidTo = "";
                if (string.IsNullOrEmpty(form["hdnCustomer"]) == false)
                {
                    model.BidTo = Convert.ToString(form["hdnCustomer"]).ToUpper();
                }
                else
                {
                    model.BidTo = Convert.ToString(form["hdnCustomer"]);
                }


                string strBidAs = "";
                if (model.BiddingAsIandC == true)
                {
                    strBidAs = "0#";
                }
                if (model.BiddingAsElectircal == true)
                {
                    strBidAs = strBidAs + "1#";
                }
                if (model.BiddingAsPrime == true)
                {
                    strBidAs = strBidAs + "2#";
                }
                if (model.BiddingAsUnKnown == true)
                {
                    strBidAs = strBidAs + "3#";
                }
                if (model.BiddingAsNotBidding == true)
                {
                    strBidAs = strBidAs + "4#";
                }

                if (model.BiddingAsNotQualified == true)
                {
                    strBidAs = strBidAs + "5#";
                }
                if (model.BiddingAsMechanical == true)
                {
                    strBidAs = strBidAs + "6#";
                }

                model.BiddingAs = strBidAs;

                if (model.DivisionConcord == true)
                {
                    model.Division = "Concord";
                }
                else if (model.DivisionHanford == true)
                {
                    model.Division = "Hanford";
                }
                else if (model.DivisionSacramento == true)
                {
                    model.Division = "Sacramento";
                }

                if (string.IsNullOrEmpty(model.ProjectName) == false)
                {
                    model.ProjectName = model.ProjectName.ToUpper();
                }

                if (string.IsNullOrEmpty(model.QuoteStatus) == false)
                {
                    model.QuoteStatus = model.QuoteStatus.ToUpper();
                }

                if (string.IsNullOrEmpty(model.LastFollowupBy) == false)
                {
                    model.LastFollowupBy = model.LastFollowupBy.ToUpper();
                }

                if (string.IsNullOrEmpty(model.FollowupNote) == false)
                {
                    model.FollowupNote = model.FollowupNote.ToUpper();
                }

                if (string.IsNullOrEmpty(model.EngineersEstimate) == false)
                {
                    model.EngineersEstimate = model.EngineersEstimate.ToUpper();
                }

                if (string.IsNullOrEmpty(model.Notes) == false)
                {
                    model.Notes = model.Notes.ToUpper();
                }

                _repo.UpdateQuoteLog(model);
                ViewBag.UId = model.UID;
                ViewBag.ID  = model.Id;


                string dtpLastDateFollowup = "";
                if (model.dtpLastDateFollowup == null)
                {
                    dtpLastDateFollowup = "";
                }
                else
                {
                    dtpLastDateFollowup = Convert.ToDateTime(model.dtpLastDateFollowup).ToString("MM-dd-yyyy");
                }

                string bidDate = "";
                if (model.BidDate == null)
                {
                    bidDate = "";
                }
                else
                {
                    bidDate = Convert.ToDateTime(model.BidDate).ToString("MM-dd-yyyy");
                }

                SendQuoteModifyMailSMTP(dtpLastDateFollowup, model.Email, model.BidTo, model.ProjectName, bidDate, model.QuoteStatus, model.LastFollowupBy, model.FollowupNote);
                var act = new ActivityRepository();
                act.AddActivityLog(Convert.ToString(Session["User"]), "Update Quote", "Create", "Quote " + model.UID + " updated by user " + Convert.ToString(Session["User"]) + ".");


                ViewBag.Message = "Record Updated Successfully And Quote Modified Status Mail Sent Succesfully";
            }

            //BidLogViewModel objcre = new BidLogViewModel();
            objdata              = new SRLogRepository();
            model.CustomerList   = objdata.GetCustomer();
            model.GroupUsersList = objdata.GetGroupUser();
            bool bExistEstimator = false;

            foreach (var i in model.GroupUsersList)
            {
                if (i.UserName == model.Estimator)
                {
                    bExistEstimator = true;
                }
            }
            if (bExistEstimator == false)
            {
                tblGroupUser g = new tblGroupUser();
                g.UserName   = model.Estimator;
                g.Userid     = model.Estimator;
                g.Group_Name = "";

                model.GroupUsersList.Add(g);
            }


            ViewBag.UpdateDisable = false;
            if (Convert.ToString(Session["SR_Log_ReadOnly"]) == "True" && Convert.ToString(Session["Bid_Log_ReadOnly"]) == "True")
            {
                ViewBag.UpdateDisable = true;
            }
            model.emailids = _repo.GetEmailInfo();
            return(View("Create", model));
        }