Exemple #1
0
        /// <summary>
        /// BindDtl
        /// </summary>
        /// <param name="ens"></param>
        public void BindDtl(Entities ens)
        {
            string clas = ens.GetType().Name;

            if (!this.ContainsClass(clas))
            {
                return;
            }
            DocParams pars = this.GetDocParams(clas);

            if (pars.Count > 0 && this.ContainsDT(clas))
            {
                this.ListDT[clas] = ens.Count;
                foreach (DocParam par in pars)
                {
                    for (int ie = 0; ie < ens.Count; ie++)
                    {
                        DocParam addpar = new DocParam();
                        addpar.Key   = par.Key + (ie + 1).ToString().PadLeft(3, '0');
                        addpar.Field = par.Field.Insert(par.Field.IndexOf('.'), (ie + 1).ToString());
                        addpar.Value = "";
                        this.DocParamTable.Add(addpar);
                    }
                    if (ens.Count > 0)
                    {
                        this.DocParamTable.Remove(par);
                    }
                }
            }
            this.BindEns(ens);
        }
Exemple #2
0
        public DocParams(DataTable tb)
        {
            if (tb.Columns.Count < 2)
            {
                throw new Exception("构造DocParams要求2列以上的数据!");
            }

            if (tb.Columns.Count == 2)
            {
                foreach (DataRow row in tb.Rows)
                {
                    DocParam par = new DocParam(row[0].ToString().Trim(), row[1].ToString().Trim(), "", "1");
                    this.Add(par);
                }
            }
            else if (tb.Columns.Count == 3)
            {
                foreach (DataRow row in tb.Rows)
                {
                    DocParam par = new DocParam(row[0].ToString().Trim(), row[1].ToString().Trim(), row[2].ToString().Trim(), "1");
                    this.Add(par);
                }
            }
            else             //if( tb.Columns.Count==4 )
            {
                foreach (DataRow row in tb.Rows)
                {
                    DocParam par = new DocParam(row[0].ToString().Trim(), row[1].ToString().Trim(), row[2].ToString().Trim(), row[3].ToString().Trim());
                    this.Add(par);
                }
            }
        }
Exemple #3
0
        public void RemoveByField(string field)
        {
            DocParam par = this.GetDocParamByField(field);

            if (par != null)
            {
                Remove(par);
            }
        }
Exemple #4
0
        public void RemoveByKey(string key)
        {
            DocParam par = this.GetDocParamByKey(key);

            if (par != null)
            {
                Remove(par);
            }
        }
Exemple #5
0
        public void Add(DocParam par)
        {
            if (this.GetDocParamByKey(par.Key) != null)
            {
                throw new Exception("不允许加入重复的[" + par.Key + "],请检查xml配置文件.");
            }
            else if (this.GetDocParamByKey(par.Field) != null)
            {
                throw new Exception("不允许加入重复的[" + par.Field + "],请检查xml配置文件.");
            }

            this.InnerList.Add(par);
        }
Exemple #6
0
        public void SetValueByField(string field, string val, bool convertCode)
        {
            DocParam par = this.DocParamTable.GetDocParamByField(field);

            if (par != null)
            {
                if (convertCode)
                {
                    par.Value = this.GetCode(val);
                }
                else
                {
                    par.Value = val;
                }
            }
        }
Exemple #7
0
 public void Remove(DocParam par)
 {
     this.InnerList.Remove(par);
 }