コード例 #1
0
        private void AddResponsesToEstimate(Estimate estimate, ulong?restrictToUserId = null)
        {
            if (estimate == null)
            {
                return;
            }

            var query = Db.From <EstimateResponse>().Where(r => r.Active == true && r.EstimateId == estimate.Id);

            if (restrictToUserId != null)
            {
                query = query.Where(r => r.UserId == restrictToUserId.Value);
            }

            var responses = Db.Select <EstimateResponse>(query);

            foreach (var response in responses)
            {
                response.User = Db.SingleById <User>(response.UserId);

                if (response.User.IsPremium)
                {
                    var premiumInfo = Db.Select <PremiumInfo>(p => p.UserId == response.User.Id).FirstOrDefault();
                    response.User.PremiumInfo = premiumInfo;
                }
                estimate.Responses.Add(response);
            }

            estimate.Responses = SortResponses(estimate.Responses);

            //Debug.WriteLine(Db.GetLastSql());
        }
コード例 #2
0
 public EstimateYearSpendingReport(Estimate est, bool isNewSystem = true)
 {
     this.est         = est;
     this.year        = est.Year;
     this.isNewSystem = isNewSystem;
     LoadMoneySourcesList();
 }
コード例 #3
0
        public async Task <bool> StoreNewEstimateAsync(int InvoiceId, Estimate Estimate)
        {
            Estimate.InvoiceId = InvoiceId;

            _context.Estimates.Add(Estimate);
            return((await _context.SaveChangesAsync()) > 0);
        }
コード例 #4
0
 public void Keyify(string rootKey)
 {
     AngleResidualKey     = $"{rootKey}.Ang.Res";
     MagnitudeResidualKey = $"{rootKey}.Mag.Res";
     Measurement.Keyify(rootKey);
     Estimate.Keyify(rootKey);
 }
コード例 #5
0
 public void Unkeyify()
 {
     AngleResidualKey     = "Undefined";
     MagnitudeResidualKey = "Undefined";
     Measurement.Unkeyify();
     Estimate.Unkeyify();
 }
コード例 #6
0
        public void EstimateAddAsyncTestsUsingoAuth(ServiceContext qboContextoAuth)
        {
            //Creating the Estimate for Add
            Estimate entity = QBOHelper.CreateEstimate(qboContextoAuth);

            Estimate added = Helper.AddAsync <Estimate>(qboContextoAuth, entity);
        }
コード例 #7
0
 public void EstimateAddTestUsingoAuth(ServiceContext qboContextoAuth)
 {
     //Creating the Estimate for Add
     Estimate estimate = QBOHelper.CreateEstimate(qboContextoAuth);
     //Adding the Estimate
     Estimate added = Helper.Add <Estimate>(qboContextoAuth, estimate);
 }
コード例 #8
0
        public static ICollection <UserEstimateDTO> ConvertToUserEstimates(ICollection <User> users, ICollection <Estimate> estimates)
        {
            ICollection <UserEstimateDTO> userEstimates = new List <UserEstimateDTO>();

            foreach (User u in users)
            {
                Estimate est = estimates.Where(e => e.Participant == u).FirstOrDefault();
                string   estVal;
                if (est != null)
                {
                    estVal = est.Value;
                }
                else
                {
                    estVal = "";
                }
                UserEstimateDTO userEstimate = new UserEstimateDTO()
                {
                    UserName = u.Name,
                    Estimate = estVal
                };

                userEstimates.Add(userEstimate);
            }

            return(userEstimates);
        }
コード例 #9
0
        private void InsertEstimate(Estimate estimate)
        {
            var estimates = new Estimates();

            estimates.EstimateList.Add(estimate);
            _cacheManager.Add(estimate.ProjectId, estimates);
        }
コード例 #10
0
ファイル: EstimateHelper.cs プロジェクト: gubenkoved/game-ai
        public static void AdjustTerminalStateEstimate(int searchDepth, ref Estimate terminateEstimate)
        {
            Debug.Assert(searchDepth >= 1);
            Debug.Assert(terminateEstimate == Estimate.MaxInf ||
                         terminateEstimate == Estimate.MinInf ||
                         terminateEstimate == Estimate.Zero);

            if (terminateEstimate == Estimate.Zero)
            {
                return;
            }

            // make AI pick shortest path to win and longest path to lose
            // otherwise there will be funny situation then AI seeing that it won
            // w/o chances for other side will not purse the winning

            // the below table describes with counter-intuitive adjustment value
            // Player\Winning |  MAX    |  MIN
            // -----------------------------------
            //          MAX   |  -d     |  +d
            //          MIN   |  -d     |  +d

            bool maxWin = terminateEstimate == Estimate.MaxInf;

            int sign = maxWin
                ? -1
                : +1;

            int adjustment = sign * searchDepth;

            terminateEstimate.Value += adjustment;
        }
コード例 #11
0
ファイル: App.xaml.cs プロジェクト: emiliobusnelli/mobDev
        public App()
        {
            InitializeComponent();

            MainPage = new TabController();
            est      = new Estimate();
        }
コード例 #12
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,CustomerId,EstimateTitle,EstimateId,EstimateNo,EstimateDate,ExpireDate,POSO,Subheading,Footer,Memo,Total,GrandTotal,DateCreated,DateUpdated,DateModified,IsDeleted")] Estimate estimate)
        {
            if (id != estimate.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(estimate);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EstimateExists(estimate.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"] = new SelectList(_context.Customers, "Id", "Id", estimate.CustomerId);
            return(View(estimate));
        }
コード例 #13
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,EstimateDate,ExpirationDate")] Estimate estimate)
        {
            if (id != estimate.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try {
                    _context.Update(estimate);
                    await _context.SaveChangesAsync();
                } catch (DbUpdateConcurrencyException) {
                    if (!EstimateExists(estimate.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(estimate));
        }
コード例 #14
0
 protected void Page_Init(object sender, EventArgs e)
 {
     ctx = new AriClinicContext("AriClinicContext");
     // security control, it must be a user logged
     if (Session["User"] == null)
     {
         Response.Redirect("Default.aspx");
     }
     else
     {
         user = CntAriCli.GetUser((Session["User"] as User).UserId, ctx);
         Process proc = (from p in ctx.Processes
                         where p.Code == "Estimate"
                         select p).FirstOrDefault <Process>();
         per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
         btnAccept.Visible = per.Modify;
     }
     //
     LoadComboInsurance();
     //
     if (Request.QueryString["EstimateId"] != null)
     {
         estId = Int32.Parse(Request.QueryString["EstimateId"]);
         est   = CntAriCli.GetEstimate(estId, ctx);
     }
     //
     if (Request.QueryString["EstimateLineId"] != null)
     {
         estlId = Int32.Parse(Request.QueryString["EstimateLineId"]);
         estl   = CntAriCli.GetEstimateLine(estlId, ctx);
         LoadData(estl);
     }
 }
コード例 #15
0
 public YearPlanReport(TenderYear year, Estimate est, bool isNewSystem, KekvCode kekv)
 {
     this.year        = year;
     this.estFilter   = est;
     this.isNewSystem = isNewSystem;
     this.kekvFilter  = kekv;
 }
コード例 #16
0
        public async Task <IActionResult> UpdateEstimate(Estimate SingleEstimate, [FromRoute] int id)
        {
            ModelState.Remove("VendorUser");

            Estimate est = context.Estimate.Where(i => i.EstimateId == id).SingleOrDefault();

            est.VendorUser = await GetCurrentUserAsync();

            est.Title       = SingleEstimate.Title;
            est.Description = SingleEstimate.Description;
            est.Price       = SingleEstimate.Price;
            est.DateStart   = SingleEstimate.DateStart;
            est.DateEnd     = SingleEstimate.DateEnd;

            if (ModelState.IsValid)
            {
                context.Add(est);
            }

            try
            {
                context.SaveChanges();
                return(RedirectToAction("GetEstimates", "Estimates"));
            }

            catch (DbUpdateException)
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
コード例 #17
0
        public async Task <IActionResult> AddEstimate(Estimate estimate)
        {
            ModelState.Remove("VendorUser");
            ModelState.Remove("CustomerUser");

            if (ModelState.IsValid)
            {
                var VendorUser = await GetCurrentUserAsync();

                estimate.VendorUser = VendorUser;

                context.Add(estimate);
            }

            try
            {
                context.SaveChanges();
                return(RedirectToAction("Profile", "Vendor"));
            }

            catch (DbUpdateException)
            {
                return(RedirectToAction("AddEstimate", "Estimates"));
            }
        }
コード例 #18
0
        private void UpdateBestMove(bool maximaize,
                                    Move move, Estimate estimate,
                                    ref Move bestMove, ref Estimate bestEstimate)
        {
            if (bestMove == null)
            {
                bestMove     = move;
                bestEstimate = estimate;
                return;
            }

            if (maximaize)
            {
                if (estimate > bestEstimate)
                {
                    bestEstimate = estimate;
                    bestMove     = move;
                }
            }
            else // minimize
            {
                if (estimate < bestEstimate)
                {
                    bestEstimate = estimate;
                    bestMove     = move;
                }
            }
        }
コード例 #19
0
        protected void TextEx_TextChanged(object sender, EventArgs e)
        {
            List <CreditorInvoiceCharge> charges = null;
            DataSet ds       = new DataSet();
            var     estimate = new Estimate();

            charges = (List <CreditorInvoiceCharge>)ViewState["Charges"];
            if (charges.Count > 0)
            {
                for (int count = 0; count < charges.Count; count++)
                {
                    if (charges[count].CurrencyId.ToInt() == 2)
                    {
                        charges[count].ConvRate = txtExRate.Text.ToDouble();
                        ds = new EstimateBLL().GetServiceTax(lblJobDate.Text.ToDateTime(), (charges[count].Unit * charges[count].Rate * charges[count].ConvRate).ToDecimal(), charges[count].ChargeId);
                        if (ds.Tables[1].Rows[0]["ServiceTax"].ToInt() == 1 && charges[count].STax != 0)
                        {
                            charges[count].STax = (ds.Tables[0].Rows[0]["stax"].ToDecimal() + ds.Tables[0].Rows[0]["CessAmt"].ToDecimal() + ds.Tables[0].Rows[0]["AddCess"].ToDecimal()).ToDouble();
                        }
                        else
                        {
                            charges[count].STax = 0;
                        }
                        charges[count].GTotal = (charges[count].Unit * charges[count].Rate * charges[count].ConvRate) + charges[count].STax;
                    }
                }
                lblInvoiceAmount.Text = charges.Sum(m => m.GTotal).ToString();
                ViewState["Charges"]  = charges;
                grvInvoice.DataSource = charges;
                grvInvoice.DataBind();
            }
        }
コード例 #20
0
        public ActionResult PreviewEstimate(Estimate estimate)
        {
            // Instantiate the view model we will use in this view
            EstimatesViewModel ViewModel = new EstimatesViewModel();

            // Make sure the id is for a valid design order
            DesignOrder DOrder = db.DesignOrders.Find(estimate.DesignOrderSID);

            if (DOrder == null)
            {
                return(RedirectToAction("DesignOrders"));
            }
            else
            {
                // Store the design order in the view model
                ViewModel.DesignOrders = new List <DesignOrder> {
                    DOrder
                };
            }

            // Get other needed models for populating drop down lists etc
            ViewModel.StressWorkTypes  = db.StressWorkTypes.ToList();
            ViewModel.ToolTypes        = db.ToolTypes.ToList();
            ViewModel.FamilyClasses    = db.FamilyClasses.ToList();
            ViewModel.AppUsers         = db.AppUsers.ToList();
            ViewModel.Statistics       = db.Statistics.ToList();
            ViewModel.ComplexityLevels = db.ComplexityLevels.ToList();

            ViewModel.Estimates = new List <Estimate> {
                estimate
            };

            return(View(ViewModel));
        }
コード例 #21
0
        public static bool IsCloseTo(this Estimate e, Estimate other)
        {
            if (e.IsTerminal())
            {
                if (!other.IsTerminal())
                {
                    return(false);
                }

                return(e.SameSignWith(other));
            }
            else   // not terminal
            {
                if (other.IsTerminal())
                {
                    return(false);
                }

                // both are not terminal there -- allow 10% discrepancy from max abs value

                int maxAbsValue = Math.Abs(Math.Max(e.Value, other.Value));
                int absDiff     = Math.Abs(e.Value - other.Value);

                return(absDiff < maxAbsValue * 0.1);
            }
        }
コード例 #22
0
        public void TaskConstructorWithException()
        {
            var e = new Estimate(0, "Low");
            var d = DateTime.Now;

            new Task("name", "description", e, d, 1, 2);
        }
コード例 #23
0
        public ActionResult AcceptEstimate(Estimate estimate)
        {
            if (ModelState.IsValid)
            {
                // Set all previous estimates on this design order to not "islatestEstimate"
                List <Estimate> OldEstimates = db.Estimates.Where(e => e.DesignOrderSID == estimate.DesignOrderSID).ToList();
                if (OldEstimates.Count > 0)
                {
                    foreach (Estimate est in OldEstimates)
                    {
                        // Set flag to false
                        est.IsLatestEstimate = false;
                    }
                    db.SaveChanges();
                }

                estimate.IsLatestEstimate = true;
                estimate.IsDeleted        = false;
                estimate.CreatedDate      = DateTime.Now;
                estimate.CreatedByUserID  = db.AppUsers.Single(u => u.UserEmail == User.Identity.Name).AppUserID;

                // Save new estimate to the database
                db.Estimates.Add(estimate);
                db.SaveChanges();

                // Redirect to the list of estimates for this design order
                return(RedirectToAction("List", new { id = estimate.DesignOrderSID }));
            }
            return(View());
        }
コード例 #24
0
        private Estimate ExtractData()
        {
            //var unitId = Convert.ToInt32(ddlUnitType.SelectedValue);
            var est = new Estimate
            {
                EstimateId = EstmateId,
                BillFromId = Convert.ToInt32(ddlBillingFrom.SelectedValue),
                PartyId    = Convert.ToInt32(ddlParty.SelectedValue),
                //UnitTypeId = unitId,
                PaymentIn       = rdoPayment.SelectedValue,
                CreditDays      = string.IsNullOrEmpty(txtCreditInDays.Text) ? (int?)null : Convert.ToInt32(txtCreditInDays.Text),
                Charges         = (List <Charge>)ViewState["Charges"],
                EstimateDate    = txtEstimateDate.Text.ToDateTime(),
                TransactionType = rdoPayment.SelectedValue,
                ROE             = txtExRate.Text.ToDecimal(),
                EstimateNo      = lblEstimateNo.Text,
                CompanyID       = 1,
                TotalCharges    = Convert.ToDouble(lblCharges.Text),
                UserID          = _userId,
                PorR            = ViewState["IsPayment"].ToInt() == 1 ? "P" : "R",
                //EstimateDate=DateTime.Now,
                JobID = JobID
            };

            //est.Charges.ForEach(x => x.UnitId = unitId);
            return(est);
        }
コード例 #25
0
        public double[] EstimateInterval(Estimate e)
        {
            double z   = NormalConfidenceEstimator.Quantile((1.0 - this._confidence) / 2.0);
            double len = Math.Abs(z * Math.Sqrt(e.Variance));

            return(new double[] { e.Expectation - len, e.Expectation + len });
        }
コード例 #26
0
        public void TasksController_Estimate_Create_ReturnsObjectResultWithCorrectObject_WhenIdAndEstimateAreValid()
        {
            //Arrange
            controller = createContext(controller, "worker");
            Estimate e = new Estimate()
            {
                Id         = 5,
                TotalHours = 10,
                Complexity = 1,
                HourlyWage = 110,
                Urgency    = 1,
                TaskId     = 1,
            };

            int taskId = 1;

            //Act
            var result          = controller.CreateEstimate(taskId, e);
            var objectResult    = result as ObjectResult;
            var createdEstimate = objectResult.Value as Estimate;

            //Assert
            Assert.IsType <ObjectResult>(result);
            Assert.Equal(createdEstimate.Id, e.Id);
            Assert.Equal(createdEstimate.TaskId, e.TaskId);
        }
コード例 #27
0
ファイル: EstimateDAL.cs プロジェクト: souvik0682/ems-nvocc
        public static int SaveEstimate(Estimate estimate, string Mode)
        {
            string strExecution = "[fwd].[uspManageEstimate]";
            int    Estimateid   = 0;
            var    Xmltext      = "";

            using (DbQuery oDq = new DbQuery(strExecution))
            {
                oDq.AddVarcharParam("@mode", 1, Mode);
                oDq.AddIntegerParam("@pk_EstimateID", estimate.EstimateId);
                oDq.AddDateTimeParam("@EstimateDate", estimate.EstimateDate);

                oDq.AddIntegerParam("@fk_PartyID", estimate.PartyId);
                oDq.AddVarcharParam("@EstimateNo", 1, estimate.EstimateNo);
                oDq.AddIntegerParam("@fk_CompanyID", estimate.CompanyID);

                oDq.AddIntegerParam("@fk_JobID", estimate.JobID);
                oDq.AddIntegerParam("@fk_BillFromID", estimate.BillFromId);
                oDq.AddVarcharParam("@PorR", 1, estimate.PorR);

                oDq.AddVarcharParam("@TransactionType", 1, estimate.TransactionType);
                oDq.AddIntegerParam("@CreditDays", estimate.CreditDays);
                oDq.AddDecimalParam("@ExchRate", 12, 2, estimate.ROE);
                oDq.AddVarcharParam("@Charges", int.MaxValue, Utilities.GeneralFunctions.SerializeWithXmlTag(estimate.Charges).Replace("?<?xml version=\"1.0\" encoding=\"utf-16\"?>", ""));
                Xmltext = Utilities.GeneralFunctions.SerializeWithXmlTag(estimate.Charges).Replace("?<?xml version=\"1.0\" encoding=\"utf-16\"?>", "");

                oDq.AddIntegerParam("@UserID", estimate.UserID);
                int result = 0;
                oDq.AddIntegerParam("@Result", result, QueryParameterDirection.Output);
                var t = Convert.ToInt32(oDq.GetScalar());

                Estimateid = Convert.ToInt32(oDq.GetParaValue("@Result"));
            }
            return(Estimateid);
        }
コード例 #28
0
        // GET: Estimates/Delete/5

        /*
         *  Delete an estimate
         */
        public ActionResult Delete(int?id)
        {
            // TODO Set islatest flag on new latest estimate
            Estimate estimate       = db.Estimates.Find(id);
            int      DesignOrderSID = estimate.DesignOrderSID;

            estimate.IsDeleted = true;

            if (estimate.IsLatestEstimate == true)
            {
                estimate.IsLatestEstimate = false;

                // If this was the latest estimate, set the previous one to "is Latest"
                Estimate NewLatest = db.Estimates.Where(e => e.IsDeleted == false &&
                                                        e.DesignOrderSID == estimate.DesignOrderSID &&
                                                        e.EstimateID != estimate.EstimateID
                                                        ).OrderByDescending(e => e.CreatedDate).FirstOrDefault();

                if (NewLatest != null)
                {
                    NewLatest.IsLatestEstimate = true;
                    db.Entry(NewLatest).State  = EntityState.Modified;
                }
            }

            db.Entry(estimate).State = EntityState.Modified;

            db.SaveChanges();
            return(RedirectToAction("List", new { id = DesignOrderSID }));
        }
コード例 #29
0
        public ActionResult CreateSheet(EstimateModel estimate)
        {
            var newEstimate = new Estimate
            {
                Title           = estimate.Title,
                Comments        = estimate.Comments,
                CreatedByUserId = WebUser.Id
            };

            _estimateRepository.Create(newEstimate);
            _unitOfWork.Commit();

            foreach (var lineItem in estimate.Rows)
            {
                var newEstimateLineItem = new EstimateLineItem()
                {
                    EstimateId = newEstimate.Id,
                    Module     = lineItem.Module,
                    Task       = lineItem.Task,
                    Effort     = lineItem.Effort,
                    Comment    = lineItem.Comment,
                    WorkType   = lineItem.WorkType
                };

                _estimateLineItemRepository.Create(newEstimateLineItem);
            }

            _unitOfWork.Commit();

            return(Json(true));
        }
コード例 #30
0
        /// <summary>
        /// Método para coletar dados e deletar orçamento
        /// </summary>
        private void DeleteEstimate()
        {
            try {
                // Remoção do serviço
                dao.DeleteEstimate(aux.DocNo);

                // Registro de log - Edição
                Model.Log deleted = new Model.Log();
                deleted.employe = _employe;
                deleted.action  = $"Orçamento: {aux.Description} foi removido no sistema!";
                logs.Register(deleted);

                // Atualizando grid e limpando campos de texto
                RefreshGrid();
                ClearFields();
                BlockFields();
                actionIndex = -1;
                aux         = null;
            } catch (DatabaseDeleteException err) {
                MessageBox.Show(
                    err.Message,
                    "Erro",
                    MessageBoxButton.OK,
                    MessageBoxImage.Error
                    );
            } catch (Exception err) {
                MessageBox.Show(
                    err.Message,
                    "Erro",
                    MessageBoxButton.OK,
                    MessageBoxImage.Error
                    );
            }
        }
コード例 #31
0
        public void CreateEstimateTest()
        {
            Estimate rec =
                new Estimate
                    {
                        ClientId = ClientTest.SampleClient().ClientId,
                        PoNumber = "1234",
                        Date = DateTime.Now.Date,
                        Lines = new LineItems
                        {
                            LineList =
                                {
                                    new LineItem
                                        {
                                            Name = "Widget 1.0a (revision 3B)",
                                            Description = "A widget for the whatsit",
                                            UnitCost = 22.44,
                                            Quantity = 100,
                                        },
                                    new LineItem
                                        {
                                            Name = "Monarch 2",
                                            Description = "A pretty little butterfly",
                                            UnitCost = 123.56,
                                            Quantity = 1,
                                        }
                                }
                        }
                    };

            EstimateIdentity id = Service.Create(new EstimateRequest {Estimate = rec,});

            try
            {
                Estimate fetched = Service.Get(id).Estimate;
                Assert.AreEqual("1234", fetched.PoNumber);
                Assert.AreEqual(2367.56, fetched.Amount);
                Assert.AreEqual(2, fetched.Lines.LineList.Count);
            }
            finally
            {
                Service.Delete(id);
            }
        }
コード例 #32
0
    public Estimate CreateEstimate()
    {
        Estimate temp = new Estimate();
        DateTime? nullDate = null;

        temp.JobName = this.currentProspect.Id;

        var giggles = DAL.User.GetUserFromLogin(Page.User.Identity.Name);

        temp.Estimator = giggles.Id;
        temp.EstimateNumber = Estimate.GetNextEstimateNumberForJob(currentProspect.Id);
        temp.Received = DateTime.Now;
        temp.Priority = Estimate.GetNextPriority();
        temp.ReadyForEstimating = true;
        temp.Received = DateTime.Now;
        temp.CurrentStatus = DateTime.Now.ToString("d") + " - Received by Estimating.";
        temp.EstimateSent = false;
        temp.EstimateSentDate = nullDate;
        temp.EstimatesDirectory = currentProspect.DirectoryPathExec;
        temp.ProspectDirectory = currentProspect.DirectoryPath;

        temp.Save();

        DAL.User estimator = new DAL.User(temp.Estimator);

        EstimateTimeline tempStep = new EstimateTimeline();
        tempStep.EstimateID = temp.Id;
        tempStep.WorkflowStepID = 131;
        tempStep.StepX = 0;
        tempStep.ResponsibleUserID = temp.Estimator;
        tempStep.DateTimeStamp = DateTime.Now;
        tempStep.DisplayText = DateTime.Now.ToString("d") + " - Received by Estimating.  Assigned to " + estimator.Name;

        tempStep.Save();

        CreateEstNumberDir(temp.EstimateNumber);

        BindControls(Estimate.Filter.Active);

        return temp;
    }
コード例 #33
0
ファイル: UIEstimate.xaml.cs プロジェクト: sajidk/Estimate-SL
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pAction"></param>
        private void UpdateDataBase(char pAction)
        {
            if (!Common.IsConnected)
            {
                MessageBox.Show("ネットワークに接続していません。");
                return;
            }

            int cnt = 1;
            Estimate estimate = new Estimate();
            estimate.Code = estCode;
            estimate.EstimateNo = txtEstNo.Text;
            estimate.CreationDate = DateTime.Parse(dtpCreateDate.Text);
            estimate.CustCode = Common.customer.Code;                                            
            estimate.Del_Flg = false;
            estimate.ExpDateCode = Int32.Parse(cboExpDate.SelectedValue.ToString());
            estimate.PayCondCode = Int32.Parse(cboPayCond.SelectedValue.ToString());
            estimate.Title = txtTitle.Text;
            estimate.Remarks1 = txtMemo1.Text;
            estimate.StaffCode = Common.staff.Code;
            if (pAction == 'U' && rbReCreate.IsChecked == true)
            {
                if (est != null)
                {
                    estimate.Old_Est_No = est.EstimateNo;
                    estimate.OrderDate = est.OrderDate;
                    estimate.FinishDate = est.FinishDate;
                }
            }
            else
                estimate.Old_Est_No = string.Empty;
            ObservableCollection<EDetails> edetails = new ObservableCollection<EDetails>();
            foreach (EDetails edetail in dgEstimate.ItemsSource)
            {
                if (edetail.Product != null)
                    if (edetail.Product.Trim().Length != 0)
                    {
                        edetail.No = cnt;
                        cnt += 1;
                    }
                    else
                    {
                        edetail.No = 0;
                    }
                edetails.Add(edetail);
            }
            estimate.EDetails = edetails;
            db.UpdateEstimateAsync(estimate,Common.staff.Nm, pcName, pAction);
        }
コード例 #34
0
    private void BindControls()
    {
        // Bind Estimate Queue
        estimateQueue = Estimate.GetEditableActiveEstimates();
        lstEstimates.DataSource = estimateQueue;
        lstEstimates.DataBind();

        //Sales Queue
        salesQueue = Estimate.GetSalesQueue();
        lstSalesQueue.DataSource = salesQueue;
        lstSalesQueue.DataTextField = "DisplayText";
        lstSalesQueue.DataValueField = "EstId";
        lstSalesQueue.DataBind();

        lstSalesQueue.Items[0].Selected = true;
        activeSalesQueueItem = new Estimate(lstSalesQueue.SelectedValue);

        string[] regions = Directory.GetDirectories(Paths.Prospects, "*", SearchOption.TopDirectoryOnly);

        for (int i = regions.Length - 1; i > -1; i--)
        {
            var fullPath = regions[i];
            var region = fullPath.Substring(fullPath.LastIndexOf('\\') + 1);

             regions[i] = region;
        }
        ddlProspectRegion.DataSource = regions;
        ddlProspectRegion.DataBind();

        // Update Cache
        Cache["SalesQueue"] = salesQueue;
        Cache["ActiveEstimate"] = activeSalesQueueItem;
        Cache["Estimates"] = estimateQueue;
        Cache["Regions"] = regions;

        ddlAddProjMgr.DataBind();
        ddlSalesperson.DataBind();
    }
コード例 #35
0
    private string CreateDir(Estimate.DirType dirType)
    {
        if (dirType == Estimate.DirType.Exec)
        {
            string region = ddlProspectRegion.SelectedItem.Text;
            string project = txtAddProjNumber.Text;
            string path = "";

            if (region == "United States")
            {
                path = Utils.BetweenAandM(project.Substring(0, 1)) ?
                    Paths.Exec + region + @"\A-M\" + txtAddProjNumber.Text + " - " + txtAddProjName.Text :
                    Paths.Exec + region + @"\N-Z\" + txtAddProjNumber.Text + " - " + txtAddProjName.Text;
            }
            else
            {
                path = Paths.Exec + region + @"\" + txtAddProjNumber.Text + " - " + txtAddProjName.Text;
            }

            DirectoryInfo execDir = Directory.CreateDirectory(path);
            return execDir.FullName;
        }

        if (dirType == Estimate.DirType.Prospect) {
            string folderTemplatePath = ConfigurationManager.AppSettings["ProspectFolderTemplate"];
            string newDir = copyDirectory(folderTemplatePath, Paths.Prospects
                + ddlProspectRegion.SelectedItem.Text + @"\" + txtAddProjNumber.Text + " - " + txtAddProjName.Text);
            return newDir;
        }

        if (dirType == Estimate.DirType.EstimateNumber)
        {
            string pathBaseProspect;
            string pathBaseExec;

            // assuming the current Prospect is correct for the new Estimate being created.
            if (Directory.Exists(currentProspect.DirectoryPath))
            {
                pathBaseProspect = currentProspect.DirectoryPath;

                // create Physics
                Directory.CreateDirectory(pathBaseProspect + @"\Physics\" + activeSalesQueueItem.EstimateNumber);

                // create Engineering
                Directory.CreateDirectory(pathBaseProspect + @"\Engineering\Archdwgs\Archive\" + activeSalesQueueItem.EstimateNumber);

                // Create Sales
                Directory.CreateDirectory(pathBaseProspect + @"\Sales\Estimates\" + activeSalesQueueItem.EstimateNumber);
                Directory.CreateDirectory(pathBaseProspect + @"\Sales\Prospectus\" + activeSalesQueueItem.EstimateNumber);
                Directory.CreateDirectory(pathBaseProspect + @"\Sales\SketchUp\" + activeSalesQueueItem.EstimateNumber);

            }

            if (Directory.Exists(currentProspect.DirectoryPathExec))
            {
                pathBaseExec = currentProspect.DirectoryPathExec;

                Directory.CreateDirectory(pathBaseExec + @"\" + activeSalesQueueItem.EstimateNumber);

            }

        }

        return string.Empty;
    }
コード例 #36
0
    private void CreateProject()
    {
        Project proj = new Project();

        proj.ProjectLead = "Lead";

        proj.ProjectName = txtAddProjName.Text;
        proj.ProjectNumber = txtAddProjNumber.Text;
        proj.PMUserID = int.Parse(ddlAddProjMgr.SelectedItem.Value);
        proj.PMAssigned = ddlAddProjMgr.SelectedItem.Text;
        proj.Region = ddlProspectRegion.SelectedItem.Text;
        proj.SalespersonID = int.Parse(ddlSalesperson.SelectedItem.Value);
        proj.ProjectActivity = "Active";
        proj.Created = DateTime.Now;
        proj.CreatedBy = Utils.GetFormattedUserNameInternal(User.Identity.Name);
        proj.Updated = DateTime.Now;
        proj.UpdatedBy = Utils.GetFormattedUserNameInternal(User.Identity.Name);
        proj.DesignDraftsmanID = 128;
        proj.EngineeringConsultant = "Unassigned";
        proj.PhysicistID = 137;

        if (chkCreateExec.Checked)
            proj.DirectoryPathExec = CreateDir(Estimate.DirType.Exec);
        if (chkCreateProspect.Checked)
            proj.DirectoryPath = CreateDir(Estimate.DirType.Prospect);
        if (chkCreateOutlook.Checked)
            CreateOutlookFolder(proj.ProjectNumber + " - " + proj.ProjectName, "Not Sent");

        proj.Save();
        currentProspect = proj;

        Estimate temp = new Estimate();
        temp.JobName = proj.Id;
        var giggles = DAL.User.GetUserFromLogin(Page.User.Identity.Name);

        if(giggles != null)
            temp.Estimator = DAL.User.GetUserFromLogin(Page.User.Identity.Name).Id;

        temp.EstimateNumber = Estimate.GetNextEstimateNumberForJob(proj.Id);
        temp.Received = DateTime.Now;
        temp.Priority = 0;
        temp.CurrentStatus = DateTime.Now.ToString("d") + " - Added to Sales Queue.";
        temp.StepID = 135;
        temp.StatusID = 0;

        temp.Save();

        activeSalesQueueItem = temp;

        if (chkCreateExec.Checked)
        {
            temp.EstimatesDirectory = CreateDir(Estimate.DirType.EstimateNumber);
        }

        if (chkCreateProspect.Checked)
            temp.ProspectDirectory = proj.DirectoryPath;

        temp.Save();
        activeSalesQueueItem = temp;
    }
コード例 #37
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Label lblHeading;
        lblHeading = (Label)Master.FindControl("lblPageHeading");
        lblHeading.Text = "Veritas - Estimate Priority";

        if (!IsPostBack)
        {
            BindControls();
            cmdSubmitEst.Enabled = activeSalesQueueItem.BidDueDate != null;
        }
        else
        {
            estimateQueue = (EstimateCollection)Cache["Estimates"];
            activeSalesQueueItem = (Estimate)Cache["ActiveEstimate"];
        }
    }
コード例 #38
0
    public void lstEstimates_SelectedIndexChanged(object sender, EventArgs e)
    {
        int? estID = int.Parse(lstEstimates.SelectedItem.Value);

        currentEstimate = new Estimate(estID);
        currentProspect = new Project(currentEstimate.JobName);
        currentSalesperson = new User(currentProspect.SalespersonID);
        currentEstimator = new User(currentEstimate.Estimator);

        // Room and Door Lists
        lstDoors.DataSource = DAL.Estimate.GetDoors(currentEstimate.Id);
        lstDoors.DataTextField = "DisplayText";
        lstDoors.DataValueField = "Id";
        lstDoors.DataBind();

        if (lstDoors.Items.Count > 0)
            cmdDelDoor.Enabled = true;

        lstVaults.DataSource = DAL.Estimate.GetRooms(currentEstimate.Id);
        lstVaults.DataTextField = "DisplayText";
        lstVaults.DataValueField = "Id";
        lstVaults.DataBind();

        if (lstVaults.Items.Count > 0)
            cmdDelVault.Enabled = true;

        FillForm();
    }
コード例 #39
0
        public string CreateAtProjectCreation(Estimate data)
        {
            var json = new JavaScriptSerializer().Serialize(data);
            //   string result = "";
            String finalString = "";
            XmlDocument xmlDoc = new XmlDocument();
            XmlNode rootNode = xmlDoc.CreateElement("issue");
            xmlDoc.AppendChild(rootNode);

            XmlNode idNode = xmlDoc.CreateElement("project_id");
            idNode.InnerText = "386";// project id of estmate management project
            rootNode.AppendChild(idNode);

            XmlNode nameNode = xmlDoc.CreateElement("subject");
            nameNode.InnerText = "Name of project";
            rootNode.AppendChild(nameNode);
            try
            {
                XmlNode identifierNode = xmlDoc.CreateElement("priority_id");
                // Priority p = new Priority();
                identifierNode.InnerText = "2";
                rootNode.AppendChild(identifierNode);
            }
            catch { }
            XmlNode statusNode = xmlDoc.CreateElement("status_id");
            statusNode.InnerText = "1";
            rootNode.AppendChild(statusNode);

            XmlNode trackerNode = xmlDoc.CreateElement("tracker_id");
            trackerNode.InnerText = "19";
            rootNode.AppendChild(trackerNode);

            XmlNode discriptionNode = xmlDoc.CreateElement("description");
            discriptionNode.InnerText = json;
            rootNode.AppendChild(discriptionNode);

                //XmlNode custom_fieldsNode = xmlDoc.CreateElement("custom_fields");
                //XmlAttribute attribute = xmlDoc.CreateAttribute("type");
                //attribute.Value = "array";
                //custom_fieldsNode.Attributes.Append(attribute);

                //List<CustomField> cf = new List<CustomField>();
                //cf = data.custom_fields;
                //foreach (var v in cf)
                //{

                //    XmlNode custom_fieldNode = xmlDoc.CreateElement("custom_field");

                //    XmlAttribute attribute1 = xmlDoc.CreateAttribute("id");
                //    attribute1.Value = v.id.ToString();
                //    custom_fieldNode.Attributes.Append(attribute1);

                //    XmlAttribute attribute2 = xmlDoc.CreateAttribute("name");
                //    attribute2.Value = v.name;
                //    custom_fieldNode.Attributes.Append(attribute2);

                //    XmlNode valueNode = xmlDoc.CreateElement("value");
                //    valueNode.InnerText = v.value;
                //    custom_fieldNode.AppendChild(valueNode);

                //    custom_fieldsNode.AppendChild(custom_fieldNode);

                //}
                //rootNode.AppendChild(custom_fieldsNode);

            string XmlizedString = "";
            using (StringWriter sw = new StringWriter())
            {
                using (XmlTextWriter tx = new XmlTextWriter(sw))
                {
                    xmlDoc.WriteTo(tx);
                    XmlizedString = sw.ToString();
                }
            }

            finalString = XmlizedString.Replace("<?xml version=\"1.0\" encoding=\"utf-16\"?>", "");
            string posturl = System.Configuration.ConfigurationManager.AppSettings["hostUrl"] + "issues.xml?key=" + System.Configuration.ConfigurationManager.AppSettings["apiKey"];
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(posturl);
            byte[] bytes;
            //       finalString = "<issue><project_id>65</project_id><subject>Testing47</subject><priority_id>2</priority_id><status_id>1</status_id><tracker_id>14</tracker_id></issue>";
            bytes = System.Text.Encoding.ASCII.GetBytes(finalString);
            request.ContentType = "application/xml; encoding='utf-8'";
            request.ContentLength = bytes.Length;
            request.Method = "POST";
            Stream requestStream = request.GetRequestStream();
            requestStream.Write(bytes, 0, bytes.Length);
            requestStream.Close();
            HttpWebResponse response;
            response = (HttpWebResponse)request.GetResponse();
            Uri res = (Uri)response.ResponseUri;
            return response.StatusCode.ToString();
              //  return json;
        }
コード例 #40
0
 public void cmdNew_Click(object sender, EventArgs e)
 {
     currentEstimate = CreateEstimate();
     FillForm();
 }
コード例 #41
0
    private void BindControls(Estimate.Filter inFilter)
    {
        if(inFilter == Estimate.Filter.Active)
        {
            lstEstimates.DataSource = Estimate.GetActive();
        }
        else
        {
            lstEstimates.DataSource = Estimate.GetAll();
        }
        lstEstimates.DataTextField = "DisplayText";
        lstEstimates.DataValueField = "EstId";
        lstEstimates.DataBind();

        ddlPhysicsBasis.DataBind();

        lstEstimates.Items[0].Selected = true;

        currentEstimate = new Estimate(lstEstimates.SelectedValue);
        currentProspect = new Project(currentEstimate.JobName);
        currentEstimator = new User(currentEstimate.Estimator);
        currentSalesperson = new User(currentProspect.SalespersonID);

        // Workflow step dropdown
        ddlWorkflowStep.DataSource = Workflow.GetRemainingStepsForEstimate(currentEstimate.StepID);
        ddlWorkflowStep.DataTextField = "Action";
        ddlWorkflowStep.DataValueField = "ID";
        ddlWorkflowStep.DataBind();

        // Current estimate Timeline listbox
        lstTimeline.DataSource = Estimate.GetCurrentEstimateTimeline(currentEstimate.Id);
        lstTimeline.DataTextField = "DisplayText";
        lstTimeline.DataValueField = "Id";
        lstTimeline.DataBind();
        lstTimeline.SelectedIndex = 0;

        // Estimator dropdown list
        ddlEstimator.DataSource = DAL.User.GetUsersByTitle("Estimator");
        ddlEstimator.DataTextField = "Name";
        ddlEstimator.DataValueField = "Id";
        ddlEstimator.DataBind();

        if(ddlWorkflowStep.SelectedItem != null) PopulateResponsibleUserList(int.Parse(ddlWorkflowStep.SelectedItem.Value), "Add");

        // Room and Door Lists
        lstDoors.DataSource = DAL.Estimate.GetDoors(currentEstimate.Id);
        lstDoors.DataTextField = "DisplayText";
        lstDoors.DataValueField = "Id";
        lstDoors.DataBind();

        lstVaults.DataSource = DAL.Estimate.GetRooms(currentEstimate.Id);
        lstVaults.DataTextField = "DisplayText";
        lstVaults.DataValueField = "Id";
        lstVaults.DataBind();

        FillForm();
    }
コード例 #42
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(customXertificateValidation);

            Label lblHeading;
            lblHeading = (Label)Master.FindControl("lblPageHeading");
            lblHeading.Text = "Veritas - Estimating - Estimate Tracking";

            txtAdditionalInformation.Enabled = false;

            BindControls(Estimate.Filter.Active);
        }
        else
        {
            if (currentEstimate == null)
                currentEstimate = new Estimate(lstEstimates.SelectedItem.Value);
            if (currentProspect == null)
                currentProspect = new Project(currentEstimate.JobName);
            if (currentSalesperson == null)
                currentSalesperson = new User(currentProspect.SalespersonID);
            if (currentEstimator == null)
                currentEstimator = new User(currentEstimate.Estimator);
        }
    }
コード例 #43
0
        public void Insert(int? Priority,int JobName,string EstimateNumber,bool ReadyForEstimating,DateTime? EstimateDate,string Contact,string ContactEmail,DateTime? Received,DateTime? BidDueDate,int? Estimator,string EstimatesDirectory,string ProspectDirectory,DateTime? ResponseRequestedBy,bool EstimateSent,DateTime? EstimateSentDate,decimal? EstimateTotal,decimal? DoorsTotal,decimal? InteriorsTotal,decimal? BunkerTotal,int StatusID,int StepID,string CurrentStatus,string DoorScope,string InteriorScope,string BunkerScope,string BunkerTitle,string DesignBasis,string LaborType,string PhysicsBasis,string BunkerClarifications,bool? Drawings,bool? Prospectus,bool? TxParameters,string EstimateDescription,int? SupplementalBlockCount,int? InteriorsQty)
        {
            Estimate item = new Estimate();

            item.Priority = Priority;

            item.JobName = JobName;

            item.EstimateNumber = EstimateNumber;

            item.ReadyForEstimating = ReadyForEstimating;

            item.EstimateDate = EstimateDate;

            item.Contact = Contact;

            item.ContactEmail = ContactEmail;

            item.Received = Received;

            item.BidDueDate = BidDueDate;

            item.Estimator = Estimator;

            item.EstimatesDirectory = EstimatesDirectory;

            item.ProspectDirectory = ProspectDirectory;

            item.ResponseRequestedBy = ResponseRequestedBy;

            item.EstimateSent = EstimateSent;

            item.EstimateSentDate = EstimateSentDate;

            item.EstimateTotal = EstimateTotal;

            item.DoorsTotal = DoorsTotal;

            item.InteriorsTotal = InteriorsTotal;

            item.BunkerTotal = BunkerTotal;

            item.StatusID = StatusID;

            item.StepID = StepID;

            item.CurrentStatus = CurrentStatus;

            item.DoorScope = DoorScope;

            item.InteriorScope = InteriorScope;

            item.BunkerScope = BunkerScope;

            item.BunkerTitle = BunkerTitle;

            item.DesignBasis = DesignBasis;

            item.LaborType = LaborType;

            item.PhysicsBasis = PhysicsBasis;

            item.BunkerClarifications = BunkerClarifications;

            item.Drawings = Drawings;

            item.Prospectus = Prospectus;

            item.TxParameters = TxParameters;

            item.EstimateDescription = EstimateDescription;

            item.SupplementalBlockCount = SupplementalBlockCount;

            item.InteriorsQty = InteriorsQty;

            item.Save(UserName);
        }
コード例 #44
0
    protected void lstSalesQueue_SelectedIndexChanged(object sender, EventArgs e)
    {
        activeSalesQueueItem = new Estimate(lstSalesQueue.SelectedValue);
        Cache["ActiveEstimate"] = activeSalesQueueItem;

        rdoDrawings.SelectedValue = Utils.NullableBoolToRadioButton(activeSalesQueueItem.Drawings);
        rdoProspectus.SelectedValue = Utils.NullableBoolToRadioButton(activeSalesQueueItem.Prospectus);
        rdoTxParams.SelectedValue = Utils.NullableBoolToRadioButton(activeSalesQueueItem.TxParameters);
        txtEstDueDate.Text = activeSalesQueueItem.BidDueDate.ToString();

        cmdSubmitEst.Enabled = activeSalesQueueItem.BidDueDate != null;

        currentProspect = Project.GetLeadByID(activeSalesQueueItem.JobName);
        currentSalesperson = new User(currentProspect.SalespersonID);
        currentEstimator = new User(activeSalesQueueItem.Estimator);
    }