Ejemplo n.º 1
0
        private bool Validate(int cost, out Dictionary <string, object> result)
        {
            result = new Dictionary <string, object>();
            if (cost < 0)
            {
                return(false);
            }

            if (this.txtLimitPrice.Text.Trim() == "")
            {
                MsgBox.Alert("上限控制价不能为空!");
                this.txtLimitPrice.Focus();
                return(false);
            }

            decimal limitPrice = 0;

            decimal.TryParse(this.txtLimitPrice.Text.Trim(), out limitPrice);

            var     rows            = this.pInfo.Current.StructSource.ModelProjVariable.Select("Key='ZZJ' and ID = 0");
            decimal totalProjectFee = 0;

            if (rows.Length > 0)
            {
                totalProjectFee = decimal.Parse(rows[0]["value"].ToString());
            }

            rows = this.pInfo.Current.StructSource.ModelProjVariable.Select("Key='CSXMF' and ID = 0");
            decimal totalMeasureFee = 0;

            if (rows.Length > 0)
            {
                totalMeasureFee = decimal.Parse(rows[0]["value"].ToString());
            }

            decimal totalSubsegmentFee = 0;

            rows = this.pInfo.Current.StructSource.ModelProjVariable.Select("Key='FBFXHJ' and ID = 0");
            if (rows.Length > 0)
            {
                totalSubsegmentFee = decimal.Parse(rows[0]["value"].ToString());
            }

            rows = this.pInfo.Current.StructSource.ModelSubSegments.Select("LB='清单'");
            var quotaCount = rows.Length;

            var lockNumber = APP.GoldSoftClient.GlodSoftDiscern.CurrNo;

            var args = new
            {
                limitPrice         = limitPrice,
                totalProjectFee    = totalProjectFee,
                totalMeasureFee    = totalMeasureFee,
                quotaCount         = quotaCount,
                lockNumber         = lockNumber,
                totalSubsegmentFee = totalSubsegmentFee,
                publish            = APP.GoldSoftClient.Invite_Publish,
                mines = APP.GoldSoftClient.My_Count
            };


            Bid bid = new Bid();

            result = JsonConvert.DeserializeObject <Dictionary <string, object> >(JsonConvert.SerializeObject(bid.Check(JsonConvert.SerializeObject(args))));
            if (result == null)
            {
                MessageBox.Show("服务器出现错误");
                return(false);
            }

            var error = result["error"] + "";

            if (string.IsNullOrEmpty(error) == false)
            {
                Record(cost, error);
                return(false);
            }

            APP.GoldSoftClient.KCJF    = int.Parse(result["cost"] + "");
            APP.GoldSoftClient.ZZJ     = totalProjectFee;
            APP.GoldSoftClient.FBFXHJ  = totalSubsegmentFee;
            APP.GoldSoftClient.CSXMHJ  = totalMeasureFee;
            APP.GoldSoftClient.QDZJ_TB = quotaCount;


            return(true);

            //rows = this.pInfo.Current.StructSource.ModelProjVariable.Select("Key='ZZJ' and ID = 0");
            //if (rows.Length <= 0)
            //{
            //    Record(cost, "总造价为0,项目文件不符合调标要求!");
            //    return false;
            //}


            //rows = this.pInfo.Current.StructSource.ModelProjVariable.Select("Key='FBFXHJ' and ID = 0");
            //if (rows.Length > 0)
            //{

            //}


            //if (decimal.Parse(this.txtLimitPrice.Text.Trim()) < APP.GoldSoftClient.ZZJ)
            //{
            //    Record(cost, "上限控制价不能小于总造价!");
            //    this.txtLimitPrice.Focus();
            //    return false;
            //}

            //rows = this.pInfo.Current.StructSource.ModelProjVariable.Select("Key='CSXMF' and ID = 0");
            ////rows = this.pInfo.Current.StructSource.ModelProjMetaanalysis.Select("");
            //if (rows.Length <= 0)
            //{
            //    Record(cost, "措施项目合计为0,项目文件不符合调标要求!");
            //    return false;
            //}


            //decimal xs = Math.Abs(decimal.Parse(APP.GoldSoftClient.QDJJTB.Tables["TBKZ"].Rows[0]["CSFBL"].ToString()));
            //if (APP.GoldSoftClient.CSXMHJ <= (APP.GoldSoftClient.ZZJ * xs))//TBKZ
            //{

            //    Record(cost, "措施项目合计必须大于总造价乘以 " + xs.ToString() + ", 项目文件不符合调标要求!");
            //    return false;
            //}


            //rows = this.pInfo.Current.StructSource.ModelSubSegments.Select("LB='清单'");
            //int qdsl = int.Parse(APP.GoldSoftClient.QDJJTB.Tables["TBKZ"].Rows[0]["QDSL"].ToString());
            //if (rows.Length < qdsl)
            //{
            //    Record(cost, "单位工程至少包含 " + qdsl.ToString() + " 清单个数不符合调标要求!");
            //    return false;
            //}


            //if (APP.GoldSoftClient.QDJJTB.Tables["TBKZ"].Rows[0]["KZSH"].ToString().Contains(APP.GoldSoftClient.GlodSoftDiscern.CurrNo))
            //{
            //    Record(cost, "当前锁号没有权限进行调标操作!");
            //    this.Close();
            //    return false;
            //}



            return(true);
        }