Пример #1
0
        public IActionResult Create(QuotationModel quotation)
        {
            bool actionSuccessfully = ModelState.IsValid;

            if (actionSuccessfully)
            {
                // pre: register client
                clientRepository.setResource("client/");
                // metodo utilitario
                var clientModel   = getClientFromQuotation(quotation);
                var clientCreated = clientRepository.create(clientModel);
                // asignar el ID del nuevo objeto creado
                quotation.idContact = clientCreated.id;
                // call method api
                quotationRepository.setResource("quotation/");
                var quotationCreated = quotationRepository.create(quotation);

                // Mandar un mensaje de registro satisfactorio
                TempData["registerSuccessfully"] = true;

                quotation = new QuotationModel();
                ModelState.Clear();
                // redirect method
                //return RedirectToAction(actionName: "Index", controllerName: "Home");
            }
            TempData["quotationViewModel"] = serializeJSON(quotationViewModelRepository.get());


            return(View(quotation));
        }
Пример #2
0
/// <summary>
/// 更新信息
/// </summary>
        public int UpdateInfo(SqlTransaction trans, QuotationModel quoModel, int QuotationId)
        {
            string key = "Cache_Quotation_Model_" + QuotationId;

            CacheHelper.RemoveCache(key);
            return(quoDAL.UpdateInfo(trans, quoModel, QuotationId));
        }
Пример #3
0
        public ActionResult Quotation()
        {
            QuotationService      objService = new QuotationService();
            QuotationModel        objModel   = new QuotationModel();
            List <QuotationModel> ListQ      = new List <QuotationModel>();
            int uid = 0;

            if (Session["UID"] != null)
            {
                uid = Convert.ToInt32(Session["UID"].ToString());
            }
            ListQ            = objService.getQuotation(uid);
            objModel.ListQuo = new List <QuotationModel>();
            objModel.ListQuo.AddRange(ListQ);

            List <DataCenterModel> ListDC = new List <DataCenterModel>();

            ListDC          = objService.getDataCenter();
            objModel.ListDC = new List <DataCenterModel>();
            objModel.ListDC.AddRange(ListDC);

            List <CompanyModel> objCompList = new List <CompanyModel>();

            objCompList       = objService.getActiveComp();
            objModel.ListComp = new List <CompanyModel>();
            objModel.ListComp.AddRange(objCompList);

            List <UserModel> objUserList = new List <UserModel>();

            objUserList       = objService.getActiveUser();
            objModel.UserList = new List <UserModel>();
            objModel.UserList.AddRange(objUserList);

            return(View(objModel));
        }
Пример #4
0
        //public ActionResult Edit(int id)
        //{
        //    EmployeeModel model = new EmployeeModel();
        //    model.ActionType = "Update";
        //    model = EmployeeService.getEventbyId(id);
        //    var UserList = (from UserType e in Enum.GetValues(typeof(UserType)) select new { Id = (int)e, Name = CommanModel.GetEnumDisplayName(e) });
        //    ViewBag.Userlist = new SelectList(UserList, "Id", "Name");
        //    return View("Add", model);
        //}

        public ActionResult AddQuotationDays(int EventDays, int ExistDays)
        {
            QuotationModel model = new QuotationModel();

            model.QuotationDayList = new List <QuotationDayModel>();
            List <SelectListItem> Elist = EmployeeService.getEmployeeList().Select(x => new SelectListItem {
                Text = x.Name, Value = Convert.ToString(x.EmployeeID)
            }).ToList();

            for (int i = 1; i <= EventDays; i++)
            {
                model.QuotationDayList.Add(
                    new QuotationDayModel
                {
                    EventDate = DateTime.Now,
                    IsDelete  = i <= ExistDays,
                    EmployeeQuotationDayList = new List <EmployeeQuotationDayModel>()
                    {
                        new EmployeeQuotationDayModel {
                            EmployeeList = Elist,
                        }
                    },
                }
                    );
            }
            return(PartialView("_AddQuotationDays", model));
        }
Пример #5
0
        public static int SaveQuotation(QuotationModel model)
        {
            string query = "SaveQuotation";

            DbParameter[] ObjParam = new DbParameter[16];

            ObjParam[0]  = new DbParameter("@ContactTitle", DbParameter.DbType.NVarChar, 0, model.ContactTitle);
            ObjParam[1]  = new DbParameter("@ContactFirstName", DbParameter.DbType.NVarChar, 0, model.ContactFirstName);
            ObjParam[2]  = new DbParameter("@ContactLastName", DbParameter.DbType.NVarChar, 0, model.ContactLastName);
            ObjParam[3]  = new DbParameter("@TelNumber", DbParameter.DbType.NVarChar, 0, model.TelNumber);
            ObjParam[4]  = new DbParameter("@CellNumber", DbParameter.DbType.NVarChar, 0, model.CellNumber);
            ObjParam[5]  = new DbParameter("@AddressLine1", DbParameter.DbType.NVarChar, 0, model.AddressLine1);
            ObjParam[6]  = new DbParameter("@AddressLine2", DbParameter.DbType.NVarChar, 0, model.AddressLine2);
            ObjParam[7]  = new DbParameter("@AddressLine3", DbParameter.DbType.NVarChar, 0, model.AddressLine3);
            ObjParam[8]  = new DbParameter("@AddressLine4", DbParameter.DbType.NVarChar, 0, model.AddressLine4);
            ObjParam[9]  = new DbParameter("@Code", DbParameter.DbType.NVarChar, 0, model.Code);
            ObjParam[10] = new DbParameter("@DateOfQuotation", DbParameter.DbType.DateTime, 0, System.DateTime.Now);
            ObjParam[11] = new DbParameter("@Parlourid", DbParameter.DbType.UniqueIdentifier, 0, model.parlourid);
            ObjParam[12] = new DbParameter("@LastModified", DbParameter.DbType.DateTime, 0, System.DateTime.Now);
            ObjParam[13] = new DbParameter("@ModifiedUser", DbParameter.DbType.NVarChar, 0, model.ModifiedUser);
            ObjParam[14] = new DbParameter("@QuotationID", DbParameter.DbType.Int, 0, model.QuotationID);
            ObjParam[15] = new DbParameter("@QuotationNumber", DbParameter.DbType.NVarChar, 0, model.QuotationNumber);


            return(Convert.ToInt32(DbConnection.GetScalarValue(CommandType.StoredProcedure, query, ObjParam)));
        }
Пример #6
0
        public Task <AddNewQuotationByGroupResponse> addNewQuotationByCustomerGroup(AddNewQuotationByGroupRequest request)
        {
            AddNewQuotationByGroupResponse response = new AddNewQuotationByGroupResponse()
            {
                Data = new List <int>()
            };
            IEnumerable <CustomerModel> customers = _customerService.GetListByCustomerGroup(request.group_id);

            if (customers == null || customers.Count() < 1)
            {
                return(Task.FromResult(response));
            }
            foreach (CustomerModel customer in customers)
            {
                AddNewQuotationCommand command = new AddNewQuotationCommand
                                                 (
                    customer.ID,
                    request.date
                                                 );
                Task <object> Quotation = (Task <object>)Bus.SendCommand(command);

                response = Common <AddNewQuotationByGroupResponse> .checkHasNotification(_notifications, response);

                if (response.Success)
                {
                    QuotationModel QuotationModel = (QuotationModel)Quotation.Result;
                    response.Data.Add(QuotationModel.ID);
                }
            }


            return(Task.FromResult(response));
        }
Пример #7
0
        public Task <AddNewQuotationResponse> addNewQuotation(AddNewQuotationRequest request)
        {
            AddNewQuotationResponse response = new AddNewQuotationResponse();
            CustomerModel           customer = _customerService.GetByCode(request.customer_code);

            if (customer == null)
            {
                return(Task.FromResult(response));
            }
            AddNewQuotationCommand command = new AddNewQuotationCommand
                                             (
                customer.ID,
                request.date
                                             );
            Task <object> Quotation = (Task <object>)Bus.SendCommand(command);

            //RabbitMQBus.Publish(command);

            response = Common <AddNewQuotationResponse> .checkHasNotification(_notifications, response);

            if (response.Success)
            {
                QuotationModel QuotationModel = (QuotationModel)Quotation.Result;
                response.Data = QuotationModel.ID;
            }
            return(Task.FromResult(response));
        }
Пример #8
0
        public ActionResult AddEmployeeList(int DayId, int EmpId)
        {
            EmpId = EmpId + 1;
            QuotationModel model = new QuotationModel();

            model.QuotationDayList = new List <QuotationDayModel>();
            List <SelectListItem> Elist = EmployeeService.getEmployeeList().Select(x => new SelectListItem {
                Text = x.Name, Value = Convert.ToString(x.EmployeeID)
            }).ToList();

            for (int i = 0; i <= DayId; i++)
            {
                var EmployeeQuotationDayList = new List <EmployeeQuotationDayModel>();
                for (int j = 0; j <= EmpId; j++)
                {
                    EmployeeQuotationDayList.Add(new EmployeeQuotationDayModel
                    {
                        EmployeeList = Elist,
                    });
                }
                model.QuotationDayList.Add(
                    new QuotationDayModel
                {
                    EventDate = DateTime.Now,
                    IsDelete  = i <= DayId,
                    EmployeeQuotationDayList = EmployeeQuotationDayList,
                });
            }
            TempData["DayId"]    = DayId;
            TempData["DayEmpId"] = EmpId;
            return(PartialView("_AddEmployeeList", model));
        }
Пример #9
0
        private void CreateCrypto(QuotationModel quotation)
        {
            CryptoModel cryptoDTO  = new CryptoModel(quotation);
            CryptoData  cryptoData = Mapper.Map <CryptoData>(cryptoDTO);

            CryptoRepository.Create(cryptoData);
        }
Пример #10
0
        public ActionResult QEdit(int id)
        {
            QuotationService objService = new QuotationService();
            QuotationModel   objModel   = new QuotationModel();

            objModel = objService.getByID(id);

            List <DataCenterModel> ListDC = new List <DataCenterModel>();

            ListDC          = objService.getDataCenter();
            objModel.ListDC = new List <DataCenterModel>();
            objModel.ListDC.AddRange(ListDC);

            List <CompanyModel> objCompList = new List <CompanyModel>();

            objCompList       = objService.getActiveComp();
            objModel.ListComp = new List <CompanyModel>();
            objModel.ListComp.AddRange(objCompList);
            var comp = Dbcontext.UserMasters.Where(m => m.UID == objModel.CreatedBy).SingleOrDefault();
            int?cid  = comp.CompID;

            objModel.comp = cid;

            List <UserModel> objUserList = new List <UserModel>();

            objUserList       = objService.getActiveUser();
            objModel.UserList = new List <UserModel>();
            objModel.UserList.AddRange(objUserList);

            return(View(objModel));
        }
Пример #11
0
        public void BindQuotationToUpdate()
        {
            QuotationModel model = client.SelectQuotationByQuotationId(ID, ParlourId);

            if ((model == null) || (model.parlourid != ParlourId))
            {
                Response.Write("<script>alert('Sorry!you are not authorized to perform edit on this Quotation.');</script>");
            }
            else //(model != null)
            {
                ID = model.QuotationID;
                ddlMethod.SelectedValue = model.ContactTitle.ToString();
                txtLastName.Text        = model.ContactLastName.ToString();
                txtFirstname.Text       = model.ContactFirstName.ToString();
                txtCellphone.Text       = model.CellNumber.ToString();
                txtTelePhone.Text       = model.TelNumber.ToString();
                txtPhysicalAddress.Text = model.AddressLine1.ToString();
                txtStreetAddress.Text   = model.AddressLine2.ToString();
                txtTown.Text            = model.AddressLine3.ToString();
                txtProvince.Text        = model.AddressLine4.ToString();
                txtCode.Text            = model.Code.ToString();
                //txtThirdYear.Text = model.Cover6to13year.ToString("#,0.00");
                ViewState["QuotationID"] = ID;
                btnService.Text          = "Update";
                SelectServices.Enabled   = true;
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            QuotationModel quotationModel = db.QuotationModels.Find(id);

            db.QuotationModels.Remove(quotationModel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #13
0
        public int Update(QuotationModel model)
        {
            Mapper.CreateMap <QuotationModel, QuotationMaster>();
            QuotationMaster objUser = Dbcontext.QuotationMasters.SingleOrDefault(m => m.QID == model.QID);

            objUser = Mapper.Map(model, objUser);
            return(Dbcontext.SaveChanges());
        }
Пример #14
0
        //
        // GET: /APIQuatation/

        public IEnumerable <QuotationModel> Get(int id)
        {
            QuotationModel        objModel   = new QuotationModel();
            QuotationService      objService = new QuotationService();
            List <QuotationModel> lstuser    = new List <QuotationModel>();

            lstuser = objService.getQuotation(id);
            return(lstuser);
        }
Пример #15
0
        public void GetQuotationData()
        {
            QuotationModel objQuotation = client.SelectQuotationByQuotationId(QuotationID, ParlourId);

            txtTo.Text = objQuotation.ContactTitle + " " + objQuotation.ContactLastName + " " + objQuotation.ContactFirstName + Environment.NewLine + objQuotation.AddressLine1 + "," + Environment.NewLine + objQuotation.AddressLine2 + "," + Environment.NewLine + objQuotation.AddressLine3 + "," + Environment.NewLine + objQuotation.AddressLine4 + Environment.NewLine + objQuotation.Code;
            txtQuotationNumber.Text = objQuotation.QuotationNumber;
            txtDate.Text            = objQuotation.DateOfQuotation.ToString("dd'/'MM'/'yyyy");
            txtNotes.Text           = objQuotation.Notes;

            ddlTax.SelectedValue = (objQuotation.Tax).ToString("N2");
            txtDiscount.Text     = (objQuotation.Discount).ToString();
        }
Пример #16
0
        protected void btncrtQoutation_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    QuotationModel objQuotationModel = client.SelectQuotationByQuotationId(ID, ParlourId);
                    if (objQuotationModel != null && ID == 0)
                    {
                        ShowMessage(ref lblMessage, MessageType.Danger, "Quotation is  Already Exists.");
                    }
                    else
                    {
                        objQuotationModel             = new QuotationModel();
                        objQuotationModel.QuotationID = ID;
                        if (ddlMethod.Text == "Select" || ddlMethod.SelectedValue == "Select")
                        {
                            objQuotationModel.ContactTitle = " ";
                        }
                        else
                        {
                            objQuotationModel.ContactTitle = ddlMethod.Text;
                        }
                        objQuotationModel.ContactLastName  = txtLastName.Text;
                        objQuotationModel.ContactFirstName = txtFirstname.Text;
                        objQuotationModel.CellNumber       = txtCellphone.Text;
                        objQuotationModel.TelNumber        = txtTelePhone.Text;
                        objQuotationModel.AddressLine1     = txtPhysicalAddress.Text;
                        objQuotationModel.AddressLine2     = txtStreetAddress.Text;
                        objQuotationModel.AddressLine3     = txtTown.Text;
                        objQuotationModel.AddressLine4     = txtProvince.Text;
                        objQuotationModel.Code             = txtCode.Text;
                        objQuotationModel.DateOfQuotation  = System.DateTime.Now;
                        objQuotationModel.parlourid        = this.ParlourId;
                        objQuotationModel.ModifiedUser     = UserName;
                        objQuotationModel.LastModified     = System.DateTime.Now;
                        objQuotationModel.QuotationNumber  = "";

                        int a = client.SaveQuotation(objQuotationModel);
                        ViewState["QuotationID"] = a;
                        ShowMessage(ref lblMessage, MessageType.Success, "Quotation Successfully Saved.");
                        //ClearControl();
                        bindQoutationList();
                        SelectServices.Enabled = true;
                    }
                }
                catch (Exception ex)
                {
                    ShowMessage(ref lblMessage, MessageType.Danger, ex.Message);
                }
            }
        }
        //var device = new DeviceModel();

        //device.technician = model.technician;
        //        device.datein = model.datein;
        //        device.dateout = model.dateout;
        //        device.status = model.status;


        //        TempData["status"] = model.status;
        //        TempData["IdentityNumber"] = model.customerIdNumber;


        //        TempData["technician"] = model.technician;
        //        db.DeviceModels.Add(device);
        //        db.SaveChanges();


        //        //Session["SerialNumber"] = model.serialNo.ToString();
        //        return RedirectToAction("NewQuote");



        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            QuotationModel quotationModel = db.QuotationModels.Find(id);

            if (quotationModel == null)
            {
                return(HttpNotFound());
            }
            return(View(quotationModel));
        }
Пример #18
0
 public QuotationModel getByID(int id)
 {
     try
     {
         Mapper.CreateMap <QuotationMaster, QuotationModel>();
         QuotationMaster objCityMaster = Dbcontext.QuotationMasters.Where(m => m.QID == id).SingleOrDefault();
         QuotationModel  objCityItem   = Mapper.Map <QuotationModel>(objCityMaster);
         return(objCityItem);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #19
0
        public int CreateQuotation(QuotationModel quotationModel)
        {
            Quotation quotation = null;

            quotation = this._quotationRepository.CreateQuotation(new Quotation()
            {
                VendorID              = quotationModel.VendorID,
                AssetRequestID        = quotationModel.AssetRequestID,
                QuotationFilePath     = quotationModel.QuotationFilePath,
                QuotationStatusID     = (int)AMSUtilities.Enums.QuotationStatus.ApprovalPending,
                QuotationReceivedDate = quotationModel.QuotationReceivedDate
            });

            return(quotation.ID);
        }
Пример #20
0
        //[HttpPost]
        //public ActionResult GetEmployeeDetail(jQueryDataTableParamModel parm)
        //{
        //    int startIndex = parm.iDisplayStart;
        //    int endIndex = parm.iDisplayStart + parm.iDisplayLength;
        //    int recordsTotal = 0;

        //    List<EmployeeModel> list = EmployeeService.LoadEmpDetail(parm.sSearch, startIndex, endIndex, parm.iSortCol_0, parm.sSortDir_0, out recordsTotal);

        //    return Json(new
        //    {
        //        Echo = parm.sEcho,
        //        iTotalRecord = recordsTotal,
        //        iTotalDisplayRecords = recordsTotal,
        //        data = list
        //    });
        //}

        public ActionResult Add()
        {
            QuotationModel model = new QuotationModel();

            ViewBag.Userlist           = new SelectList(ClientService.getActiveClientList(), "ClientID", "Name");
            model.ProductQuotationList = new List <ProductQuotationModel> {
                new ProductQuotationModel {
                    ProductList = ProductService.getActiveProductList().Select(x => new SelectListItem {
                        Text = x.ProductName, Value = Convert.ToString(x.ProductId)
                    }).ToList()
                }
            };

            return(View(model));
        }
Пример #21
0
        public ActionResult AddEdit(QuotationModel model)
        {
            //model.AddedBy = HttpContext.Session.GetString("UserName");
            bool EmployeeStatus = QuotationService.AddQuotation(model);

            if (EmployeeStatus)
            {
                TempData["Success"] = "Quotation Added Successfully.";
            }
            else
            {
                TempData["Error"] = "Error, Please Try Again.";
            }

            return(RedirectToAction("Index"));
        }
Пример #22
0
/// <summary>
/// 从缓存读取信息
/// </summary>
        public QuotationModel GetCacheInfo(SqlTransaction trans, int QuotationId)
        {
            string key   = "Cache_Quotation_Model_" + QuotationId;
            object value = CacheHelper.GetCache(key);

            if (value != null)
            {
                return((QuotationModel)value);
            }
            else
            {
                QuotationModel quoModel = quoDAL.GetInfo(trans, QuotationId);
                CacheHelper.AddCache(key, quoModel, null, Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(20), CacheItemPriority.Normal, null);
                return(quoModel);
            }
        }
        public ActionResult Finish(QuotationModel model, DeviceModel m, string sNum, string IDnum)
        {
            TempData.Keep();
            //model.Name = TempData["SerialNumber"].ToString();
            //model.Status = TempData["status"].ToString();

            model.IdentityNumber = sNum;
            //quote.technician = TempData["technician"].ToString();
            //quote.IdentityNumber = TempData["IdentityNumber"].ToString();

            //m.customerIdNumber = TempData["IdentityNumber"].ToString();



            return(View());
        }
Пример #24
0
        public int UpdateQuotation(QuotationModel quotationModel)
        {
            Quotation quotation = _quotationRepository.GetQuotationByID(quotationModel.ID);

            if (quotation != null)
            {
                quotation.VendorID              = quotationModel.VendorID;
                quotation.AssetRequestID        = quotationModel.AssetRequestID;
                quotation.QuotationFilePath     = quotationModel.QuotationFilePath;
                quotation.QuotationStatusID     = quotationModel.QuotationStatusID;
                quotation.QuotationReceivedDate = quotationModel.QuotationReceivedDate;
            }

            _quotationRepository.UpdateQuotation(quotation);

            return(quotation.ID);
        }
Пример #25
0
        private QuotationModel AddInstrument(string instrumentID)
        {
            Quotation      quotation = QuotationCenter.GetQuotation(instrumentID);
            QuotationModel quotationModel;

            if (quotation == null)
            {
                quotationModel = new QuotationModel(instrumentID);
            }
            else
            {
                quotationModel = new QuotationModel(quotation);
            }
            this.Quotations.Add(quotationModel);
            QuotationCenter.Subscribe(instrumentID, this);
            return(quotationModel);
        }
Пример #26
0
        public ActionResult QEdit(QuotationModel model)
        {
            QuotationService objService = new QuotationService();
            int uid = 0;

            if (Session["UID"] != null)
            {
                uid = Convert.ToInt32(Session["UID"].ToString());


                model.UpdatedBy   = uid;
                model.UpdatedDate = System.DateTime.Now;
                objService.Update(model);
                TempData["Msg"] = "Updated successfully.";
            }
            return(RedirectToAction("Quotation"));
        }
 public async Task <HttpResponseMessage> PostQuotation(string token, QuotationModel quotationData)
 {
     try
     {
         httpClient.DefaultRequestHeaders.Clear();
         httpClient.DefaultRequestHeaders.Accept.Clear();
         httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
         httpClient.DefaultRequestHeaders.Add("Authorization", $"bearer {token}");
         using (HttpResponseMessage response = await httpClient.PostAsJsonAsync("/api/Quotation", quotationData))
         {
             return(response);
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Пример #28
0
 public ActionResult QDelete(int id)
 {
     try
     {
         QuotationService objService = new QuotationService();
         QuotationModel   objModel   = new QuotationModel();
         objModel = objService.getByID(id);
         Dbcontext.QuotationMasters.Remove(Dbcontext.QuotationMasters.Find(id));
         TempData["Msg"] = "Record Deleted.";
         Dbcontext.SaveChanges();
     }
     catch (Exception ex)
     {
         TempData["Msg"] = "Record Not Deleted.";
         return(View("Error"));
     }
     return(RedirectToAction("Quotation"));
 }
        public ActionResult Create([Bind(Include = "Id,Job_Card,Name,IdentityNumber,Description,Deposit,Total,Balance,technician,Accessories,Status,email")] QuotationModel quotationModel)
        {
            TempData.Keep();
            if (ModelState.IsValid)
            {
                //quotationModel.technician = TempData["technician"].ToString();

                var q = new QuotationModel();
                TempData["technician"] = quotationModel.technician;

                //TempData["technician"] = quotationModel.technician;
                db.QuotationModels.Add(q);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(quotationModel));
        }
        public static ClientModel getClientFromQuotation(QuotationModel quotation)
        {
            ClientModel   resultModel = new ClientModel();
            List <string> splitNames  = quotation.name.Split(' ').ToList();

            // validar posteriormente esta logica para obtener los nombres
            if (!isNull(splitNames))
            {
                resultModel.fullname = splitNames[0];
                if (splitNames.Count > 1)
                {
                    resultModel.lastname = splitNames[1];
                }
            }
            resultModel.phone         = quotation.phone;
            resultModel.company       = quotation.company_name;
            resultModel.id_membership = 1; //  Empresa Afiliad => Delta Cargo
            return(resultModel);
        }