Esempio n. 1
0
 public Factors()
 {
     InitializeComponent();
     _uow            = new Context();
     _factorService  = new FactorService(_uow);
     _productService = new ProductService(_uow);
     _factorGrid     = new FactorGridView(dgvFactors);
     ShowFactors();
 }
Esempio n. 2
0
 public Order()
 {
     InitializeComponent();
     _uow                 = new Context();
     _productService      = new ProductService(_uow);
     _factorService       = new FactorService(_uow);
     _factorDetailService = new FactorDetailService(_uow);
     _orderGrid           = new FactorDetailsGridView(dgvFactorDetails);
 }
Esempio n. 3
0
 private void StopRecording()
 {
     AudioRecordService.Stop();
     _metadataService.SaveNewMetadataFile(RecordingContext.filename,
                                          RecordingContext.startedAt,
                                          ConfigService.AudioFrequency,
                                          ConfigService.AudioBitrate,
                                          FactorService.GetContext(),
                                          null);
 }
Esempio n. 4
0
 public Main()
 {
     InitializeComponent();
     _uow                 = new Context();
     _productService      = new ProductService(_uow);
     _factorService       = new FactorService(_uow);
     _dailyFactors        = new DailyFactorGridView(dgvFactors);
     _availableProducts   = new AvailableProductGridView(dgvAvailableProduct);
     comboBox1.DataSource = _productService.GetUnAvailableProductNames();
     Text                 = Service.GetCurrentRestaurant().Name;
     ShowProducts();
     ShowFactors();
 }
Esempio n. 5
0
 private void AddFactorCheckboxes(View view)
 {
     foreach (var factor in Factors)
     {
         CheckBox cb = new CheckBox(view.Context);
         cb.SetText(factor, BufferType.Normal);
         LinearLayout ll = (LinearLayout)view.FindViewById(Resource.Id.factorsLinearLayout);
         ll.AddView(cb);
         cb.Click += delegate
         {
             FactorService.UpdateContext(factor, cb.Checked);
         };
     }
 }
Esempio n. 6
0
        protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
        {
            DataRowView item = e.DataItem as DataRowView;

            if (e.RowIndex != (Grid1.DataSource as DataTable).Rows.Count - 1)
            {
                string      Fcode = item["FCode"].ToString();
                LHTubePrice price = CustomerpriceService.Where(p => p.FCode == txtFCode.Text && p.FBill == "销售").FirstOrDefault();


                decimal payW = string.IsNullOrWhiteSpace(item["FPayTemperature"].ToString()) ? 0 : Convert.ToDecimal(item["FPayTemperature"].ToString());
                decimal payY = string.IsNullOrWhiteSpace(item["FPayPressure"].ToString()) ? 0 : Convert.ToDecimal(item["FPayPressure"].ToString());

                decimal recW = string.IsNullOrWhiteSpace(item["FReceiveTemperature"].ToString()) ? 0 : Convert.ToDecimal(item["FReceiveTemperature"].ToString());
                decimal recY = string.IsNullOrWhiteSpace(item["FReceivePressure"].ToString()) ? 0 : Convert.ToDecimal(item["FReceivePressure"].ToString());


                double dpayW = string.IsNullOrWhiteSpace(item["FPayTemperature"].ToString()) ? 0 : Convert.ToDouble(item["FPayTemperature"].ToString());
                double dpayY = string.IsNullOrWhiteSpace(item["FPayPressure"].ToString()) ? 0 : Convert.ToDouble(item["FPayPressure"].ToString());

                double drecW = string.IsNullOrWhiteSpace(item["FReceiveTemperature"].ToString()) ? 0 : Convert.ToDouble(item["FReceiveTemperature"].ToString());
                double drecY = string.IsNullOrWhiteSpace(item["FReceivePressure"].ToString()) ? 0 : Convert.ToDouble(item["FReceivePressure"].ToString());

                decimal v = Convert.ToDecimal(item["waterspace"].ToString());

                string fmeno = item["FMemo"].ToString();
                Regex  reg   = new Regex("[*][0-9]{0,2}[支]");
                if (reg.IsMatch(fmeno))
                {
                    fmeno = fmeno.Replace(reg.Match(fmeno).Value, "");
                }
                if (!string.IsNullOrWhiteSpace(fmeno))
                {
                    e.Values[2] = fmeno;
                }
                //压缩因子
                string FZ1 = "0";
                string FZ2 = "0";

                //取压缩因子系数

                //客户专用压缩因子
                LHFactor startFZ = FactorService.Where(p => p.FCompanyCode == txtFCode.Text && p.FTemperature == payW && p.FBar == payY).FirstOrDefault();
                LHFactor EndFZ   = FactorService.Where(p => p.FCompanyCode == txtFCode.Text && p.FTemperature == recW && p.FBar == recY).FirstOrDefault();
                //通用压缩因子
                LHFactor TSFZ = FactorService.Where(p => p.FCompanyCode == "" && p.FTemperature == payW && p.FBar == payY).FirstOrDefault();
                LHFactor TEFZ = FactorService.Where(p => p.FCompanyCode == "" && p.FTemperature == recW && p.FBar == recY).FirstOrDefault();
                //通用赋值
                if (TSFZ != null)
                {
                    FZ1 = TSFZ.FDivisor.ToString(CultureInfo.InvariantCulture);
                }
                if (TEFZ != null)
                {
                    FZ2 = TEFZ.FDivisor.ToString(CultureInfo.InvariantCulture);
                }
                //专用赋值
                if (startFZ != null)
                {
                    FZ1 = startFZ.FDivisor.ToString(CultureInfo.InvariantCulture);
                }
                if (startFZ != null)
                {
                    FZ2 = EndFZ.FDivisor.ToString(CultureInfo.InvariantCulture);
                }


                //取客户对应排管车罐号、水溶积
                LHWaterSpace waterSpace = WatorSpaceService.Where(p => p.FCompanyCode == txtFCode.Text && p.FGCode == fmeno).FirstOrDefault();
                if (waterSpace != null)
                {
                    e.Values[2] = waterSpace.FChassisNo;
                    e.Values[3] = waterSpace.FGCode;
                    e.Values[3] = waterSpace.FGCode;
                    v           = waterSpace.FM3;
                }

                string[]      c1 = price.FFormula.Replace("\n", "").Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                string        s1 = c1[0].Replace("\n", "");
                decimal       qt;
                int           i     = 1;
                List <object> clist = new List <object>();
                while (i < c1.Length)
                {
                    string   cq = "";                                                                     //替换后公式
                    string[] sp = c1[i].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); //提取表达式及保留小数位数
                    string[] sp1;
                    if (i + 1 < c1.Length)
                    {
                        sp1 = c1[i + 1].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); //提取表达式及保留小数位数
                        cq  = sp1[0].Replace("$W3", payW.ToString(CultureInfo.InvariantCulture))          //
                              .Replace("$W4", recW.ToString(CultureInfo.InvariantCulture))                //
                              .Replace("$Y3", payY.ToString(CultureInfo.InvariantCulture))                //
                              .Replace("$Y4", recY.ToString(CultureInfo.InvariantCulture))                //
                              .Replace("$Y4", recY.ToString(CultureInfo.InvariantCulture))                //
                              .Replace("$YZ1", FZ1)                                                       //
                              .Replace("$YZ2", FZ2)                                                       //
                              .Replace("$V", v.ToString(CultureInfo.InvariantCulture))
                              .Replace("\n", "");

                        qt = Convert.ToDecimal(FormulaCalculator.Eval(cq));
                        if (sp1[1].ToString() != "0")
                        {
                            qt = Math.Round(qt, int.Parse(sp1[1]));
                        }
                        sp[0] = string.Format(sp[0], qt);
                        //计算替换公式
                        qt = Convert.ToDecimal(FormulaCalculator.Eval(sp[0]));
                        if (sp[1].ToString() != "0")
                        {
                            qt = Math.Round(qt, int.Parse(sp[1]));
                        }
                        clist.Add(qt.ToString());
                        i = i + 2;
                    }
                    else
                    {
                        sp = c1[i + 1].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); //提取表达式及保留小数位数
                        cq = sp[0].Replace("$W3", payW.ToString(CultureInfo.InvariantCulture))           //
                             .Replace("$W4", recW.ToString(CultureInfo.InvariantCulture))                //
                             .Replace("$Y3", payY.ToString(CultureInfo.InvariantCulture))                //
                             .Replace("$Y4", recY.ToString(CultureInfo.InvariantCulture))                //
                             .Replace("$Y4", recY.ToString(CultureInfo.InvariantCulture))                //
                             .Replace("$YZ1", FZ1)                                                       //
                             .Replace("$YZ2", FZ2)                                                       //
                             .Replace("$V", v.ToString(CultureInfo.InvariantCulture))
                             .Replace("\n", "");

                        qt = Convert.ToDecimal(FormulaCalculator.Eval(cq));
                        if (sp[1].ToString() != "0")
                        {
                            qt = Math.Round(qt, int.Parse(sp[1]));
                        }
                        sp[0] = string.Format(sp[0], qt);
                        clist.Add(qt.ToString());
                    }
                }
                //   string [] sp= c1[i].Split(new char[]{','},StringSplitOptions.RemoveEmptyEntries);
                //  string cp= sp[0].Replace("$W3", payW.ToString(CultureInfo.InvariantCulture))//
                //                       .Replace("$W4", recW.ToString(CultureInfo.InvariantCulture))//
                //                       .Replace("$Y3", payY.ToString(CultureInfo.InvariantCulture))//
                //                       .Replace("$Y4", recY.ToString(CultureInfo.InvariantCulture))//
                //                       .Replace("$Y4", recY.ToString(CultureInfo.InvariantCulture))//
                //                       .Replace("$YZ1", FZ1)//
                //                       .Replace("$YZ2", FZ2)//
                //                       .Replace("$V", v.ToString(CultureInfo.InvariantCulture));
                //  decimal qt = Convert.ToDecimal(FormulaCalculator.Eval(cp));
                //  if (sp[1].ToString()!="0")
                //  {
                //      qt = Math.Round(qt, int.Parse(sp[1]));
                //  }
                //  s1 = string.Format(s1,qt);
                //}

                //计算容积 最终结果
                c1[0] = string.Format(c1[0], clist.ToArray());
                string cp = c1[0].Replace("$W3", payW.ToString(CultureInfo.InvariantCulture)) //
                            .Replace("$W4", recW.ToString(CultureInfo.InvariantCulture))      //
                            .Replace("$Y3", payY.ToString(CultureInfo.InvariantCulture))      //
                            .Replace("$Y4", recY.ToString(CultureInfo.InvariantCulture))      //
                            .Replace("$Y4", recY.ToString(CultureInfo.InvariantCulture))      //
                            .Replace("$YZ1", FZ1)                                             //
                            .Replace("$YZ2", FZ2)                                             //
                            .Replace("$V", v.ToString(CultureInfo.InvariantCulture));

                decimal qty = Convert.ToDecimal(FormulaCalculator.Eval(cp));
                e.Values[9] = decimal.Round(qty, 2);
                Totalm3    += qty;
                //计算金额
                if (!string.IsNullOrWhiteSpace(txtPrice.Text))
                {
                    e.Values[10] = decimal.Parse(txtPrice.Text);
                }
                e.Values[11] = decimal.Round(qty * decimal.Parse(e.Values[10].ToString()), 3);
                TotallPrice += decimal.Parse(e.Values[11].ToString());
                //LHCustomerPrice price = CustomerpriceService.Where(p => p.FCode == item["FCode"].ToString(),o=>o.FCreateDate,OrderingOrders.DESC).FirstOrDefault();
            }
            else
            {
                e.Values[9]  = string.Format("<span style=\"color:{0}\">{1}</span>", "red", decimal.Round(Totalm3, 2));
                e.Values[11] = string.Format("<span style=\"color:{0}\">{1}</span>", "red", decimal.Round(TotallPrice, 2));
            }
            //e.Values[3] = string.Format("<span class=\"{0}\">{1}</span>", "colorred", "");
            //e.Values[4] = string.Format("<span class=\"{0}\">{1}</span>", "colorred", "");
        }