Ejemplo n.º 1
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            DataTable dt = (DataTable)ViewState["Workflow_FormField"];
            string[] FieldIDList = txtFieldID.Value.Split(new char[] { ',' });
            for (int i = 0; i < FieldIDList.Length && txtFieldID.Value != string.Empty; i++)
            {
                string FieldID = FieldIDList.GetValue(i).ToString();
                if (dt.Select("FieldID=" + FieldID).Length == 0)
                {
                    Workflow_FormFieldEntity _Workflow_FormFieldEntity = new Workflow_FormFieldEntity();
                    _Workflow_FormFieldEntity.FormID = DNTRequest.GetInt("fmid", 0);
                    _Workflow_FormFieldEntity.FieldID = Convert.ToInt32(FieldID);
                    _Workflow_FormFieldEntity.GroupID = DNTRequest.GetInt("gid", 0);
                    _Workflow_FormFieldEntity.IsDetail = DNTRequest.GetInt("gid", 0) == 0 ? 0 : 1;
                    Workflow_FieldDictEntity _Workflow_FieldDictEntity = DbHelper.GetInstance().GetWorkflow_FieldDictEntityByKeyCol(FieldID);
                    _Workflow_FormFieldEntity.FieldLabel = _Workflow_FieldDictEntity.FieldDesc;
                    _Workflow_FormFieldEntity.DisplayOrder = (dt.Rows.Count + 1 + i) * 10;
                    DbHelper.GetInstance().AddWorkflow_FormField(_Workflow_FormFieldEntity);
                }
            }

            ArrayList arlst = new ArrayList();
            arlst.Add("Workflow_FormField");
            arlst.Add(DNTRequest.GetInt("fmid", 0));
            arlst.Add(DNTRequest.GetInt("gid", 0));
            DbHelper.GetInstance().sp_ReDisplayOrder(arlst);
            if (FieldIDList.Length > 0 && txtFieldID.Value != string.Empty)
            {
                DbHelper.GetInstance().sp_AlterWork_form_TableColumn(txtFieldID.Value, DNTRequest.GetInt("gid", 0) == 0 ? "1" : "2");
            }
            BindGridView();
        }
Ejemplo n.º 2
0
 public string AddWorkflow_FormField2(Workflow_FormFieldEntity _Workflow_FormFieldEntity)
 {
     //判断该记录是否已经存在
     DbParameter[] prams = {
                                MakeInParam("@FormID",(DbType)SqlDbType.Int,4,_Workflow_FormFieldEntity.FormID ),
                                MakeInParam("@FieldID",(DbType)SqlDbType.Int,4,_Workflow_FormFieldEntity.FieldID ),
                                MakeInParam("@GroupID",(DbType)SqlDbType.Int,4,_Workflow_FormFieldEntity.GroupID ),
                            };
     string sql = " select * from [dbo].[Workflow_FormField] where FormID=@FormID and FieldID=@FieldID  and GroupID=@GroupID ";
     if (ExecuteDataset(CommandType.Text, sql, prams).Tables[0].Rows.Count > 0)
     {
         return "-1";//该记录已经存在
     }
     else
     {
         DbParameter[] pramsInsert = {
                                MakeInParam("@FormID",(DbType)SqlDbType.Int,4,_Workflow_FormFieldEntity.FormID ),
                                MakeInParam("@FieldID",(DbType)SqlDbType.Int,4,_Workflow_FormFieldEntity.FieldID ),
                                MakeInParam("@FieldLabel",(DbType)SqlDbType.VarChar,200,_Workflow_FormFieldEntity.FieldLabel ),
                                MakeInParam("@CSSStyle",(DbType)SqlDbType.Int,4,_Workflow_FormFieldEntity.CSSStyle ),
                                MakeInParam("@DisplayOrder",(DbType)SqlDbType.Int,4,_Workflow_FormFieldEntity.DisplayOrder ),
                                MakeInParam("@GroupID",(DbType)SqlDbType.Int,4,_Workflow_FormFieldEntity.GroupID ),
                                MakeInParam("@IsDetail",(DbType)SqlDbType.Int,4,_Workflow_FormFieldEntity.IsDetail ),
                                MakeInParam("@GroupLineDataSetID",(DbType)SqlDbType.Int,4,_Workflow_FormFieldEntity.GroupLineDataSetID ),
                                MakeInParam("@TargetGroupID",(DbType)SqlDbType.Int,4,_Workflow_FormFieldEntity.TargetGroupID ),
                                      };
         StringBuilder sb = new StringBuilder();
         sb.Append("INSERT INTO [dbo].[Workflow_FormField]");
         sb.Append("(");
         sb.Append(" [FormID]");
         sb.Append(",[FieldID]");
         sb.Append(",[FieldLabel]");
         sb.Append(",[IsDetail]");
         sb.Append(",[CSSStyle]");
         sb.Append(",[DisplayOrder]");
         sb.Append(",[GroupID]");
         sb.Append(",[GroupLineDataSetID]");
         sb.Append(",[TargetGroupID]");
         sb.Append(") ");
         sb.Append(" VALUES (");
         sb.Append("@FormID,");
         sb.Append("@FieldID,");
         sb.Append("@FieldLabel,");
         sb.Append("@IsDetail,");
         sb.Append("@CSSStyle,");
         sb.Append("@DisplayOrder,");
         sb.Append("@GroupID,");
         sb.Append("@GroupLineDataSetID,");
         sb.Append("@TargetGroupID )");
         sb.Append("select @@identity;");
         return ExecuteScalar(CommandType.Text, sb.ToString(), pramsInsert).ToString();
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 修改信息
 /// </summary>
 /// <param name="_Workflow_FormFieldEntity"></param>
 /// <returns>返回string "-1"表示该已经存在,否则成功 </returns>
 public string UpdateWorkflow_FormField(Workflow_FormFieldEntity _Workflow_FormFieldEntity)
 {
     DbParameter[] pramsUpdate = {
                                MakeInParam("@FormID",(DbType)SqlDbType.Int,4,_Workflow_FormFieldEntity.FormID ),
                                MakeInParam("@GroupID",(DbType)SqlDbType.Int,4,_Workflow_FormFieldEntity.GroupID ),
                                MakeInParam("@FieldID",(DbType)SqlDbType.Int,4,_Workflow_FormFieldEntity.FieldID ),
                                MakeInParam("@FieldLabel",(DbType)SqlDbType.VarChar,200,_Workflow_FormFieldEntity.FieldLabel ),
                                MakeInParam("@CSSStyle",(DbType)SqlDbType.Int,4,_Workflow_FormFieldEntity.CSSStyle ),
                                MakeInParam("@GroupLineDataSetID",(DbType)SqlDbType.Int,4,_Workflow_FormFieldEntity.GroupLineDataSetID ),
                                MakeInParam("@TargetGroupID",(DbType)SqlDbType.Int,4,_Workflow_FormFieldEntity.TargetGroupID ),
                                MakeInParam("@DisplayOrder",(DbType)SqlDbType.Int,4,_Workflow_FormFieldEntity.DisplayOrder ),
                                  };
     StringBuilder sb = new StringBuilder();
     sb.Append("Update [dbo].[Workflow_FormField]");
     sb.Append(" set ");
     sb.Append(" [FieldLabel]=@FieldLabel,");
     sb.Append(" [CSSStyle]=@CSSStyle,");
     sb.Append(" [GroupLineDataSetID]=@GroupLineDataSetID,");
     sb.Append(" [TargetGroupID]=@TargetGroupID,");
     sb.Append(" [DisplayOrder]=@DisplayOrder ");
     sb.Append(" where FormID=@FormID and FieldID=@FieldID and GroupID=@GroupID ");
     return ExecuteNonQuery(CommandType.Text, sb.ToString(), pramsUpdate).ToString();
 }
Ejemplo n.º 4
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < GridView1.Rows.Count; i++)
            {
                string Prefix = "GridView1$ctl" + (i + 2).ToString().PadLeft(2, '0') + "$";

                Workflow_FormFieldEntity _Workflow_FormFieldEntity = new Workflow_FormFieldEntity();
                _Workflow_FormFieldEntity.FormID = DNTRequest.GetInt("fmid", 0);
                _Workflow_FormFieldEntity.GroupID = DNTRequest.GetInt("gid", 0);
                _Workflow_FormFieldEntity.FieldID = Convert.ToInt32(GridView1.DataKeys[i][0]);
                _Workflow_FormFieldEntity.FieldLabel = DNTRequest.GetString(Prefix + "FieldLabel");
                _Workflow_FormFieldEntity.CSSStyle = DNTRequest.GetInt(Prefix + "CSSStyle", 0);
                _Workflow_FormFieldEntity.GroupLineDataSetID = DNTRequest.GetInt("txtDataSetID" + (i + 2).ToString().PadLeft(2, '0'), 0);
                _Workflow_FormFieldEntity.TargetGroupID = DNTRequest.GetInt(Prefix + "TargetGroupID", 0);
                _Workflow_FormFieldEntity.DisplayOrder = DNTRequest.GetInt(Prefix + "DisplayOrder", 9990);
                DbHelper.GetInstance().UpdateWorkflow_FormField(_Workflow_FormFieldEntity);
            }
            ArrayList arlst = new ArrayList();
            arlst.Add("Workflow_FormField");
            arlst.Add(DNTRequest.GetInt("fmid", 0));
            arlst.Add(DNTRequest.GetInt("gid", 0));
            DbHelper.GetInstance().sp_ReDisplayOrder(arlst);
            ScriptManager.RegisterStartupScript(btnSubmit, this.GetType(), "btnSubmit", "alert('设定成功');", true);
            BindGridView();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 增加表单元素
        /// </summary>
        /// <param name="FieldID">字段ID</param>
        /// <param name="FieldDesc">字段描述</param>
        /// <param name="CSSStyleClass">样式</param>
        /// <param name="FormID">表单字段</param>
        /// <param name="GroupID">明细组ID,0为主字段</param>
        /// <param name="IsDetail">是否是明细组,1为明细组,0为主字段</param>
        /// <returns></returns>
        private static List<string> addFormField(List<int> FieldID, List<string> FieldDesc, List<int> CSSStyleClass, int FormID, int GroupID, int IsDetail)
        {
            List<string> result = new List<string>();
            DateTime dt = new DateTime();
            string txtFieldID = "";
            for(int i=0;i<FieldID.Count();i++)
            {
                txtFieldID += FieldID[i];
                if (i < FieldID.Count - 1)   txtFieldID += ",";
                GPRP.Entity.Workflow_FormFieldEntity wff = new GPRP.Entity.Workflow_FormFieldEntity();
                wff.FormID = FormID;
                wff.FieldID = FieldID[i];
                wff.GroupID = Convert.ToBoolean(GroupID) ? GroupID : 0;              //明细组ID,0不是明细组
                wff.FieldLabel = FieldDesc[i];  //描述
                if(CSSStyleClass==null)
                {
                    wff.CSSStyle = 0;
                }
                else if (CSSStyleClass[i] != -1)
                {
                    wff.CSSStyle = CSSStyleClass[i];     //样式
                }

                wff.DisplayOrder = 10+(i*10);   //顺序
                wff.IsDetail =Convert.ToBoolean(IsDetail)?IsDetail:0;    //是否是明细组,1是明细组,0不是明细组
                wff.CreateDate = dt;  //创建日期
                wff.GroupLineDataSetID =0;   //对应数据集
                wff.TargetGroupID = 0;    //对应明细组

                result.Add(DbHelper.GetInstance().AddWorkflow_FormField(wff));
            }

            ArrayList arlst = new ArrayList();
            arlst.Add("Workflow_FormField");
            arlst.Add(FormID);
            arlst.Add(GroupID);
            string a= DbHelper.GetInstance().sp_ReDisplayOrder(arlst);
            if ( txtFieldID != string.Empty)
            {
              string r=  DbHelper.GetInstance().sp_AlterWork_form_TableColumn(txtFieldID, GroupID == 0 ? "1" : "2");
            }

            return result;
        }
Ejemplo n.º 6
0
        private static List<string> addFormField(FormField f)
        {
            List<string> result = new List<string>();
            DateTime dt = new DateTime();
            string txtFieldID = "";

            DataTable dtFormField = DbHelper.GetInstance().GetDBRecords("*", "Workflow_FormField", "FormID="+f.FormID, "DisplayOrder");

            for (int i = 0; i < f.FieldID.Count(); i++)
            {
                txtFieldID +=f.FieldID[i];
                if (i <f.FieldID.Count - 1) txtFieldID += ",";
                GPRP.Entity.Workflow_FormFieldEntity wff = new GPRP.Entity.Workflow_FormFieldEntity();
                wff.FormID =f.FormID;
                wff.FieldID =f.FieldID[i];
                wff.GroupID = Convert.ToBoolean(f.GroupID) ?f.GroupID : 0;              //明细组ID,0不是明细组
                wff.FieldLabel = f.FieldDesc[i];  //描述
                if (f.CSSStyleClass == null)
                {
                    wff.CSSStyle = 0;
                }
                else if (f.CSSStyleClass[i] != -1)
                {
                    wff.CSSStyle =f.CSSStyleClass[i];     //样式
                }

                wff.DisplayOrder = 10 + (i * 10);   //顺序
                wff.IsDetail = Convert.ToBoolean(f.IsDetail) ? f.IsDetail : 0;    //是否是明细组,1是明细组,0不是明细组
                wff.CreateDate = dt;  //创建日期
                wff.GroupLineDataSetID = f.GroupLineDataSetID[i];   //对应数据集
                wff.TargetGroupID = f.TargetGroupID[i];    //对应明细组

                int isflage = 0;
                for(int k=0;k<dtFormField.Rows.Count;k++)
                {
                    DataRow dr = dtFormField.Rows[k];

                    if (wff.FieldID == Convert.ToInt32(dr["FieldID"]))
                    {
                        isflage = 1;
                        result.Add(DbHelper.GetInstance().UpdateWorkflow_FormField(wff));  //更新
                        dtFormField.Rows.Remove(dr);
                        break;
                    }
                }

                if (isflage == 0)
                {
                    result.Add(DbHelper.GetInstance().AddWorkflow_FormField2(wff));   //新增

                }
            }

            foreach (DataRow dr in dtFormField.Rows)  //删除
            {
                  DbHelper.GetInstance().DeleteWorkflow_FormField(dr["FormID"].ToString(), dr["FieldID"].ToString(), dr["GroupID"].ToString());
            }

            ArrayList arlst = new ArrayList();
            arlst.Add("Workflow_FormField");
            arlst.Add(f.FormID);
            arlst.Add(f.GroupID);
            string a = DbHelper.GetInstance().sp_ReDisplayOrder(arlst);
            if (txtFieldID != string.Empty)
            {
                string r = DbHelper.GetInstance().sp_AlterWork_form_TableColumn(txtFieldID,f.GroupID == 0 ? "1" : "2");
            }

            return result;
        }