Esempio n. 1
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     Workflow_FlowNodeEntity _FlowNodeEntity = new Workflow_FlowNodeEntity();
     for (int i = 0; i < GridView1.Rows.Count; i++)
     {
         string Prefix = "GridView1$ctl" + (i + 2).ToString().PadLeft(2, '0') + "$";
         _FlowNodeEntity.NodeID = Convert.ToInt32(GridView1.DataKeys[i][0]);
         _FlowNodeEntity.WithdrawTypeID = DNTRequest.GetString(Prefix + "WithdrawTypeID");
         _FlowNodeEntity.ArchiveFlag = DNTRequest.GetString(Prefix + "ArchiveFlag") == "on" ? 1 : 0;
         DbHelper.GetInstance().UpdateWorkflow_FlowNode2(_FlowNodeEntity);
     }
     ScriptManager.RegisterStartupScript(btnSubmit, this.GetType(), "add", "alert('设置成功');", true);
     BindGridView();
 }
Esempio n. 2
0
        private string SaveData()
        {
            Workflow_FlowNodeEntity _Workflow_FlowNodeEntity = new Workflow_FlowNodeEntity();
            _Workflow_FlowNodeEntity.NodeID = txtNodeID.Value != string.Empty ? Convert.ToInt32(txtNodeID.Value) : 0;
            _Workflow_FlowNodeEntity.NodeName = txtNodeName.Text;
            _Workflow_FlowNodeEntity.NodeDesc = txtNodeDesc.Text;
            _Workflow_FlowNodeEntity.WorkflowID = DNTRequest.GetInt("id", 0);
            _Workflow_FlowNodeEntity.NodeTypeID = Convert.ToInt32(ddlNodeTypeID.SelectedValue);
            _Workflow_FlowNodeEntity.DisplayOrder = Convert.ToInt32(txtDisplayOrder.Text);
            _Workflow_FlowNodeEntity.IsOverTime = chkIsOverTime.Checked ? 1 : 0;
            _Workflow_FlowNodeEntity.OverTimeLen = txtOverTimeLen.Text == "" ? (24 * 7).ToString() : txtOverTimeLen.Text;
            _Workflow_FlowNodeEntity.SignType = chkSignType.Checked ? 1 : 0;

            string sResult = "-1";
            if (strOperationState == "Add")
                sResult = DbHelper.GetInstance().AddWorkflow_FlowNode(_Workflow_FlowNodeEntity);
            else if (strOperationState == "Update")
                sResult = DbHelper.GetInstance().UpdateWorkflow_FlowNode(_Workflow_FlowNodeEntity);
            return sResult;
        }
Esempio n. 3
0
 private Workflow_FlowNodeEntity GetWorkflow_FlowNodeFromIDataReader(DbDataReader dr)
 {
     Workflow_FlowNodeEntity dt = new Workflow_FlowNodeEntity();
     if (dr.FieldCount > 0)
     {
         if (dr["NodeID"].ToString() != "" || dr["NodeID"] != null) dt.NodeID = Int32.Parse(dr["NodeID"].ToString());
         dt.NodeName = dr["NodeName"].ToString();
         dt.NodeDesc = dr["NodeDesc"].ToString();
         if (dr["WorkflowID"].ToString() != "" || dr["WorkflowID"] != null) dt.WorkflowID = Int32.Parse(dr["WorkflowID"].ToString());
         if (dr["NodeTypeID"].ToString() != "" || dr["NodeTypeID"] != null) dt.NodeTypeID = Int32.Parse(dr["NodeTypeID"].ToString());
         if (dr["IsOverTime"].ToString() != "" || dr["IsOverTime"] != null) dt.IsOverTime = Int32.Parse(dr["IsOverTime"].ToString());
         dt.OverTimeLen = dr["OverTimeLen"].ToString();
         if (dr["SignType"].ToString() != "" || dr["SignType"] != null) dt.SignType = Int32.Parse(dr["SignType"].ToString());
         dt.WithdrawTypeID = dr["WithdrawTypeID"].ToString();
         if (dr["ArchiveFlag"].ToString() != "" || dr["ArchiveFlag"] != null) dt.ArchiveFlag = Int32.Parse(dr["ArchiveFlag"].ToString());
         if (dr["DisplayOrder"].ToString() != "" || dr["DisplayOrder"] != null) dt.DisplayOrder = Int32.Parse(dr["DisplayOrder"].ToString());
         dr.Close();
         return dt;
     }
     dr.Close();
     return null;
 }
Esempio n. 4
0
 /// <summary>
 /// 修改信息
 /// </summary>
 /// <param name="_Workflow_FlowNodeEntity"></param>
 /// <returns>返回string "-1"表示该已经存在,否则成功 </returns>
 public string UpdateWorkflow_FlowNode2(Workflow_FlowNodeEntity _Workflow_FlowNodeEntity)
 {
     DbParameter[] pramsUpdate = {
                                      MakeInParam("@NodeID",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.NodeID ),
                                      MakeInParam("@WithdrawTypeID",(DbType)SqlDbType.VarChar,50,_Workflow_FlowNodeEntity.WithdrawTypeID ),
                                      MakeInParam("@ArchiveFlag",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.ArchiveFlag ),
                                  };
     StringBuilder sb = new StringBuilder();
     sb.Append("Update [dbo].[Workflow_FlowNode]");
     sb.Append(" set ");
     sb.Append(" [WithdrawTypeID]=@WithdrawTypeID,");
     sb.Append(" [ArchiveFlag]=@ArchiveFlag ");
     sb.Append(" where [NodeID]=@NodeID");
     return ExecuteNonQuery(CommandType.Text, sb.ToString(), pramsUpdate).ToString();
 }
Esempio n. 5
0
        /// <summary>
        /// 修改信息
        /// </summary>
        /// <param name="_Workflow_FlowNodeEntity"></param>
        /// <returns>返回string "-1"表示该已经存在,否则成功 </returns>
        public string UpdateWorkflow_FlowNode(Workflow_FlowNodeEntity _Workflow_FlowNodeEntity)
        {
            DbParameter[] pramsUpdate = {
                                       MakeInParam("@NodeID",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.NodeID ),
                                       MakeInParam("@NodeName",(DbType)SqlDbType.VarChar,200,_Workflow_FlowNodeEntity.NodeName ),
                                       MakeInParam("@NodeDesc",(DbType)SqlDbType.VarChar,2000,_Workflow_FlowNodeEntity.NodeDesc ),
                                       MakeInParam("@WorkflowID",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.WorkflowID ),
                                       MakeInParam("@NodeTypeID",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.NodeTypeID ),
                                       MakeInParam("@IsOverTime",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.IsOverTime ),
                                       MakeInParam("@OverTimeLen",(DbType)SqlDbType.Float,8,_Workflow_FlowNodeEntity.OverTimeLen ),
                                       MakeInParam("@SignType",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.SignType ),
                                       MakeInParam("@DisplayOrder",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.DisplayOrder ),
                                         };
            StringBuilder sb = new StringBuilder();
            sb.Append("Update [dbo].[Workflow_FlowNode]");
            sb.Append(" set ");
            sb.Append(" [NodeName]=@NodeName,");
            sb.Append(" [NodeDesc]=@NodeDesc,");
            sb.Append(" [WorkflowID]=@WorkflowID,");
            sb.Append(" [NodeTypeID]=@NodeTypeID,");
            sb.Append(" [IsOverTime]=@IsOverTime,");
            sb.Append(" [OverTimeLen]=@OverTimeLen,");
            sb.Append(" [SignType]=@SignType,");
            sb.Append(" [DisplayOrder]=@DisplayOrder ");
            sb.Append(" where [NodeID]=@NodeID ");
            ExecuteScalar(CommandType.Text, sb.ToString(), pramsUpdate);

            ArrayList arlst = new ArrayList();
            arlst.Add("Workflow_FlowNode");
            arlst.Add(_Workflow_FlowNodeEntity.WorkflowID);
            arlst.Add("");
            return sp_ReDisplayOrder(arlst);
        }
Esempio n. 6
0
        /// <summary>
        /// 新增信息
        /// </summary>
        /// <param name="_Workflow_FlowNodeEntity"></param>
        /// <returns>返回string "-1"表示该已经存在,否则成功 </returns>
        public string AddWorkflow_FlowNode(Workflow_FlowNodeEntity _Workflow_FlowNodeEntity)
        {
            //判断该记录是否已经存在
            DbParameter[] prams = {
                                       MakeInParam("@WorkflowID",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.WorkflowID ),
                                       MakeInParam("@NodeName",(DbType)SqlDbType.VarChar,200,_Workflow_FlowNodeEntity.NodeName),
                                   };
            string sql = " select * from [dbo].[Workflow_FlowNode] where WorkflowID=@WorkflowID and NodeName=@NodeName ";
            if (ExecuteDataset(CommandType.Text, sql, prams).Tables[0].Rows.Count > 0)
            {
                return "-1";//该记录已经存在
            }
            else
            {
                DbParameter[] pramsInsert = {
                                       MakeInParam("@NodeName",(DbType)SqlDbType.VarChar,200,_Workflow_FlowNodeEntity.NodeName ),
                                       MakeInParam("@NodeDesc",(DbType)SqlDbType.VarChar,2000,_Workflow_FlowNodeEntity.NodeDesc ),
                                       MakeInParam("@WorkflowID",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.WorkflowID ),
                                       MakeInParam("@NodeTypeID",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.NodeTypeID ),
                                       MakeInParam("@IsOverTime",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.IsOverTime ),
                                       MakeInParam("@OverTimeLen",(DbType)SqlDbType.Float,8,_Workflow_FlowNodeEntity.OverTimeLen ),
                                       MakeInParam("@SignType",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.SignType ),
                                       MakeInParam("@DisplayOrder",(DbType)SqlDbType.Int,4,_Workflow_FlowNodeEntity.DisplayOrder ),
                                             };
                StringBuilder sb = new StringBuilder();
                sb.Append("INSERT INTO [dbo].[Workflow_FlowNode]");
                sb.Append("(");
                sb.Append(" [NodeName]");
                sb.Append(",[NodeDesc]");
                sb.Append(",[WorkflowID]");
                sb.Append(",[NodeTypeID]");
                sb.Append(",[IsOverTime]");
                sb.Append(",[OverTimeLen]");
                sb.Append(",[SignType]");
                sb.Append(",[DisplayOrder]");
                sb.Append(") ");
                sb.Append(" VALUES (");
                sb.Append("@NodeName,");
                sb.Append("@NodeDesc,");
                sb.Append("@WorkflowID,");
                sb.Append("@NodeTypeID,");
                sb.Append("@IsOverTime,");
                sb.Append("@OverTimeLen,");
                sb.Append("@SignType,");
                sb.Append("@DisplayOrder )");
                sb.Append("select @@identity;");

                //ExecuteScalar(CommandType.Text, sb.ToString(), pramsInsert);

                _Workflow_FlowNodeEntity.NodeID = Convert.ToInt32(ExecuteScalar(CommandType.Text, sb.ToString(), pramsInsert).ToString());

                ArrayList arlst = new ArrayList();
                arlst.Add("Workflow_FlowNode");
                arlst.Add(_Workflow_FlowNodeEntity.WorkflowID);
                arlst.Add("");
                return sp_ReDisplayOrder(arlst);
            }
        }
Esempio n. 7
0
 private string ScriptSerialize(Workflow_FlowNodeEntity nwf)
 {
     JavaScriptSerializer js = new JavaScriptSerializer();
     return js.Serialize(nwf);
 }