示例#1
0
        void btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                SFTable main = new SFTable();
                main.No = this.RefNo;
                main.RetrieveFromDBSources();
                main = (SFTable)this.Ucsys1.Copy(main);

                if (this.RefNo == null)
                {
                    if (main.IsExits == true)
                    {
                        throw new Exception("编号[" + main.No + "]已经存在");
                    }
                }

                //设置它的数据源类型.
                main.SrcType = SrcType.SQL;

                #region 检查必填项.
                if (main.No.Length == 0)
                {
                    throw new Exception("编号不能为空");
                }

                if (main.Name.Length == 0)
                {
                    throw new Exception("名称不能为空");
                }

                if (main.SelectStatement == "")
                {
                    throw new Exception("查询的数据源不能为空.");
                }

                if (main.CashMinute <= 0)
                {
                    main.CashMinute = 0;
                }
                #endregion 检查必填项.

                if (this.RefNo == null)
                {
                    main.FK_Val = main.No;
                }

                main.Save();

                //重新生成
                this.Response.Redirect("SFSQL.aspx?RefNo=" + main.No + "&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "&FromApp=" + this.FromApp, true);
            }
            catch (Exception ex)
            {
                this.Alert(ex.Message);
            }
        }
示例#2
0
    void btn_Click(object sender, EventArgs e)
    {
        string  no   = this.UCSys1.GetTextBoxByID("TB_No").Text;
        string  name = this.UCSys1.GetTextBoxByID("TB_Name").Text;
        SFTable m    = new SFTable();

        m.No = no;
        m.RetrieveFromDBSources();
        m.Name = name;
        if (string.IsNullOrEmpty(name))
        {
            this.Alert("编码表名称不能为空");
            return;
        }
        //  m.HisSFTableType = SFTableType.SFTable;
        m.Save();
        this.Response.Redirect("SFTableList.aspx?RefNo=" + m.No, true);
    }
示例#3
0
        /// <summary>
        /// 检查enittyNoName类型的实体
        /// </summary>
        public void CheckEnityTypeAttrsFor_EntityNoName()
        {
            //取出来全部的属性.
            MapAttrs attrs = new MapAttrs(this.No);

            #region 补充上流程字段到 NDxxxRpt.
            if (attrs.Contains(this.No + "_" + GERptAttr.OID) == false)
            {
                /* WorkID */
                MapAttr attr = new BP.Sys.MapAttr();
                attr.FK_MapData    = this.No;
                attr.KeyOfEn       = "OID";
                attr.Name          = "主键ID";
                attr.MyDataType    = BP.DA.DataType.AppInt;
                attr.UIContralType = UIContralType.TB;
                attr.LGType        = FieldTypeS.Normal;
                attr.UIVisible     = false;
                attr.UIIsEnable    = false;
                attr.DefVal        = "0";
                attr.HisEditType   = BP.En.EditType.Readonly;
                attr.Insert();
            }
            if (attrs.Contains(this.No + "_" + GERptAttr.BillNo) == false)
            {
                /* 单据编号 */
                MapAttr attr = new BP.Sys.MapAttr();
                attr.FK_MapData    = this.No;
                attr.HisEditType   = EditType.UnDel;
                attr.KeyOfEn       = GERptAttr.BillNo;
                attr.Name          = "编号"; //  单据编号
                attr.MyDataType    = DataType.AppString;
                attr.UIContralType = UIContralType.TB;
                attr.LGType        = FieldTypeS.Normal;
                attr.UIVisible     = true;
                attr.UIIsEnable    = false;
                attr.UIIsLine      = false;
                attr.MinLen        = 0;
                attr.MaxLen        = 100;
                attr.Idx           = -100;
                attr.Insert();
            }

            if (attrs.Contains(this.No + "_" + GERptAttr.Title) == false)
            {
                /* 名称 */
                MapAttr attr = new BP.Sys.MapAttr();
                attr.FK_MapData    = this.No;
                attr.HisEditType   = EditType.UnDel;
                attr.KeyOfEn       = GERptAttr.Title; // "FlowEmps";
                attr.Name          = "名称";            //   单据模式, ccform的模式.
                attr.MyDataType    = DataType.AppString;
                attr.UIContralType = UIContralType.TB;
                attr.LGType        = FieldTypeS.Normal;
                attr.UIVisible     = true;
                attr.UIIsEnable    = true;
                attr.UIIsLine      = true;
                attr.MinLen        = 0;
                attr.MaxLen        = 400;
                attr.Idx           = -90;
                attr.Insert();
            }
            if (attrs.Contains(this.No + "_BillState") == false)
            {
                /* 单据状态 */
                MapAttr attr = new BP.Sys.MapAttr();
                attr.FK_MapData    = this.No;
                attr.HisEditType   = EditType.UnDel;
                attr.KeyOfEn       = "BillState"; // "FlowEmps";
                attr.Name          = "单据状态";      //
                attr.MyDataType    = DataType.AppInt;
                attr.UIContralType = UIContralType.TB;
                attr.LGType        = FieldTypeS.Normal;
                attr.UIVisible     = false;
                attr.UIIsEnable    = false;
                attr.UIIsLine      = true;
                attr.MinLen        = 0;
                attr.MaxLen        = 10;
                attr.Idx           = -98;
                attr.Insert();
            }

            if (attrs.Contains(this.No + "_Starter") == false)
            {
                /* 发起人 */
                MapAttr attr = new BP.Sys.MapAttr();
                attr.FK_MapData    = this.No;
                attr.HisEditType   = EditType.UnDel;
                attr.KeyOfEn       = "Starter";
                attr.Name          = "创建人"; //
                attr.MyDataType    = DataType.AppString;
                attr.UIContralType = UIContralType.TB;
                attr.LGType        = FieldTypeS.Normal;

                attr.UIVisible  = false;
                attr.UIIsEnable = false;
                attr.MinLen     = 0;
                attr.MaxLen     = 32;
                attr.Idx        = -1;
                attr.Insert();
            }
            if (attrs.Contains(this.No + "_StarterName") == false)
            {
                /* 创建人名称 */
                MapAttr attr = new BP.Sys.MapAttr();
                attr.FK_MapData    = this.No;
                attr.HisEditType   = EditType.UnDel;
                attr.KeyOfEn       = "StarterName";
                attr.Name          = "创建人名称"; //
                attr.MyDataType    = DataType.AppString;
                attr.UIContralType = UIContralType.TB;
                attr.LGType        = FieldTypeS.Normal;

                attr.UIVisible  = false;
                attr.UIIsEnable = false;
                attr.MinLen     = 0;
                attr.MaxLen     = 32;
                attr.Idx        = -1;
                attr.Insert();
            }


            if (attrs.Contains(this.No + "_" + GERptAttr.AtPara) == false)
            {
                /* 参数 */
                MapAttr attr = new BP.Sys.MapAttr();
                attr.FK_MapData    = this.No;
                attr.HisEditType   = EditType.UnDel;
                attr.KeyOfEn       = GERptAttr.AtPara;
                attr.Name          = "参数"; // 单据编号
                attr.MyDataType    = DataType.AppString;
                attr.UIContralType = UIContralType.TB;
                attr.LGType        = FieldTypeS.Normal;
                attr.UIVisible     = false;
                attr.UIIsEnable    = false;
                attr.UIIsLine      = false;
                attr.MinLen        = 0;
                attr.MaxLen        = 4000;
                attr.Idx           = -99;
                attr.Insert();
            }

            if (attrs.Contains(this.No + "_RDT") == false)
            {
                /* MyNum */
                MapAttr attr = new BP.Sys.MapAttr();
                attr.FK_MapData    = this.No;
                attr.HisEditType   = EditType.UnDel;
                attr.KeyOfEn       = "RDT"; // "FlowStartRDT";
                attr.Name          = "创建时间";
                attr.MyDataType    = DataType.AppDateTime;
                attr.UIContralType = UIContralType.TB;
                attr.LGType        = FieldTypeS.Normal;
                attr.UIVisible     = false;
                attr.UIIsEnable    = false;
                attr.UIIsLine      = false;
                attr.Idx           = -97;
                attr.Insert();
            }
            #endregion 补充上流程字段。

            #region 注册到外键表.
            SFTable sf = new SFTable();
            sf.No = this.No;
            if (sf.RetrieveFromDBSources() == 0)
            {
                sf.Name            = this.Name;
                sf.SrcType         = SrcType.SQL;
                sf.SrcTable        = this.PTable;
                sf.ColumnValue     = "BillNo";
                sf.ColumnText      = "Title";
                sf.SelectStatement = "SELECT BillNo AS No, Title as Name FROM " + this.PTable;
                sf.Insert();
            }

            #endregion 注册到外键表
        }
示例#4
0
        void btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                SFTable main = new SFTable();
                main.No = this.RefNo;
                if (this.RefNo != null)
                {
                    main.RetrieveFromDBSources();
                }

                main = (SFTable)this.Ucsys1.Copy(main);
                if (main.No.Length == 0 || main.Name.Length == 0)
                {
                    throw new Exception("编号与名称不能为空");
                }

                if (this.RefNo == null)
                {
                    main.No = this.Ucsys1.GetTBByID("TB_No").Text;
                    if (main.IsExits)
                    {
                        string sql = "select No,Name FROM " + main.No + " WHERE 1=2";
                        try
                        {
                            BP.DA.DBAccess.RunSQLReturnTable(sql);
                        }
                        catch
                        {
                            this.Alert("错误:表或视图不存在No,Name列不符合约定规则  Key=" + main.No);
                            return;
                        }
                    }
                }
                else
                {
                    main.No = this.RefNo;
                    main.RetrieveFromDBSources();
                    main = (SFTable)this.Ucsys1.Copy(main);

                    if (main.No.Length == 0 || main.Name.Length == 0)
                    {
                        throw new Exception("编号与名称不能为空");
                    }
                }

                if (main.Name.Length == 0)
                {
                    throw new Exception("编号与名称不能为空");
                }

                if (main.No.Length == 0)
                {
                    throw new Exception("编号与名称不能为空");
                }

                if (this.RefNo == null)
                {
                    main.FK_Val = main.No;
                }

                main.Save();

                //重新生成
                this.Response.Redirect("SFTable.aspx?RefNo=" + main.No + "&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "&FromApp=" + this.FromApp, true);
            }
            catch (Exception ex)
            {
                this.Alert(ex.Message);
            }
        }
示例#5
0
        void btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                SFTable main = new SFTable();
                main.No = this.RefNo;
                main.RetrieveFromDBSources();
                main = (SFTable)this.Ucsys1.Copy(main);

                #region 检查必填项.

                if (main.FK_SFDBSrc.Length == 0)
                {
                    throw new Exception("必须选择数据源");
                }

                if (main.TableDesc.Length == 0)
                {
                    throw new Exception("必须选择接口");
                }

                if (main.No.Length == 0)
                {
                    throw new Exception("接口英文名称不能为空");
                }

                if (main.Name.Length == 0)
                {
                    throw new Exception("接口中文名称不能为空");
                }

                var restype = this.Ucsys1.GetDDLByID("DDL_ResultType").SelectedItemStringVal;
                if (restype.Length == 0)
                {
                    throw new Exception("选择接口返回值类型");
                }

                #endregion 检查必填项.

                if (this.RefNo == null)
                {
                    if (main.IsExits == true)
                    {
                        throw new Exception("编号[" + main.No + "]已经存在");
                    }
                }

                //设置它的数据源类型.
                main.SrcType    = SrcType.WebServices;
                main.TableDesc += "," + restype;

                if (this.RefNo == null)
                {
                    main.FK_Val = main.No;
                }

                main.Save();

                //重新生成
                this.Response.Redirect("SFWS.aspx?RefNo=" + main.No + "&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "&FromApp=" + this.FromApp + "&t=" + DateTime.Now.ToString("yyyyMMddHHmmssffffff"), true);
            }
            catch (Exception ex)
            {
                this.Alert(ex.Message);
            }
        }