Пример #1
0
        //  Workflow_FormBaseEntity
        public string FormBaseToJson(int formID)
        {
            string item = FieldToHtml(formID);

            DataTable dtFormBase = DbHelper.GetInstance().GetDBRecords("*", "Workflow_FormBase", "FormID='" + formID + "'", "FormID");
            foreach (DataRow dr in dtFormBase.Rows)
            {
                Workflow_FormBaseEntity wfb = new Workflow_FormBaseEntity();
                wfb.FormID = Convert.ToInt32(dr["FormID"]);
                wfb.FormName = dr["FormName"].ToString();
                wfb.FormDesc = dr["FormDesc"].ToString();
                wfb.FormTypeID =Convert.ToInt32(dr["FormTypeID"]);
                wfb.DisplayOrder = Convert.ToInt32(dr["DisplayOrder"]);
                wfb.Useflag = dr["Useflag"].ToString();

                bool useflag = false ;
                if (wfb.Useflag == "1")
                {
                    useflag = true;
                }

                string html=  "<form formid=\""+wfb.FormID
                    +"\" displayorder=\""+wfb.DisplayOrder
                    +"\" formdesc=\""+wfb.FormDesc
                    +"\" formtypeid=\""+wfb.FormTypeID
                    +"\" name=\""+wfb.FormName
                    +"\" useflag=\""+useflag+"\">"+item+"</form>";

                return html;
            }

            return "";
        }
Пример #2
0
        protected void hideModalPopupViaServer_Click(object sender, EventArgs e)
        {
            GPRP.GPRPControls.Button btn = (GPRP.GPRPControls.Button)sender;
            if (btn.ID == "btnSubmit")
            {
                Workflow_FormBaseEntity _FormBaseEntity = new Workflow_FormBaseEntity();
                _FormBaseEntity.FormID = Convert.ToInt32(txtFormID.Value != string.Empty ? txtFormID.Value : "0");
                _FormBaseEntity.FormName = txtFormName.Text;
                _FormBaseEntity.FormDesc = txtFormDesc.Text;
                _FormBaseEntity.FormTypeID = Convert.ToInt32(ddlFormTypeID.SelectedValue);
                _FormBaseEntity.DisplayOrder = Convert.ToInt32(txtDisplayOrder.Text);
                _FormBaseEntity.Useflag = chkUseFlag.Checked ? "1" : "0";
                _FormBaseEntity.Creator = userEntity.UserID;
                _FormBaseEntity.CreateDate = DateTime.Now;
                _FormBaseEntity.lastModifier = userEntity.UserID;
                _FormBaseEntity.lastModifyDate = DateTime.Now;
                string sResult = DbHelper.GetInstance().UpdateWorkflow_FormBase(_FormBaseEntity);
                if (sResult != "1")
                {
                    lblMsg.Text = ResourceManager.GetString("Operation_RECORD") + ":" + sResult;
                }
            }

            System.Web.UI.ScriptManager.RegisterStartupScript(btn, this.GetType(), "ButtonHideScript", strButtonHideScript, false);
        }
Пример #3
0
        /// <summary>
        /// 新增信息
        /// </summary>
        /// <param name="_Workflow_FormBaseEntity"></param>
        /// <returns>返回string "-1"表示该已经存在,否则成功 </returns>
        public string AddWorkflow_FormBase2(Workflow_FormBaseEntity _Workflow_FormBaseEntity)
        {
            //判断该记录是否已经存在

            DbParameter[] prams = {
                                       MakeInParam("@FormName",(DbType)SqlDbType.VarChar,50,_Workflow_FormBaseEntity.FormName),
                                       MakeInParam("@FormTypeID",(DbType)SqlDbType.Int,4,_Workflow_FormBaseEntity.FormTypeID ),
                                       MakeInParam("@DisplayOrder",(DbType)SqlDbType.Int,4,_Workflow_FormBaseEntity.DisplayOrder ),
                                   };
            string sql = "select * from [dbo].[Workflow_FormBase] where FormName=@FormName or (FormTypeID=@FormTypeID and DisplayOrder=@DisplayOrder)";
            if (ExecuteDataset(CommandType.Text, sql, prams).Tables[0].Rows.Count > 0)
            {
                return "-1";//该记录已经存在
            }
            else
            {
                DbParameter[] pramsInsert = {
                                       MakeInParam("@FormName",(DbType)SqlDbType.VarChar,200,_Workflow_FormBaseEntity.FormName ),
                                       MakeInParam("@FormDesc",(DbType)SqlDbType.VarChar,2000,_Workflow_FormBaseEntity.FormDesc ),
                                       MakeInParam("@FormTypeID",(DbType)SqlDbType.Int,4,_Workflow_FormBaseEntity.FormTypeID ),
                                       MakeInParam("@DisplayOrder",(DbType)SqlDbType.Int,4,_Workflow_FormBaseEntity.DisplayOrder ),
                                       MakeInParam("@Useflag",(DbType)SqlDbType.VarChar,50,_Workflow_FormBaseEntity.Useflag ),
                                       MakeInParam("@Creator",(DbType)SqlDbType.VarChar,50,_Workflow_FormBaseEntity.Creator ),
                                       MakeInParam("@CreateDate",(DbType)SqlDbType.DateTime,23,_Workflow_FormBaseEntity.CreateDate ),
                                       MakeInParam("@lastModifier",(DbType)SqlDbType.VarChar,50,_Workflow_FormBaseEntity.lastModifier ),
                                       MakeInParam("@lastModifyDate",(DbType)SqlDbType.DateTime,23,_Workflow_FormBaseEntity.lastModifyDate ),
                                             };
                StringBuilder sb = new StringBuilder();
                sb.Append("INSERT INTO [dbo].[Workflow_FormBase]");
                sb.Append("(");
                sb.Append(" [FormName]");
                sb.Append(",[FormDesc]");
                sb.Append(",[FormTypeID]");
                sb.Append(",[DisplayOrder]");
                sb.Append(",[Useflag]");
                sb.Append(",[Creator]");
                sb.Append(",[CreateDate]");
                sb.Append(",[lastModifier]");
                sb.Append(",[lastModifyDate]");
                sb.Append(") ");
                sb.Append(" VALUES (");
                sb.Append("@FormName,");
                sb.Append("@FormDesc,");
                sb.Append("@FormTypeID,");
                sb.Append("@DisplayOrder,");
                sb.Append("@Useflag,");
                sb.Append("@Creator,");
                sb.Append("@CreateDate,");
                sb.Append("@lastModifier,");
                sb.Append("@lastModifyDate )");
                sb.Append("select @@identity;");
                //  ExecuteScalar(CommandType.Text, sb.ToString(), pramsInsert);

                string FormID = ExecuteScalar(CommandType.Text, sb.ToString(), pramsInsert).ToString();
                _Workflow_FormBaseEntity.FormID = Convert.ToInt32(FormID);

                ArrayList arlst = new ArrayList();
                arlst.Add("Workflow_FormBase");
                arlst.Add(_Workflow_FormBaseEntity.FormTypeID);
                arlst.Add("");
                return sp_ReDisplayOrder(arlst);
            }
        }
Пример #4
0
 /// <summary>
 /// GetWorkflow_FormBaseFromIDataReader
 /// </summary>
 /// <param name="dr"></param>
 /// <returns></returns>
 private Workflow_FormBaseEntity GetWorkflow_FormBaseFromIDataReader(DbDataReader dr)
 {
     Workflow_FormBaseEntity dt = new Workflow_FormBaseEntity();
     if (dr.FieldCount > 0)
     {
         if (dr["FormID"].ToString() != "" || dr["FormID"] != null) dt.FormID = Int32.Parse(dr["FormID"].ToString());
         dt.FormName = dr["FormName"].ToString();
         dt.FormDesc = dr["FormDesc"].ToString();
         if (dr["FormTypeID"].ToString() != "" || dr["FormTypeID"] != null) dt.FormTypeID = Int32.Parse(dr["FormTypeID"].ToString());
         if (dr["DisplayOrder"].ToString() != "" || dr["DisplayOrder"] != null) dt.DisplayOrder = Int32.Parse(dr["DisplayOrder"].ToString());
         dt.Useflag = dr["Useflag"].ToString();
         dt.Creator = dr["Creator"].ToString();
         dt.CreateDate = Convert.ToDateTime(dr["CreateDate"]);
         dt.lastModifier = dr["lastModifier"].ToString();
         dt.lastModifyDate = Convert.ToDateTime(dr["lastModifyDate"]);
         dr.Close();
         return dt;
     }
     dr.Close();
     return null;
 }
Пример #5
0
        /// <summary>
        /// 修改信息
        /// </summary>
        /// <param name="_Workflow_FormBaseEntity"></param>
        /// <returns>返回string "-1"表示该已经存在,否则成功 </returns>
        public string UpdateWorkflow_FormBase(Workflow_FormBaseEntity _Workflow_FormBaseEntity)
        {
            //判断该记录是否已经存在
            DbParameter[] prams = {
                                       MakeInParam("@FormID",(DbType)SqlDbType.Int,4,_Workflow_FormBaseEntity.FormID ),
                                       MakeInParam("@FormName",(DbType)SqlDbType.VarChar,50,_Workflow_FormBaseEntity.FormName),
                                       MakeInParam("@FormTypeID",(DbType)SqlDbType.Int,4,_Workflow_FormBaseEntity.FormTypeID ),
                                       MakeInParam("@DisplayOrder",(DbType)SqlDbType.Int,4,_Workflow_FormBaseEntity.DisplayOrder ),
                                   };
            string sql = "select * from [dbo].[Workflow_FormBase] where FormID<>@FormID and ( FormName=@FormName or (FormTypeID=@FormTypeID and DisplayOrder=@DisplayOrder))";
            if (ExecuteDataset(CommandType.Text, sql, prams).Tables[0].Rows.Count > 0)
            {
                return "-1";//该记录已经存在

            }
            Workflow_FormBaseEntity _OriginalWorkflow_FormBaseEntity = GetWorkflow_FormBaseEntityByKeyCol(_Workflow_FormBaseEntity.FormID.ToString());
            DbParameter[] pramsUpdate = {
                                       MakeInParam("@FormID",(DbType)SqlDbType.Int,4,_Workflow_FormBaseEntity.FormID ),
                                       MakeInParam("@FormName",(DbType)SqlDbType.VarChar,200,_Workflow_FormBaseEntity.FormName ),
                                       MakeInParam("@FormDesc",(DbType)SqlDbType.VarChar,2000,_Workflow_FormBaseEntity.FormDesc ),
                                       MakeInParam("@FormTypeID",(DbType)SqlDbType.Int,4,_Workflow_FormBaseEntity.FormTypeID ),
                                       MakeInParam("@DisplayOrder",(DbType)SqlDbType.Int,4,_Workflow_FormBaseEntity.DisplayOrder ),
                                       MakeInParam("@Useflag",(DbType)SqlDbType.VarChar,50,_Workflow_FormBaseEntity.Useflag ),
                                       MakeInParam("@Creator",(DbType)SqlDbType.VarChar,50,_Workflow_FormBaseEntity.Creator ),
                                       MakeInParam("@CreateDate",(DbType)SqlDbType.DateTime,23,_Workflow_FormBaseEntity.CreateDate ),
                                       MakeInParam("@lastModifier",(DbType)SqlDbType.VarChar,50,_Workflow_FormBaseEntity.lastModifier ),
                                       MakeInParam("@lastModifyDate",(DbType)SqlDbType.DateTime,23,_Workflow_FormBaseEntity.lastModifyDate ),
                                             };
            StringBuilder sb = new StringBuilder();
            sb.Append("Update [dbo].[Workflow_FormBase]");
            sb.Append(" set ");
            sb.Append(" [FormName]=@FormName,");
            sb.Append(" [FormDesc]=@FormDesc,");
            sb.Append(" [FormTypeID]=@FormTypeID,");
            sb.Append(" [DisplayOrder]=@DisplayOrder,");
            sb.Append(" [Useflag]=@Useflag,");
            sb.Append(" [Creator]=@Creator,");
            sb.Append(" [CreateDate]=@CreateDate,");
            sb.Append(" [lastModifier]=@lastModifier,");
            sb.Append(" [lastModifyDate]=@lastModifyDate ");
            sb.Append(" where [FormID]=@FormID ");
            ExecuteNonQuery(CommandType.Text, sb.ToString(), pramsUpdate);

            ArrayList arlst = new ArrayList();
            arlst.Add("Workflow_FormBase");
            arlst.Add(_OriginalWorkflow_FormBaseEntity.FormTypeID);
            arlst.Add(_Workflow_FormBaseEntity.FormTypeID);
            return sp_ReDisplayOrder(arlst);
        }
Пример #6
0
 private string SaveData()
 {
     Workflow_FormBaseEntity _FormBaseEntity = new Workflow_FormBaseEntity();
     _FormBaseEntity.FormID = Convert.ToInt32(txtFormID.Value != string.Empty ? txtFormID.Value : "0");
     _FormBaseEntity.FormName = txtFormName.Text;
     _FormBaseEntity.FormDesc = txtFormDesc.Text;
     _FormBaseEntity.FormTypeID = Convert.ToInt32(ddlFormTypeID.SelectedValue);
     _FormBaseEntity.DisplayOrder = Convert.ToInt32(txtDisplayOrder.Text);
     _FormBaseEntity.Useflag = chkUseFlag.Checked ? "1" : "0";
     _FormBaseEntity.Creator = userEntity.UserID;
     _FormBaseEntity.CreateDate = DateTime.Now;
     _FormBaseEntity.lastModifier = userEntity.UserID;
     _FormBaseEntity.lastModifyDate = DateTime.Now;
     string sResult = "-1";
     if (strOperationState == "Add")
         sResult = DbHelper.GetInstance().AddWorkflow_FormBase(_FormBaseEntity);
     else if (strOperationState == "Update")
         sResult = DbHelper.GetInstance().UpdateWorkflow_FormBase(_FormBaseEntity);
     return sResult;
 }
Пример #7
0
        /// <summary>
        /// 增加表单
        /// </summary>
        /// <param name="form"></param>
        /// <returns></returns>
        private static List<int> addFormBase(XmlNodeList form)
        {
            DateTime dt = DateTime.Now;
            List<int> result = new List<int>();

            foreach (XmlNode fNode in form)
            {
                GPRP.Entity.Workflow_FormBaseEntity wfb = new GPRP.Entity.Workflow_FormBaseEntity();

                XmlNode FormID = fNode.SelectSingleNode("FormID");  //判断是否
                XmlNode FormName = fNode.SelectSingleNode("FormName");
                XmlNode FormDesc = fNode.SelectSingleNode("FormDesc");
                XmlNode FormTypeID = fNode.SelectSingleNode("FormTypeID");
                XmlNode DisplayOrder = fNode.SelectSingleNode("DisplayOrder");
                XmlNode Useflag = fNode.SelectSingleNode("Useflag");

                wfb.FormID =(FormID.InnerText!=string.Empty?Convert.ToInt32(FormID.InnerText):0);
                wfb.FormName = FormName.InnerText;
                wfb.FormDesc = FormDesc.InnerText;
                wfb.FormTypeID = Convert.ToInt32(FormTypeID.InnerText);
                wfb.DisplayOrder = Convert.ToInt32(DisplayOrder.InnerText);
                wfb.Useflag = Useflag.InnerText;
                wfb.Creator = WebUtils.GetCookieUser();  //人员,实现上逻辑有问题!
                wfb.CreateDate = dt;
                wfb.lastModifier = WebUtils.GetCookieUser();
                wfb.lastModifyDate = dt;

                string r = "-1";
                if (wfb.FormID != 0)  //判断是否有FormId
                {
                    r = DbHelper.GetInstance().UpdateWorkflow_FormBase(wfb);  //更新
                }
                else
                {
                     r = DbHelper.GetInstance().AddWorkflow_FormBase(wfb);   //新增
                }

                if (r != "-1")
                {
                    result.Add(wfb.FormID);
                }
            }

            return result;
        }