/// <summary> /// 项目调用 统计到单项工程-2 和 项目-3 /// </summary> public void Statistics() { DataView table = this.ModelProject.DefaultView; _VariableSource t1 = null; foreach (DataRowView row in table) { //单项工程统计 if (row["DEEP"].Equals(1)) { int EnID = ToolKit.ParseInt(row["ID"]); t1 = _VariableSource.CreateInstance(EnID, -2); foreach (DataRow dr in t1.Rows) { dr["Value"] = this.ModelProjVariable.Compute("sum(Value)", string.Format(" EnID = '{0}' and Key = '{1}' and Type = -1", EnID, dr["Key"])); dr["EnID"] = EnID; dr["ID"] = EnID; } this.ModelProjVariable.MergeData(t1, false); } } t1 = _VariableSource.CreateInstance(-1, -3); foreach (DataRow dr in t1.Rows) { dr["Value"] = this.ModelProjVariable.Compute("sum(Value)", string.Format(" Key = '{0}' and Type = -2", dr["Key"])); dr["EnID"] = -1; dr["ID"] = 0; } this.ModelProjVariable.MergeData(t1, false); }
/// <summary> /// 为指定单位工程重新设置关系数据(导入单位工程的时候使用) /// </summary> /// <param name="p_ObjectKey"></param> /// <param name="p_Info"></param> public override void SetNewFiled(ref int p_ObjectKey, _UnitProject p_Info) { //同步定单位工程的关系数据 //分部分项处理 int i = 0; DataView view = this.DefaultView; view.Sort = "ID asc"; foreach (DataRowView row in view) { ///设置为新增的对象 row.Row.SetAdded(); if (row["LB"].Equals("分部-章") || row["LB"].Equals("分部-节") || row["LB"].Equals("分部-专业")) { } else { row["Key"] = p_ObjectKey + ToolKit.ParseInt(row["ID"]); row["PKey"] = p_ObjectKey + ToolKit.ParseInt(row["FPARENTID"]); } row["UnID"] = p_Info.ID; row["EnID"] = p_Info.PID; if (i == 0) { row["PKey"] = p_Info.PKey; } i++; } p_ObjectKey = ToolKit.ParseInt(view[view.Count - 1]["Key"]); view.Sort = string.Empty; }
/// <summary> /// 通过定额库给定额赋值 /// </summary> /// <param name="info"></param> /// <param name="dr"></param> /// <param name="Libname"></param> public void SetSubheadingsInfo(_ObjectInfo info, DataRow dr, string Libname) { info.XMBM = dr[CEntity定额表.FILED_DINGEH].ToString(); info.XMMC = dr[CEntity定额表.FILED_DINGEMC].ToString(); info.OLDXMBM = dr[CEntity定额表.FILED_DINGEH].ToString(); info.TX = dr[CEntity定额表.FILED_TX1].ToString(); info.DW = dr[CEntity定额表.FILED_DINGEDW].ToString(); info.LB = "子目"; info.XMTZ = ""; info.GCLJSS = ""; info.HL = 0.00m; info.GCL = 1; info.ZHDJ = ToolKit.ParseDecimal(dr[CEntity定额表.FILED_DINGEJJ].ToString()); info.RGFDJ = ToolKit.ParseDecimal(dr[CEntity定额表.FILED_RENGF].ToString()); info.CLFDJ = ToolKit.ParseDecimal(dr[CEntity定额表.FILED_CAILF].ToString()); info.JXFDJ = ToolKit.ParseDecimal(dr[CEntity定额表.FILED_JIXF].ToString()); info.LibraryName = Libname; info.DECJ = dr[CEntity定额表.FILED_DECJ].ToString(); info.JX = dr[CEntity定额表.FILED_JIANGX].ToString() == "是" ? true : false; if (dr[CEntity定额表.FILED_TX1].ToString() == "模板") { info.SC = false; } else { info.SC = true; } }
/// <summary> /// 统计当前的父行计算结果 /// </summary> /// <param name="row"></param> public void SetCurrentParent(DataRow row) { //1.当前父节点是否为0 //2.若不是0统计所有当前父节点的数据求和 //3.赋值给父节点 int id = ToolKit.ParseInt(row["ParentID"]); if (id != 0) { decimal d = 0m; decimal d1 = 0m; DataRow[] rows = this.m_Source.Select(string.Format(" ParentID = {0}", id)); foreach (DataRow item in rows) { if (!string.IsNullOrEmpty(item["Combinedprice"].ToString())) { d += ToolKit.ParseDecimal(item["Combinedprice"]); } if (!string.IsNullOrEmpty(item["cjhj"].ToString())) { d1 += ToolKit.ParseDecimal(item["cjhj"]); } } DataRow r = this.m_Source.Rows.Find(id); r.BeginEdit(); r["Combinedprice"] = d; r["cjhj"] = d1; r.EndEdit(); SetCurrentParent(r); } }
/// <summary> /// 设置一个变量 /// </summary> /// <param name="key">变量主键</param> /// <param name="value">变量值</param> /// <param name="remark">变量说明</param> public void Set(int p_ID, int p_Type, string key, object value, string remark, string p_fylb, bool p_ISDE) { DataRow row = this.Rows.Find(new object[] { key, p_ID, p_Type }); if (row == null) { row = this.NewRow(); row.BeginEdit(); row["Key"] = key; row["Value"] = ToolKit.ParseDecimal(value).ToString(Median); row["Remark"] = remark; row["FYLB"] = p_fylb; row["Length"] = key.Length; row["ISDE"] = p_ISDE; row["Type"] = p_Type; row["ID"] = p_ID; row.EndEdit(); this.Rows.Add(row); } else { row.BeginEdit(); row["Key"] = key; row["Value"] = ToolKit.ParseDecimal(value).ToString(Median); row["Remark"] = remark; row["FYLB"] = p_fylb; row["Length"] = key.Length; row["ISDE"] = p_ISDE; row["Type"] = p_Type; row["ID"] = p_ID; row.EndEdit(); } }
/// <summary> /// 插入一条新的用户价格 /// </summary> /// <param name="p_Info">当前修改对象</param> /// <param name="p_BH">指定编号:如果是 string.Empty 则获取新编号 否则是指定编号</param> public void Insert(DataRow p_Info, string p_BH) { _UserPriceLibraryInfo newinfo = new _UserPriceLibraryInfo(); newinfo.YSBH = p_Info["YSBH"].ToString(); newinfo.YSDW = p_Info["YSDW"].ToString(); newinfo.YSMC = p_Info["YSMC"].ToString(); newinfo.YSXHL = ToolKit.ParseDecimal(p_Info["YSXHL"]); newinfo.ZCLB = p_Info["ZCLB"].ToString(); newinfo.BH = p_BH == string.Empty ? GetNumber(p_Info) : p_BH; //如果是 string.Empty 则获取新编号 否则是指定编号 newinfo.DEDJ = ToolKit.ParseDecimal(p_Info["DEDJ"]); newinfo.LB = p_Info["LB"].ToString(); newinfo.MC = this.FieldName == "MC" ? p_Info["MC", DataRowVersion.Proposed].ToString() : p_Info["MC"].ToString(); newinfo.DW = this.FieldName == "DW" ? p_Info["DW", DataRowVersion.Proposed].ToString() : p_Info["DW"].ToString(); newinfo.XHL = ToolKit.ParseDecimal(p_Info["XHL"]); newinfo.SCDJ = this.FieldName == "SCDJ" ? ToolKit.ParseDecimal(p_Info["SCDJ", DataRowVersion.Proposed]) : ToolKit.ParseDecimal(p_Info["SCDJ"]); newinfo.SL = ToolKit.ParseDecimal(p_Info["SL"]); newinfo.GGXH = p_Info["GGXH"].ToString(); newinfo.SSDWGC = this.Activitie.Name; //newinfo.SSKLB = p_Info["SSKLB"].ToString(); newinfo.SSLB = ToolKit.ParseInt(p_Info["SSLB"]); this.m_UserPriceLibraryList.Add(newinfo); //执行范围修改 设置新的编号 EditPart(p_Info, newinfo.BH); }
/// <summary> /// 指定对象添加到当前数据源对象中(如果对象名称与类名称相互对应此方法可用) /// 需要指定一个DataTable /// </summary> /// <param name="p_Info"></param> public static int Add(object p_Info, DataTable p_Table) { DataRow row = p_Table.NewRow(); Type tp = p_Info.GetType(); row.BeginEdit(); //循环列添加数据对象 foreach (DataColumn col in p_Table.Columns) { PropertyInfo info = tp.GetProperty(col.ColumnName); if (info != null) { if (info.Name != "ID") { row[col] = Convert.ChangeType(info.GetValue(p_Info, null), info.PropertyType); } } } row.EndEdit(); p_Table.Rows.Add(row); PropertyInfo pi = tp.GetProperty("ID"); if (pi != null) { pi.SetValue(p_Info, ToolKit.ParseInt(row["ID"]), null); } return(ToolKit.ParseInt(row["ID"])); }
/// <summary> /// 获取当前集合指定行的实体对象 /// </summary> /// <param name="index">集合中行的索引</param> /// <returns>相关的实体对象(没有记录则返回空)</returns> public CEntityTransitPriceLibrary this[int index] { get { //如果前一次执行已经转换过当前索引则直接返回 if (index == this.m_index) { return(this.m_CEntityTransitPriceLibrary); } if (this.Rows.Count > 0) { m_CEntityTransitPriceLibrary = new CEntityTransitPriceLibrary(); m_CEntityTransitPriceLibrary.ID = ToolKit.ParseInt(this.Rows[index][CEntityTransitPriceLibrary.FILED_ID]); m_CEntityTransitPriceLibrary.CAIJBH = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityTransitPriceLibrary.FILED_CAIJBH]); m_CEntityTransitPriceLibrary.LIBRARYTYPE = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityTransitPriceLibrary.FILED_LIBRARYTYPE]); m_CEntityTransitPriceLibrary.SOURCE = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityTransitPriceLibrary.FILED_SOURCE]); m_CEntityTransitPriceLibrary.ADDTYPE = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityTransitPriceLibrary.FILED_ADDTYPE]); m_CEntityTransitPriceLibrary.ADDCOUNT = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityTransitPriceLibrary.FILED_ADDCOUNT]); this.m_index = index; return(m_CEntityTransitPriceLibrary); } return(null); } set { this.Rows[index][CEntityTransitPriceLibrary.FILED_ID] = value.ID; this.Rows[index][CEntityTransitPriceLibrary.FILED_CAIJBH] = value.CAIJBH; this.Rows[index][CEntityTransitPriceLibrary.FILED_LIBRARYTYPE] = value.LIBRARYTYPE; this.Rows[index][CEntityTransitPriceLibrary.FILED_SOURCE] = value.SOURCE; this.Rows[index][CEntityTransitPriceLibrary.FILED_ADDTYPE] = value.ADDTYPE; this.Rows[index][CEntityTransitPriceLibrary.FILED_ADDCOUNT] = value.ADDCOUNT; } }
/// <summary> /// 统计并计算子节点 /// </summary> private void calculateChilden(DataRow row) { DataRow[] rows = this.m_Source.Select(string.Format("ParentID = {0}", row["ID"])); if (rows.Length == 0) { if (row["Feature"].ToString() == "ZZJ") { int i = 0; } //直接计算 string str = ToolKit.ExpressionReplace(row["Calculation"].ToString(), this.Parent.Property.Statistics.ResultVarable.DataSource); //完成统计 //decimal d = ToolKit.Calculate(str); decimal d = 0; using (DataTable table = new DataTable()) { try { d = ToolKit.ParseDecimal(table.Compute(str, string.Empty)); } catch { d = 0; } } //decimal d = ToolKit.Expression(str); //费率若小于 0 大于 100 按照100计算 decimal coe = ToolKit.ParseDecimal(row["Coefficient"]); if (coe < 0 || coe > 100) { coe = 100; } d = d * coe * 0.01M; //结果赋值 row.BeginEdit(); row["Price"] = d; row.EndEdit(); //添加到结果集合(汇总分析此处修改添加列特项进入参数列表) //this.Parent.Statistics.ResultVarable.Set(row["Number"].ToString(), d, row["Remark"].ToString()); this.Parent.Property.Statistics.ResultVarable.Set(row["Feature"].ToString(), d, row["Remark"].ToString()); } else { //继续计算(有孩子继续计算 并且统计当前节点) foreach (DataRow r in rows) { this.calculateChilden(r); //SetCurrentParent(r); } //计算完成后统计当前节点 this.SetCurrentParent(row); if (isRate(row)) { this.SetRate(row); } } }
/// <summary> /// 指定对象添加到当前数据源对象中(如果对象名称与类名称相互对应此方法可用) /// </summary> /// <param name="p_Info"></param> public virtual int AddNotInt(object p_Info) { DataRow row = this.NewRow(); Type tp = p_Info.GetType(); row.BeginEdit(); //循环列添加数据对象 foreach (DataColumn col in this.Columns) { PropertyInfo info = tp.GetProperty(col.ColumnName); if (info != null) { { try { row[col] = Convert.ChangeType(info.GetValue(p_Info, null), info.PropertyType); } catch (Exception e) { throw e; } } } } row.EndEdit(); this.Rows.Add(row); return(ToolKit.ParseInt(row["ID"])); }
/// <summary> /// 根据计算表达式得到计算结果 /// </summary> /// <param name="value">计算式(比如:1*5+(2-1))</param> /// <returns></returns> public static decimal Calculate(string value) { using (DataTable table = new DataTable()) { try { return(ToolKit.ParseDecimal(table.Compute(value, string.Empty))); } catch { return(0m); } } //try //{ // decimal a = 0m; // sc.Language = "JavaScript"; // string str = sc.Eval(value.ToString()).ToString(); // decimal.TryParse(str, out a); // return a; //} //catch (Exception ex) //{ // return 0; //} }
public string GetRepairBH(_UnitProject p_CUnitProject, string p_LB) { DataRow[] list = p_CUnitProject.StructSource.ModelQuantity.Select(string.Format("BH like '%补充{0}%'", p_LB), "BH"); if (list.Count() == 0) { return("补充" + p_LB + "0001"); } for (int i = 0, j = 1; j < list.Count(); i++, j++) { int info_i = ToolKit.ParseInt(list[i]["BH"].ToString().Substring(4)); int info_j = ToolKit.ParseInt(list[j]["BH"].ToString().Substring(4)); if ((info_j - info_i) > 1) { return("补充" + p_LB + (info_i + 1).ToString("0000")); } } int info_b = ToolKit.ParseInt(list.First()["BH"].ToString().Substring(4)); if (info_b == 1) { return("补充" + p_LB + (ToolKit.ParseInt(list.Last()["BH"].ToString().Substring(4)) + 1).ToString("0000")); } else { return("补充" + p_LB + "0001"); } }
public virtual void Begin() { _SubheadingsInfo info = this.Parent as _SubheadingsInfo; if (info.ZJFS == _Constant.公式组价) { string str = info.JSJC; if (string.IsNullOrEmpty(str)) { str = "0"; } // this.Activitie.Property.Statistics.Begin(); str = ToolKit.ExpressionReplace(str, info.Activitie.Property.Statistics.ResultVarable.DataSource); decimal m = 1m; decimal.TryParse(info.FL, out m); decimal ZHHJ = ToolKit.Calculate(str) * m * info.GCL * 0.01m; this.ResultVarable.Set(_Statistics.FILED_ZHHJ, ZHHJ); if (this.Parent.GCL != 0m) { this.ResultVarable.Set(_Statistics.FILED_ZHDJ, info.ZHHJ / this.Parent.GCL); } } else { SetValue(); } #endregion SetValueToView();; }
/// <summary> /// 指定对象添加到当前数据源对象中(如果对象名称与类名称相互对应此方法可用) /// </summary> /// <param name="p_Info"></param> public int Add(object p_Info, int p_UnId, int p_EnID) { DataRow row = this.NewRow(); Type tp = p_Info.GetType(); row.BeginEdit(); string str = string.Empty; //循环列添加数据对象 foreach (DataColumn col in this.Columns) { str = col.ColumnName; if (str == "PID") { str = "PARENTID"; } PropertyInfo info = tp.GetProperty(str); if (info != null) { try { if (str == "PID") { row["PID"] = Convert.ChangeType(info.GetValue(p_Info, null), info.PropertyType); } else { row[col] = Convert.ChangeType(info.GetValue(p_Info, null), info.PropertyType); } } catch (Exception e) { throw e; } } } if (p_UnId != -1) { row["UnID"] = p_UnId; } if (p_EnID != -1) { row["EnID"] = p_EnID; } row.EndEdit(); this.Rows.Add(row); try { PropertyInfo pi = tp.GetProperty("ID"); if (pi != null) { pi.SetValue(p_Info, ToolKit.ParseInt(row["ID"]), null); } } catch (Exception e) { throw e; } return(ToolKit.ParseInt(row["ID"])); }
public static void WriteRelate(string Name, string APPkey) { RegistryKey root = Registry.ClassesRoot; //设置打开程序 root.CreateSubKey(Name).SetValue("", APPkey); //刷新桌面 ToolKit.SHChangeNotify(0x8000000, 0, IntPtr.Zero, IntPtr.Zero); }
/// <summary> /// 获取变量 /// </summary> /// <param name="key">变量值</param> /// <returns></returns> public decimal GetDecimal(int p_Type, string key) { DataRow row = this.Rows.Find(new object[] { key, p_Type }); if (row != null) { return(ToolKit.ParseDecimal(row["Value"])); } return(0); }
/// <summary> /// 1.检测并且初始化目录文件 /// 2.初始化各个缓存对象 /// </summary> /// <param name="p_AppFolder">应用程序目录</param> public void Init(DirectoryInfo p_AppFolder) { this.AppFolder = p_AppFolder; //1.检测目录是否存在 string dirName = p_AppFolder.FullName + "Cache"; DirectoryInfo info = ToolKit.GetDirectoryInfo(dirName); this.m_HistoryCache = _HistoryCache.CreateInstance(info); this.m_BaseReport = ExtractReport(); }
/// <summary> /// 计算 投标金额、标底金额 /// </summary> /// <param name="ifCpTBJE">是否计算投标金额</param> public void CalculateParentTBJE_BDJE() { IEnumerable <_SubheadingsFeeInfo> list = this.Parent.SubheadingsFeeList.Cast <_SubheadingsFeeInfo>().OrderBy(p => p.ID); foreach (_SubheadingsFeeInfo item in list) { string tbjsjc = ToolKit.ExpressionReplace(item.TBJSJC, this.Variable.DataSource); string bdjsjc = ToolKit.ExpressionReplace(item.BDJSJC, this.Variable.DataSource); switch (item.ID) { case 1: //人工 item.TBJE = (ToolKit.Calculate(tbjsjc)) * item.FL * 0.01m; item.BDJE = (ToolKit.Calculate(bdjsjc)) * item.FL * 0.01m; break; case 2: //材料 item.TBJE = (ToolKit.Calculate(tbjsjc)) * item.FL * 0.01m; item.BDJE = (ToolKit.Calculate(bdjsjc)) * item.FL * 0.01m; //用途类别材料 m_ResultValue.JGCL = m_ResultValue.JGCL * item.FL * 0.01m; m_ResultValue.YGCL = m_ResultValue.YGCL * item.FL * 0.01m; m_ResultValue.PBZDCL = m_ResultValue.PBZDCL * item.FL * 0.01m; m_ResultValue.ZDJCL = m_ResultValue.ZDJCL * item.FL * 0.01m; m_ResultValue.DEJGCL = m_ResultValue.DEJGCL * item.FL * 0.01m; m_ResultValue.DEYGCL = m_ResultValue.DEYGCL * item.FL * 0.01m; m_ResultValue.DEPBZDCL = m_ResultValue.DEPBZDCL * item.FL * 0.01m; m_ResultValue.DEZDJCL = m_ResultValue.DEZDJCL * item.FL * 0.01m; break; case 3: //机械 item.TBJE = (ToolKit.Calculate(tbjsjc)) * item.FL * 0.01m; item.BDJE = (ToolKit.Calculate(bdjsjc)) * item.FL * 0.01m; // m_ResultValue.DZJXTB = m_ResultValue.DZJXTB * item.FL * 0.01m; break; case 4: //主材 case 5: //设备 case 6: //风险 case 7: //直接费 case 8: //管理费 case 9: //利润 case 10: //子目单价 case 11: //合价 item.TBJE = ToolKit.Calculate(tbjsjc) * item.FL * 0.01m; item.BDJE = ToolKit.Calculate(bdjsjc) * item.FL * 0.01m; break; } this.DEVariable.Set(item.YYH, item.BDJE, item.MC, item.FYLB); this.Variable.Set(item.YYH, item.TBJE, item.MC, item.FYLB); } }
/// <summary> /// 行计算 数据行 /// </summary> /// <param name="p_info"></param> public void SummaryRowCalculate(DataRow p_info) { p_info["DJC"] = (ToolKit.ParseDecimal(p_info["SCDJ"]) - ToolKit.ParseDecimal(p_info["DEDJ"])).ToString("F2"); p_info["JSDJC"] = (p_info["JSDJ"].Equals(0m) ? 0m : ToolKit.ParseDecimal(p_info["JSDJ"]) - ToolKit.ParseDecimal(p_info["SCDJ"])).ToString("F2");; p_info["SLDEHJ"] = (ToolKit.ParseDecimal(p_info["DEDJ"]) * ToolKit.ParseDecimal(p_info["SLH"])).ToString("F2"); p_info["SLSCHJ"] = (ToolKit.ParseDecimal(p_info["SCDJ"]) * ToolKit.ParseDecimal(p_info["SLH"])).ToString("F2"); p_info["HJC"] = (ToolKit.ParseDecimal(p_info["DJC"]) * ToolKit.ParseDecimal(p_info["SLH"])).ToString("F2"); p_info["JSHJC"] = (p_info["JSDJ"].Equals(0m) ? 0m : ToolKit.ParseDecimal(p_info["JSDJC"]) * ToolKit.ParseDecimal(p_info["SLH"])).ToString("F2"); p_info["SDCHJ"] = (ToolKit.ParseDecimal(p_info["SDCXS"]) * ToolKit.ParseDecimal(p_info["SLH"])).ToString("F2"); p_info["DEHJ"] = (ToolKit.ParseDecimal(p_info["DEDJ"]) * ToolKit.ParseDecimal(p_info["XHL"])); p_info["SCHJ"] = (ToolKit.ParseDecimal(p_info["SCDJ"]) * ToolKit.ParseDecimal(p_info["XHL"])); }
public static void DelRelate(string Name) { RegistryKey root = Registry.ClassesRoot; if (root.OpenSubKey(Name) != null) { root.DeleteSubKeyTree(Name); } //刷新桌面 ToolKit.SHChangeNotify(0x8000000, 0, IntPtr.Zero, IntPtr.Zero); }
/// <summary> /// 计算 投标金额、标底金额 /// </summary> /// <param name="ifCpTBJE">是否计算投标金额</param> public void CalculateParentTBJE_BDJE() { IEnumerable <_SubheadingsFeeInfo> list = from info in this.Parent.SubheadingsFeeList.Cast <_SubheadingsFeeInfo>() orderby info.ID select info; foreach (_SubheadingsFeeInfo item in list) { string tbjsjc = ToolKit.ExpressionReplace(item.TBJSJC, this.Variable.DataSource); string bdjsjc = ToolKit.ExpressionReplace(item.BDJSJC, this.Variable.DataSource); switch (item.ID) { case 1: item.TBJE = (ToolKit.Calculate(tbjsjc) + m_BaseResultValue.RGBFHHJ) * item.FL * 0.01m; item.BDJE = (ToolKit.Calculate(bdjsjc) + m_BaseResultValue.RGBFHHJ) * item.FL * 0.01m; break; case 2: item.TBJE = (ToolKit.Calculate(tbjsjc) + m_BaseResultValue.CLBFHHJ) * item.FL * 0.01m; item.BDJE = (ToolKit.Calculate(bdjsjc) + m_BaseResultValue.CLBFHHJ) * item.FL * 0.01m; break; case 3: item.TBJE = (ToolKit.Calculate(tbjsjc) + m_BaseResultValue.JXBFHHJ) * item.FL * 0.01m; item.BDJE = (ToolKit.Calculate(bdjsjc) + m_BaseResultValue.JXBFHHJ) * item.FL * 0.01m; break; default: item.TBJE = ToolKit.Calculate(tbjsjc) * item.FL * 0.01m; item.BDJE = ToolKit.Calculate(bdjsjc) * item.FL * 0.01m; break; } this.Variable.Set(item.YYH, item.TBJE, item.MC); this.DEVariable.Set(item.YYH, item.BDJE, item.MC); //其他条件计算 if (item.ID == 2) { m_ResultValue.JGCL = m_BaseResultValue.JGCL * item.FL; m_ResultValue.YGCL = m_BaseResultValue.YGCL * item.FL; m_ResultValue.PBZDCL = m_BaseResultValue.PBZDCL * item.FL; m_ResultValue.ZDJCL = m_BaseResultValue.ZDJCL * item.FL; m_ResultValue.DEJGCL = m_BaseResultValue.DEJGCL * item.FL; m_ResultValue.DEYGCL = m_BaseResultValue.DEYGCL * item.FL; m_ResultValue.DEPBZDCL = m_BaseResultValue.DEPBZDCL * item.FL; m_ResultValue.DEZDJCL = m_BaseResultValue.DEZDJCL * item.FL; } if (item.ID == 3) { m_ResultValue.DZJXTB = m_BaseResultValue.DZJXTB * item.FL; } } }
/// <summary> /// 获取当前集合指定行的实体对象 /// </summary> /// <param name="index">集合中行的索引</param> /// <returns>相关的实体对象(没有记录则返回空)</returns> public CEntityFixedIncreased this[int index] { get { //如果前一次执行已经转换过当前索引则直接返回 if (index == this.m_index) { return(this.m_CEntityFixedIncreased); } if (this.Rows.Count > 0) { m_CEntityFixedIncreased = new CEntityFixedIncreased(); m_CEntityFixedIncreased.ID = ToolKit.ParseInt(this.Rows[index][CEntityFixedIncreased.FILED_ID]); m_CEntityFixedIncreased.PARENTID = ToolKit.ParseInt(this.Rows[index][CEntityFixedIncreased.FILED_PARENTID]); m_CEntityFixedIncreased.NAME = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityFixedIncreased.FILED_NAME]); m_CEntityFixedIncreased.ISCHECK = ToolKit.ParseBoolen(this.Rows[index][CEntityFixedIncreased.FILED_ISCHECK]); m_CEntityFixedIncreased.CODE = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityFixedIncreased.FILED_CODE]); m_CEntityFixedIncreased.LOCATION = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityFixedIncreased.FILED_LOCATION]); m_CEntityFixedIncreased.GROUP = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityFixedIncreased.FILED_GROUP]); m_CEntityFixedIncreased.FIXED = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityFixedIncreased.FILED_FIXED]); m_CEntityFixedIncreased.CALCULATION = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityFixedIncreased.FILED_CALCULATION]); m_CEntityFixedIncreased.ADDITIONAL = CDataConvert.ConToValue <System.Decimal>(this.Rows[index][CEntityFixedIncreased.FILED_ADDITIONAL]); m_CEntityFixedIncreased.COEFFICIENT = CDataConvert.ConToValue <System.Decimal>(this.Rows[index][CEntityFixedIncreased.FILED_COEFFICIENT]); m_CEntityFixedIncreased.ARTIFICIAL = CDataConvert.ConToValue <System.Decimal>(this.Rows[index][CEntityFixedIncreased.FILED_ARTIFICIAL]); m_CEntityFixedIncreased.MATERIAL = CDataConvert.ConToValue <System.Decimal>(this.Rows[index][CEntityFixedIncreased.FILED_MATERIAL]); m_CEntityFixedIncreased.MECHANICAL = CDataConvert.ConToValue <System.Decimal>(this.Rows[index][CEntityFixedIncreased.FILED_MECHANICAL]); m_CEntityFixedIncreased.EXPERTISE = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityFixedIncreased.FILED_EXPERTISE]); m_CEntityFixedIncreased.REMARK = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityFixedIncreased.FILED_REMARK]); this.m_index = index; return(m_CEntityFixedIncreased); } return(null); } set { this.Rows[index][CEntityFixedIncreased.FILED_ID] = value.ID; this.Rows[index][CEntityFixedIncreased.FILED_PARENTID] = value.PARENTID; this.Rows[index][CEntityFixedIncreased.FILED_NAME] = value.NAME; this.Rows[index][CEntityFixedIncreased.FILED_ISCHECK] = value.ISCHECK; this.Rows[index][CEntityFixedIncreased.FILED_CODE] = value.CODE; this.Rows[index][CEntityFixedIncreased.FILED_LOCATION] = value.LOCATION; this.Rows[index][CEntityFixedIncreased.FILED_GROUP] = value.GROUP; this.Rows[index][CEntityFixedIncreased.FILED_FIXED] = value.FIXED; this.Rows[index][CEntityFixedIncreased.FILED_CALCULATION] = value.CALCULATION; this.Rows[index][CEntityFixedIncreased.FILED_ADDITIONAL] = value.ADDITIONAL; this.Rows[index][CEntityFixedIncreased.FILED_COEFFICIENT] = value.COEFFICIENT; this.Rows[index][CEntityFixedIncreased.FILED_ARTIFICIAL] = value.ARTIFICIAL; this.Rows[index][CEntityFixedIncreased.FILED_MATERIAL] = value.MATERIAL; this.Rows[index][CEntityFixedIncreased.FILED_MECHANICAL] = value.MECHANICAL; this.Rows[index][CEntityFixedIncreased.FILED_EXPERTISE] = value.EXPERTISE; this.Rows[index][CEntityFixedIncreased.FILED_REMARK] = value.REMARK; } }
/// <summary> /// 通过图集库给子目赋值 /// </summary> /// <param name="info"></param> /// <param name="dr"></param> /// <param name="Libname"></param> public void SetSubheadingsInfoByTJ(_Entity_SubInfo info, DataRow dr, string Libname) { info.XMBM = dr["DEBH"].ToString(); info.XMMC = dr["DEMC"].ToString(); info.OLDXMBM = dr["DEBH"].ToString(); info.DW = dr["DEDW"].ToString(); info.LB = "子目"; info.XMTZ = ""; info.GCLJSS = ""; info.HL = 1.00m; string dw = dr["DEDW"].ToString().Replace("m2", "").Replace("m3", ""); if (dw == "") { dw = "1"; } decimal xs = ToolKit.ParseDecimal(dr["GCXS"]); if (xs <= 0) { xs = 1m; } decimal c = ToolKit.ParseDecimal(dw) * xs; if (c == 0) { c = 1m; } info.GCL = 1 / c; info.LibraryName = Libname; _Library.GetLibrary(Libname); DataTable dt = (_Library.Libraries[Libname] as DataSet).Tables["定额表"]; if (dt != null) { DataRow[] rows = dt.Select(string.Format("DINGEH='{0}'", info.XMBM)); if (rows.Length > 0) { info.DECJ = rows[0]["DECJ"].ToString(); string oldvalue = dr["HSQ"].ToString(); string newvalue = dr["HSH"].ToString(); if (oldvalue.Length > 0) { info.XMBM = info.XMBM + "换"; info.DECJ = info.DECJ.Replace(oldvalue, newvalue); } // } } //info.DECJ = dr["DECJ"].ToString(); }
public int GCLSR() { int flag = 0; if (this.Activitie != null) { if (this.Activitie.Application != null) { flag = ToolKit.ParseInt(this.Activitie.Application.Global.Configuration.Configs["工程量输入方式"]); } } return(flag); }
/// <summary> /// 获取当前集合指定行的实体对象 /// </summary> /// <param name="index">集合中行的索引</param> /// <returns>相关的实体对象(没有记录则返回空)</returns> public CEntitySubheadingsFee this[int index] { get { //如果前一次执行已经转换过当前索引则直接返回 if (index == this.m_index) { return(this.m_CEntitySubheadingsFee); } if (this.Rows.Count > 0) { m_CEntitySubheadingsFee = new CEntitySubheadingsFee(); m_CEntitySubheadingsFee.ID = ToolKit.ParseInt(this.Rows[index][CEntitySubheadingsFee.FILED_ID]); m_CEntitySubheadingsFee.PARENTID = ToolKit.ParseInt(this.Rows[index][CEntitySubheadingsFee.FILED_PARENTID]); m_CEntitySubheadingsFee.XID = ToolKit.ParseInt(this.Rows[index][CEntitySubheadingsFee.FILED_XID]); m_CEntitySubheadingsFee.DID = ToolKit.ParseInt(this.Rows[index][CEntitySubheadingsFee.FILED_DID]); m_CEntitySubheadingsFee.QID = ToolKit.ParseInt(this.Rows[index][CEntitySubheadingsFee.FILED_QID]); m_CEntitySubheadingsFee.ZID = ToolKit.ParseInt(this.Rows[index][CEntitySubheadingsFee.FILED_ZID]); m_CEntitySubheadingsFee.YYH = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntitySubheadingsFee.FILED_YYH]); m_CEntitySubheadingsFee.MC = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntitySubheadingsFee.FILED_MC]); m_CEntitySubheadingsFee.BDS = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntitySubheadingsFee.FILED_BDS]); m_CEntitySubheadingsFee.TBJSJC = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntitySubheadingsFee.FILED_TBJSJC]); m_CEntitySubheadingsFee.BDJSJC = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntitySubheadingsFee.FILED_BDJSJC]); m_CEntitySubheadingsFee.FL = CDataConvert.ConToValue <System.Decimal>(this.Rows[index][CEntitySubheadingsFee.FILED_FL]); m_CEntitySubheadingsFee.JSJCJG = CDataConvert.ConToValue <System.Decimal>(this.Rows[index][CEntitySubheadingsFee.FILED_JSJCJG]); m_CEntitySubheadingsFee.JE = CDataConvert.ConToValue <System.Decimal>(this.Rows[index][CEntitySubheadingsFee.FILED_JE]); m_CEntitySubheadingsFee.BEIZHU = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntitySubheadingsFee.FILED_BEIZHU]); this.m_index = index; return(m_CEntitySubheadingsFee); } return(null); } set { this.Rows[index][CEntitySubheadingsFee.FILED_ID] = value.ID; this.Rows[index][CEntitySubheadingsFee.FILED_PARENTID] = value.PARENTID; this.Rows[index][CEntitySubheadingsFee.FILED_XID] = value.XID; this.Rows[index][CEntitySubheadingsFee.FILED_DID] = value.DID; this.Rows[index][CEntitySubheadingsFee.FILED_QID] = value.QID; this.Rows[index][CEntitySubheadingsFee.FILED_ZID] = value.ZID; this.Rows[index][CEntitySubheadingsFee.FILED_YYH] = value.YYH; this.Rows[index][CEntitySubheadingsFee.FILED_MC] = value.MC; this.Rows[index][CEntitySubheadingsFee.FILED_BDS] = value.BDS; this.Rows[index][CEntitySubheadingsFee.FILED_TBJSJC] = value.TBJSJC; this.Rows[index][CEntitySubheadingsFee.FILED_BDJSJC] = value.BDJSJC; this.Rows[index][CEntitySubheadingsFee.FILED_FL] = value.FL; this.Rows[index][CEntitySubheadingsFee.FILED_JSJCJG] = value.JSJCJG; this.Rows[index][CEntitySubheadingsFee.FILED_JE] = value.JE; this.Rows[index][CEntitySubheadingsFee.FILED_BEIZHU] = value.BEIZHU; } }
private string GetChdName(DataRow p_row) { DataRow drv = p_row; string name = string.Empty; if (drv != null) { int id = ToolKit.ParseInt(drv["ID"]); name = drv["Number"].ToString(); object count = this.Source.Compute("Count(ID)", string.Format(" ParentID = {0} ", id)); return(string.Format("{0}.{1}", name, (int)count + 1)); } return(string.Empty); }
/// <summary> /// 直接组价计算 /// </summary> public void ZBegin() { string str = this.JSJC; if (string.IsNullOrEmpty(str)) { str = "0"; } this.Parent.Parent.Parent.Property.Statistics.Begin(); str = ToolKit.ExpressionReplace(str, this.Parent.Parent.Parent.Property.Statistics.ResultVarable.DataSource); decimal m = 1m; decimal.TryParse(this.FL, out m); this.ZHHJ = ToolKit.Calculate(str) * m * this.GCL * 0.01m; this.Begin(); }
bool IEqualityComparer <DataRow> .Equals(DataRow x, DataRow y) { if (x == null) { return(y == null); } if (x["BH"].Equals(y["BH"])) { x.BeginEdit(); x["SLH"] = ToolKit.ParseDecimal(x["SLH"]) + ToolKit.ParseDecimal(y["SL"]); this.SummaryRowCalculate(x); x.EndEdit(); return(true); } return(false); }
/// <summary> /// 统计当前的父行计算结果 /// </summary> /// <param name="row"></param> public void SetCurrentParent(DataRow row) { //1.当前父节点是否为0 //2.若不是0统计所有当前父节点的数据求和 //3.赋值给父节点 int id = ToolKit.ParseInt(row["ID"]); DataRow r = this.m_Source.Rows.Find(id); decimal d = ToolKit.ParseDecimal(this.m_Source.Compute("SUM(Price)", string.Format(" ParentID = {0}", id))); r.BeginEdit(); r["Price"] = d; r.EndEdit(); //this.Parent.Statistics.ResultVarable.Set(r["Number"].ToString(), d, r["Remark"].ToString()); this.Parent.Property.Statistics.ResultVarable.Set(row["Feature"].ToString(), d, row["Remark"].ToString()); //SetCurrentParent(r); }
private void SetCurrent(DataRow row) { int id = ToolKit.ParseInt(row["ID"]); DataRow r = this.m_Source.Rows.Find(id); decimal d = 0m; DataRow[] rows = this.m_Source.Select(string.Format(" ParentID = {0}", id)); foreach (DataRow item in rows) { d += ToolKit.ParseDecimal(item["Combinedprice"]); } // ToolKit.ParseDecimal(this.m_Source.Compute("SUM(Combinedprice)", string.Format(" ParentID = {0}", id))); r.BeginEdit(); r["Combinedprice"] = d; r.EndEdit(); }