示例#1
0
        /// <summary>
        /// 插入签字明细信息
        /// </summary>
        /// <param name="employee"></param>
        /// <returns></returns>
        ///
        public static bool InsertSignatureDetail(SignatureDetail detail)
        {
            bool            ifdetailsuccess  = false;
            bool            ifcolumn6success = true;
            MySqlConnection con  = DBTools.GetMySqlConnection();
            MySqlConnection con1 = DBTools.GetMySqlConnection();
            MySqlCommand    cmd;
            MySqlCommand    cmd1;
            int             count   = -1;       // 受影响行数
            int             column6 = -1;       //栏目6的受影响行数

            try
            {
                //插入dsignatureetail
                con.Open();
                cmd             = con.CreateCommand();
                cmd.CommandText = INSERT_SIGNATURE_DETAIL_STR;
                //cmd.Parameters.AddWithValue("@Id", System.DateTime.Now.ToString("yyyyMMddHHmmss"));
                cmd.Parameters.AddWithValue("@Date", System.DateTime.Now);                  // 签字明细
                cmd.Parameters.AddWithValue("@EmpId", detail.EmpId);
                cmd.Parameters.AddWithValue("@ConId", detail.ConId);
                cmd.Parameters.AddWithValue("@Result", detail.Result);
                cmd.Parameters.AddWithValue("@Remark", detail.Remark);

                count = cmd.ExecuteNonQuery();
                cmd.Dispose();
                con.Close();
                con.Dispose();
                if (count == 1)     //  插入成功后的受影响行数为1
                {
                    Console.WriteLine("签字明细插入成功");
                    ifdetailsuccess = true;
                }
                else
                {
                    Console.WriteLine("签字明细插入失败");
                }
                //插入hdjcontract 中的column6 主办单位审核意见
                //Console.WriteLine(detail.Advice);
                string[] Message = Regex.Split(detail.Advice, "#", RegexOptions.IgnoreCase);
                //foreach (string item in Message)
                //{
                //    Console.WriteLine(item);
                //}
                //表示主办单位审核意见有信息  就写入数据库
                if (Message[0] == "1")
                {
                    con1.Open();
                    cmd1             = con1.CreateCommand();
                    cmd1.CommandText = UPDATE_HDJCONTRACT_COLUMN6_STR;
                    cmd1.Parameters.AddWithValue("@Advice", Message[1]);                  // 签字明细
                    cmd1.Parameters.AddWithValue("@ConId", detail.ConId);

                    column6 = cmd1.ExecuteNonQuery();
                    cmd1.Dispose();
                    con1.Close();
                    con1.Dispose();
                    if (column6 == 1)     //  插入成功后的受影响行数为1
                    {
                        Console.WriteLine("主办单位审核意见插入成功");
                        //ifcolumn6success = true;
                    }
                    else
                    {
                        Console.WriteLine("主办单位审核意见插入失败");
                        ifcolumn6success = false;
                    }
                }

                return(ifdetailsuccess && ifcolumn6success);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }

                // 每次进行签字以后需要判断一下当前阶段是否走完,如果完结则阶段  [计数器 + 1]
                DALSignatureDetail.SetSignatureCurrLevelTrigger(detail.ConId);

                ////  会签单信息已经完成,直接生成会签单信息
                //if (dalsignaturedetail.iscontractagree(detail.conid) == true)
                //{

                //    // 创建后台线程生成会签单信息
                //    parameterizedthreadstart pts = new parameterizedthreadstart(createhdjcontracttrigger);
                //    thread thradrecmsg = new thread(pts);
                //    thradrecmsg.isbackground = true;
                //    thradrecmsg.start(detail.conid);

                //}
            }
        }
示例#2
0
        /// <summary>
        /// 插入签字明细信息
        /// </summary>
        /// <param name="employee"></param>
        /// <returns></returns>
        ///
        public static bool InsertSignatureDetail(SignatureDetail detail)
        {
            MySqlConnection con = DBTools.GetMySqlConnection();

            MySqlCommand cmd;
            int          count = -1;             // 受影响行数

            try
            {
                con.Open();

                cmd             = con.CreateCommand();
                cmd.CommandText = INSERT_SIGNATURE_DETAIL_STR;
                //cmd.Parameters.AddWithValue("@Id", System.DateTime.Now.ToString("yyyyMMddHHmmss"));
                cmd.Parameters.AddWithValue("@Date", System.DateTime.Now);                  // 签字明细职位
                cmd.Parameters.AddWithValue("@EmpId", detail.EmpId);
                cmd.Parameters.AddWithValue("@ConId", detail.ConId);
                cmd.Parameters.AddWithValue("@Result", detail.Result);
                cmd.Parameters.AddWithValue("@Remark", detail.Remark);

                count = cmd.ExecuteNonQuery();
                cmd.Dispose();

                con.Close();
                con.Dispose();
                if (count == 1)     //  插入成功后的受影响行数为1
                {
                    Console.WriteLine("签字明细插入成功");
                    return(true);
                }
                else
                {
                    Console.WriteLine("签字明细插入失败");
                    return(false);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }

                // 每次进行签字以后需要判断一下当前阶段是否走完,如果完结则阶段  [计数器 + 1]
                DALSignatureDetail.SetSignatureCurrLevelTrigger(detail.ConId);

                ////  会签单信息已经完成,直接生成会签单信息
                //if (dalsignaturedetail.iscontractagree(detail.conid) == true)
                //{

                //    // 创建后台线程生成会签单信息
                //    parameterizedthreadstart pts = new parameterizedthreadstart(createhdjcontracttrigger);
                //    thread thradrecmsg = new thread(pts);
                //    thradrecmsg.isbackground = true;
                //    thradrecmsg.start(detail.conid);

                //}
            }
        }