Example #1
0
        /// <summary>
        /// 添加用户Users
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public int InsertUser(Users user)
        {
            int rows = 0;

            try
            {
                SqlQueue sq = new SqlQueue();

                StringBuilder insertSql = new StringBuilder();
                insertSql.Append("Insert into [Users]");
                insertSql.Append(" ([UID],[EmployeeID],[UserName],[UserPwd],[Tel],[Email],[Position],[Department],[Detail],[IsAdmin],[Character],[IsDelete],[TotalAmount],[UsedAmount],[RestAmount],[MoneyUnit],[ManagerID],[IsAble],[Store],[EmpDate]) ");
                insertSql.Append("values");
                insertSql.AppendFormat(" ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}',{9},{10},{11},{12},{13},{14},{15},'{16}',{17},'{18}',#{19}#)", user.UID, user.EmployeeID, user.UserName, user.UserPwd, user.Tel, user.Email, user.Position, user.Department, user.Detail, user.IsAdmin, user.Character, user.IsDelete, user.TotalAmount, user.UsedAmount, user.RestAmount, user.MoneyUnit, user.ManagerID, user.IsAble, user.Store, user.EmpDate);
                sq.InsertQuery(insertSql.ToString(), "", "", 0, 0);

                sq.Close();
                return(1);
            }
            catch (Exception ex)
            {
                //throw ex;

                return(0);
            }
        }
        /// <summary>
        /// 将提交的申请表Info插入数据库ApplicationInfo,添加申请表数据
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public int SubmitApplicationInfo(DataTable dt, double douTotalPrice, string strUID, int intFlag)
        {
            int rows = 0;

            try
            {
                SqlQueue sq = new SqlQueue();
                foreach (DataRow dr in dt.Rows)
                {
                    StringBuilder insertSql = new StringBuilder();
                    insertSql.Append("Insert into [ApplicationInfo]");
                    insertSql.Append(" ([TransNo],[Applicants],[ApplicantsName],[ApplicantsNo],[Location],[ApplicantsDate],[Approval],[ApprovalName],[ApprovalDate],[Approval2],[ApprovalName2],[ApprovalDate2],[TotalPrice],[Deadline],[SalesDate],[PurchaseLocation],[Store],[StoreName],[ApprovalState],[ApprovalState2],[StaffApproval],[StaffID],[StaffName],[IsDelete],[AppState],[UnCode],[MoneyUnit],[EditRemark]) ");
                    insertSql.Append("values");
                    insertSql.AppendFormat(" ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}',{12},'{13}','{14}','{15}','{16}','{17}',{18},{19},{20},'{21}','{22}',{23},{24},'{25}',{26},'{27}')", dr["TransNo"], dr["Applicants"], dr["ApplicantsName"], dr["ApplicantsNo"], dr["Location"], dr["ApplicantsDate"], dr["Approval"], dr["ApprovalName"], dr["ApprovalDate"], dr["Approval2"], dr["ApprovalName2"], dr["ApprovalDate2"], dr["TotalPrice"], dr["Deadline"], dr["SalesDate"], dr["PurchaseLocation"], dr["Store"], dr["StoreName"], dr["ApprovalState"], dr["ApprovalState2"], dr["StaffApproval"], dr["StaffID"], dr["StaffName"], dr["IsDelete"], dr["AppState"], dr["UnCode"], dr["MoneyUnit"], dr["EditRemark"]);
                    sq.InsertQuery(insertSql.ToString(), "Cache" + strUID, dr["TransNo"].ToString(), douTotalPrice, intFlag);
                }
                sq.Close();
                return(1);
            }
            catch (Exception)
            {
                //throw ex;

                return(0);
            }
            return(rows);
        }
Example #3
0
        /// <summary>
        /// 添加商品表数据Items
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public int InsertItems(DataTable dt)
        {
            int rows = 0;

            try
            {
                SqlQueue sq = new SqlQueue();
                foreach (DataRow dr in dt.Rows)
                {
                    StringBuilder insertSql = new StringBuilder();
                    insertSql.Append("Insert into [Items]");
                    insertSql.Append(" ([ItemID],[Price],[Price2],[Price3],[Price4],[Price5],[Price6],[Price7],[Price8],[Price9],[Price10],[Detail],[IsDelete],[IsSpecial],[ItemName]) ");
                    insertSql.Append("values");
                    insertSql.AppendFormat(" ('{0}',{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},'{11}',{12},{13},'{14}')", dr["ItemID"], dr["Price"], dr["Price2"], dr["Price3"], dr["Price4"], dr["Price5"], dr["Price6"], dr["Price7"], dr["Price8"], dr["Price9"], dr["Price10"], dr["Detail"], dr["IsDelete"], dr["IsSpecial"], dr["ItemName"]);
                    sq.InsertQuery(insertSql.ToString(), "", "", 0, 0);
                }
                sq.Close();
                return(1);
            }
            catch (Exception ex)
            {
                //throw ex;

                return(0);
            }
        }
        /// <summary>
        /// 添加ApplicationDetail数据
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public int SubmitApplicationDetail(DataTable dt, double douTotalPrice, string strUID, int intFlag)
        {
            int rows = 0;

            try
            {
                SqlQueue sq = new SqlQueue();
                foreach (DataRow dr in dt.Rows)
                {
                    StringBuilder insertSql = new StringBuilder();
                    insertSql.Append("Insert into [ApplicationDetail]");
                    insertSql.Append(" ([CodeID],[TransNo],[ItemID],[Detail],[Price],[MoneyUnit],[Count],[IsDelete],[SelforGift],[ApprovalCount],[ApprovalDiscount],[FinalPrice],[Recipient],[Relationship],[Reason],[IsSuccess],[PhoneNum]) ");
                    insertSql.Append("values");
                    insertSql.AppendFormat(" ('{0}','{1}','{2}','{3}',{4},{5},{6},{7},{8},{9},{10},{11},'{12}','{13}','{14}',{15},'{16}')", dr["CodeID"], dr["TransNo"], dr["ItemID"], dr["Detail"], dr["Price"], dr["MoneyUnit"], dr["Count"], dr["IsDelete"], dr["SelforGift"], dr["ApprovalCount"], dr["ApprovalDiscount"], dr["FinalPrice"], dr["Recipient"], dr["Relationship"], dr["Reason"], dr["IsSuccess"], dr["PhoneNum"]);
                    sq.InsertQuery(insertSql.ToString(), "Cache" + strUID, dr["TransNo"].ToString(), douTotalPrice, intFlag);
                }
                sq.Close();
                return(1);
            }
            catch (Exception)
            {
                //throw ex;

                return(0);
            }
            return(rows);
        }
Example #5
0
        /// <summary>
        /// 修改店面信息表StoreInfo
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public int UpdateStoreInfo(DataTable dt)
        {
            int rows = 0;

            try
            {
                SqlQueue sq = new SqlQueue();
                foreach (DataRow dr in dt.Rows)
                {
                    StringBuilder insertSql = new StringBuilder();
                    insertSql.Append("Update [StoreInfo] set ");
                    insertSql.AppendFormat(" [StoreName]='{0}',", dr["StoreName"]);
                    insertSql.AppendFormat(" [Address]='{0}',", dr["Address"]);
                    insertSql.AppendFormat(" [Contact]='{0}',", dr["Contact"]);
                    insertSql.AppendFormat(" [Tel]='{0}',", dr["Tel"]);
                    insertSql.AppendFormat(" [IsDelete]={0}", dr["IsDelete"]);
                    insertSql.AppendFormat(" where [ID]={0}", dr["ID"]);



                    sq.InsertQuery(insertSql.ToString(), "", "", 0, 0);
                }
                sq.Close();
                return(1);
            }
            catch (Exception ex)
            {
                //throw ex;
                return(0);
            }
            return(rows);
        }
Example #6
0
        private void toolStripButton6_Click(object sender, EventArgs e)
        {
            bool connSuccess = false;

            try
            {
                AccessHelper ah = new AccessHelper();
                ah.Close();
                connSuccess = true;
            }
            catch
            {
                MessageBox.Show("远程缓存同步失败", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                connSuccess = false;
            }
            if (connSuccess)
            {
                try
                {
                    SqlQueue sq = new SqlQueue();
                    sq.QuickExecuteSqlQuery();
                    sq.Close();
                    //MessageBox.Show("远程缓存同步完成,远程服务器每小时轮询处理一次,在此期间,您无法查看到新处理的结果,请勿重复操作!", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MessageBox.Show("远程缓存同步完成", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch
                {
                }
            }
        }
Example #7
0
        /// <summary>
        /// 添加店面信息表StoreInfo
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public int InsertStoreInfo(DataTable dt)
        {
            int rows = 0;

            try
            {
                SqlQueue sq = new SqlQueue();
                foreach (DataRow dr in dt.Rows)
                {
                    StringBuilder insertSql = new StringBuilder();
                    insertSql.Append("Insert into [StoreInfo]");
                    insertSql.Append(" ([StoreName],[Address],[Contact],[Tel],[IsDelete]) ");
                    insertSql.Append("values");
                    insertSql.AppendFormat(" ('{0}','{1}','{2}','{3}',{4})", dr["StoreName"], dr["Address"], dr["Contact"], dr["Tel"], dr["IsDelete"]);
                    sq.InsertQuery(insertSql.ToString(), "", "", 0, 0);
                }
                sq.Close();
                return(1);
            }
            catch (Exception ex)
            {
                //throw ex;

                return(0);
            }
        }
        /// <summary>
        /// 修改申请表数据ApplicationInfo
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public int  UpdateApplicationInfo(DataTable dt, double douTotalPrice, string strUID, int intFlag)
        {
            int       rows     = 0;
            DataTable insertDT = dt.Clone();

            try
            {
                SqlQueue sq = new SqlQueue();
                foreach (DataRow dr in dt.Rows)
                {
                    StringBuilder insertSql = new StringBuilder();
                    insertSql.Append("Update [ApplicationInfo] set ");
                    insertSql.AppendFormat(" [TransNo]='{0}',", dr["TransNo"]);
                    insertSql.AppendFormat(" [Applicants]='{0}',", dr["Applicants"]);
                    insertSql.AppendFormat(" [ApplicantsName]='{0}',", dr["ApplicantsName"]);
                    insertSql.AppendFormat(" [ApplicantsNo]='{0}',", dr["ApplicantsNo"]);
                    insertSql.AppendFormat(" [Location]='{0}',", dr["Location"]);
                    insertSql.AppendFormat(" [ApplicantsDate]='{0}',", dr["ApplicantsDate"]);
                    insertSql.AppendFormat(" [Approval]='{0}',", dr["Approval"]);
                    insertSql.AppendFormat(" [ApprovalName]='{0}',", dr["ApprovalName"]);
                    insertSql.AppendFormat(" [ApprovalDate]='{0}',", dr["ApprovalDate"]);
                    insertSql.AppendFormat(" [Approval2]='{0}',", dr["Approval2"]);
                    insertSql.AppendFormat(" [ApprovalName2]='{0}',", dr["ApprovalName2"]);
                    insertSql.AppendFormat(" [ApprovalDate2]='{0}',", dr["ApprovalDate2"]);
                    insertSql.AppendFormat(" [TotalPrice]={0},", dr["TotalPrice"]);
                    //insertSql.AppendFormat(" [Deadline]='{0}',", dr["Deadline"]);
                    insertSql.AppendFormat(" [SalesDate]='{0}',", dr["SalesDate"]);
                    insertSql.AppendFormat(" [PurchaseLocation]='{0}',", dr["PurchaseLocation"]);
                    insertSql.AppendFormat(" [Store]='{0}',", dr["Store"]);
                    insertSql.AppendFormat(" [StoreName]='{0}',", dr["StoreName"]);
                    insertSql.AppendFormat(" [ApprovalState]={0},", dr["ApprovalState"]);
                    insertSql.AppendFormat(" [ApprovalState2]={0},", dr["ApprovalState2"]);
                    insertSql.AppendFormat(" [StaffApproval]={0},", dr["StaffApproval"]);
                    insertSql.AppendFormat(" [StaffID]='{0}',", dr["StaffID"]);
                    insertSql.AppendFormat(" [StaffName]='{0}',", dr["StaffName"]);
                    insertSql.AppendFormat(" [IsDelete]={0},", dr["IsDelete"]);
                    insertSql.AppendFormat(" [AppState]={0},", dr["AppState"]);
                    insertSql.AppendFormat(" [EditReason]='{0}',", dr["EditReason"]);
                    insertSql.AppendFormat(" [MoneyUnit]={0},", dr["MoneyUnit"]);
                    insertSql.AppendFormat(" [EditRemark]='{0}',", dr["EditRemark"]);
                    insertSql.AppendFormat(" [UnCode]='{0}'", dr["UnCode"]);
                    insertSql.AppendFormat(" where [ID]={0}", dr["ID"]);
                    sq.InsertQuery(insertSql.ToString(), "Cache" + strUID, dr["TransNo"].ToString(), douTotalPrice, intFlag);

                    StringBuilder RunSql = new StringBuilder();
                    RunSql.Append("Update [ApplicationInfo] set ");
                    RunSql.AppendFormat(" [Deadline]='{0}' ", dr["Deadline"]);
                    RunSql.AppendFormat(" where [ID]={0}", dr["ID"]);
                    sq.InsertQuery(RunSql.ToString(), "Cache" + strUID, dr["TransNo"].ToString(), douTotalPrice, 2);
                }
                sq.Close();
                return(1);
            }
            catch (Exception ex)
            {
                //throw ex;
                return(0);
            }
            return(rows);
        }
Example #9
0
 private void AccessQueueTimer_Tick(object sender, EventArgs e)
 {
     try
     {
         SqlQueue sq = new SqlQueue();
         //sq.ExecuteSqlQuery();
         sq.QuickExecuteSqlQuery();
         sq.Close();
     }
     catch (Exception)
     {
     }
 }
        /// <summary>
        /// 购买确认详情
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public int UpdateBuyApplicationDetail(DataTable dt, string TransNo)
        {
            int       rows     = 0;
            DataTable insertDT = dt.Clone();

            try
            {
                SqlQueue sq = new SqlQueue();
                foreach (DataRow dr in dt.Rows)
                {
                    if (dr["IsSuccess"].ToString() == "1")
                    {
                        StringBuilder insertSql = new StringBuilder();

                        insertSql.Append("Update [ApplicationDetail] set ");
                        insertSql.AppendFormat(" [CodeID]='{0}',", dr["CodeID"]);
                        insertSql.AppendFormat(" [TransNo]='{0}',", dr["TransNo"]);
                        insertSql.AppendFormat(" [ItemID]='{0}',", dr["ItemID"]);
                        insertSql.AppendFormat(" [Detail]='{0}',", dr["Detail"]);
                        insertSql.AppendFormat(" [Price]={0},", dr["Price"]);
                        insertSql.AppendFormat(" [MoneyUnit]={0},", dr["MoneyUnit"]);
                        insertSql.AppendFormat(" [Count]={0},", dr["Count"]);
                        insertSql.AppendFormat(" [IsDelete]={0},", dr["IsDelete"]);
                        insertSql.AppendFormat(" [SelforGift]={0},", dr["SelforGift"]);
                        insertSql.AppendFormat(" [ApprovalCount]={0},", dr["ApprovalCount"]);
                        insertSql.AppendFormat(" [ApprovalDiscount]={0},", dr["ApprovalDiscount"]);
                        insertSql.AppendFormat(" [FinalPrice]={0},", dr["FinalPrice"]);
                        insertSql.AppendFormat(" [Recipient]='{0}',", dr["Recipient"]);
                        insertSql.AppendFormat(" [Relationship]='{0}',", dr["Relationship"]);
                        insertSql.AppendFormat(" [Reason]='{0}',", dr["Reason"]);
                        insertSql.AppendFormat(" [IsSuccess]='{0}',", dr["IsSuccess"]);
                        insertSql.AppendFormat(" [PhoneNum]='{0}'", dr["PhoneNum"]);
                        insertSql.AppendFormat(" where [ID]={0}", dr["ID"]);

                        sq.InsertQuery(insertSql.ToString(), "确认唯一码", TransNo, 1, int.Parse(dr["ID"].ToString()));
                    }
                }
                sq.Close();
                return(1);
            }
            catch (Exception ex)
            {
                //throw ex;
                return(0);
            }
            return(rows);
        }
Example #11
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="UID"></param>
        /// <returns></returns>
        public int DeleteUser(string ID)
        {
            int rows = 0;

            try
            {
                SqlQueue sq  = new SqlQueue();
                string   sql = string.Format("Update Users Set IsDelete =1 Where ID={0}", ID);
                sq.InsertQuery(sql, "", "", 0, 0);
                sq.Close();
                return(1);
            }
            catch (Exception ex)
            {
                //throw ex;
                return(0);
            }
        }
Example #12
0
        /// <summary>
        /// 修改用户信息
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public int UpdateUser(Users user)
        {
            int rows = 0;

            try
            {
                SqlQueue sq = new SqlQueue();

                StringBuilder insertSql = new StringBuilder();
                insertSql.Append("Update [Users] set ");
                insertSql.AppendFormat(" [EmployeeID]='{0}',", user.EmployeeID);
                insertSql.AppendFormat(" [UserName]='{0}',", user.UserName);
                insertSql.AppendFormat(" [UserPwd]='{0}',", user.UserPwd);
                insertSql.AppendFormat(" [Tel]='{0}',", user.Tel);
                insertSql.AppendFormat(" [Email]='{0}',", user.Email);
                insertSql.AppendFormat(" [Position]='{0}',", user.Position);
                insertSql.AppendFormat(" [Department]='{0}',", user.Department);
                insertSql.AppendFormat(" [Detail]='{0}',", user.Detail);
                insertSql.AppendFormat(" [IsAdmin]={0},", user.IsAdmin);
                insertSql.AppendFormat(" [Character]={0},", user.Character);
                insertSql.AppendFormat(" [IsDelete]={0},", user.IsDelete);
                insertSql.AppendFormat(" [TotalAmount]={0},", user.TotalAmount);
                insertSql.AppendFormat(" [UsedAmount]={0},", user.UsedAmount);
                insertSql.AppendFormat(" [RestAmount]={0},", user.RestAmount);
                insertSql.AppendFormat(" [MoneyUnit]={0},", user.MoneyUnit);
                insertSql.AppendFormat(" [ManagerID]='{0}',", user.ManagerID);
                insertSql.AppendFormat(" [Store]='{0}',", user.Store);
                insertSql.AppendFormat(" [IsAble]={0},", user.IsAble);
                insertSql.AppendFormat(" [EmpDate]=#{0}#,", user.EmpDate);
                insertSql.AppendFormat(" [AbleMode]={0}", user.AbleMode);
                insertSql.AppendFormat(" where [UID]='{0}'", user.UID);
                sq.InsertQuery(insertSql.ToString(), "", "", 0, 0);

                sq.Close();
                return(1);
            }
            catch (Exception ex)
            {
                //throw ex;
                return(0);
            }
            return(rows);
        }
        /// <summary>
        /// 删除订单表数据
        /// </summary>
        /// <param name="CtrlID"></param>
        /// <returns></returns>
        public int DeleteApplicaionInfo(string TransNo)
        {
            int rows = 0;

            try
            {
                SqlQueue sq  = new SqlQueue();
                string   sql = string.Format("Update ApplicationInfo Set IsDelete =1 Where TransNo='{0}'", TransNo);
                sq.InsertQuery(sql, "", "", 0, 2);
                sq.Close();
                return(1);
            }
            catch (Exception ex)
            {
                //throw ex;
                return(0);
            }
            return(rows);
        }
        /// <summary>
        /// 商品部最终确认
        /// </summary>
        /// <param name="CtrlID">控制号</param>
        /// <returns></returns>
        public int FinalConfirm(string TransNo)
        {
            int rows = 0;

            try
            {
                SqlQueue sq  = new SqlQueue();
                string   sql = string.Format("Update ApplicationInfo Set AppState=9 , FinalState=1 where IsDelete = 0 and TransNo='{0}'", TransNo);
                sq.InsertQuery(sql, "", "", 0, 0);
                sq.Close();
                return(1);
            }
            catch (Exception ex)
            {
                //throw ex;
                return(0);
            }
            return(rows);
        }
        /// <summary>
        /// 确认店面确认
        /// </summary>
        /// <param name="CtrlID">控制号</param>
        /// <returns></returns>
        public int StoreConfirm(string TransNo, Users user, DateTime dt)
        {
            int rows = 0;

            try
            {
                SqlQueue sq  = new SqlQueue();
                string   sql = string.Format("Update ApplicationInfo Set StaffName = '{0}' ,StaffID='{1}' ,SalesDate='{2}', AppState=6,StaffApproval=1  where  AppState<6 and IsDelete = 0 and TransNo='{3}'", user.UserName, user.UID, dt, TransNo);
                sq.InsertQuery(sql.ToString(), "确认唯一码", TransNo, 0, 0);
                sq.Close();
                return(1);
            }
            catch (Exception ex)
            {
                //throw ex;
                return(0);
            }
            return(rows);
        }
        /// <summary>
        /// 经理审批
        /// </summary>
        /// <param name="CtrlID">控制号</param>
        /// <returns></returns>
        public int ApprovalApplication2(string TransNo, Users users, int ApprovalState, DateTime dt)
        {
            int rows = 0;

            try
            {
                SqlQueue sq  = new SqlQueue();
                string   sql = string.Format("Update ApplicationInfo Set ApprovalDate2 = '{3}', AppState = 1 ,Approval2='{1}' , ApprovalName2='{2}' where   AppState=0 and IsDelete = 0 and TransNo='{0}'", TransNo, users.UID, users.UserName, dt);
                sq.InsertQuery(sql, "", "", 0, 0);
                sq.Close();
                return(1);
            }
            catch (Exception ex)
            {
                //throw ex;
                return(0);
            }
            return(rows);
        }
        /// <summary>
        /// 扣额度
        /// </summary>
        /// <param name="CtrlID">控制号</param>
        /// <returns></returns>
        public int StorePay(string TransNo, string check, string UID, double TotalPrice, double MoneyRate)
        {
            int rows = 0;

            try
            {
                double   FinalPrice = TotalPrice * MoneyRate;
                SqlQueue sq         = new SqlQueue();
                string   sql        = string.Format("Update [Users] Set [RestAmount] = ([RestAmount]-{0})  where  [UID]='{1}'", FinalPrice, UID);
                sq.InsertQuery(sql.ToString(), "确认唯一码", TransNo, 0, 0);
                sq.Close();
                return(1);
            }
            catch (Exception ex)
            {
                //throw ex;
                return(0);
            }
            return(rows);
        }
        ///// <summary>
        ///// 商品部审批不通过
        ///// </summary>
        ///// <param name="CtrlID">控制号</param>
        ///// <returns></returns>
        //public int ApprovalNotApplication(string TransNo, string UID ,string UserName, int ApprovalState, DateTime dt)
        //{
        //    int rows = 0;
        //    AccessHelper ah = new AccessHelper();
        //    string sql;
        //    sql = string.Format("Update ApplicationInfo Set ApprovalDate = '{3}', AppState = 3,Approval='{1}' , ApprovalName='{2}' where   AppState=1 and IsDelete = 0 and TransNo='{0}'", TransNo, UID, UserName, dt);
        //    try
        //    {
        //        OleDbCommand comm = new OleDbCommand(sql, ah.Conn);
        //        rows = comm.ExecuteNonQuery();
        //    }
        //    catch (Exception ex)
        //    {
        //        ah.Close();
        //        return 0;
        //    }
        //    ah.Close();
        //    return rows;
        //}


        /// <summary>
        /// 员工确认商品部修改后的申请单
        /// </summary>
        /// <param name="CtrlID">控制号</param>
        /// <returns></returns>
        public int StaffApprovalApplication(string TransNo)
        {
            string unCode = GetSHA1(TransNo);
            int    rows   = 0;

            try
            {
                SqlQueue sq  = new SqlQueue();
                string   sql = string.Format("Update ApplicationInfo Set  AppState = 4,UnCode='{1}' where   AppState=3 and IsDelete = 0 and TransNo='{0}'", TransNo, unCode);
                sq.InsertQuery(sql, "", "", 0, 0);
                sq.Close();
                return(1);
            }
            catch (Exception ex)
            {
                //throw ex;
                return(0);
            }
            return(rows);
        }
Example #19
0
        /// <summary>
        /// 修改商品表数据Items
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public int UpdateItems(DataTable dt)
        {
            int rows = 0;

            try
            {
                SqlQueue sq = new SqlQueue();
                foreach (DataRow dr in dt.Rows)
                {
                    StringBuilder insertSql = new StringBuilder();
                    insertSql.Append("Update [Items] set ");
                    insertSql.AppendFormat(" [ItemID]='{0}',", dr["ItemID"]);
                    insertSql.AppendFormat(" [Price]={0},", dr["Price"]);
                    insertSql.AppendFormat(" [Price2]={0},", dr["Price2"]);
                    insertSql.AppendFormat(" [Price3]={0},", dr["Price3"]);
                    insertSql.AppendFormat(" [Price4]={0},", dr["Price4"]);
                    insertSql.AppendFormat(" [Price5]={0},", dr["Price5"]);
                    insertSql.AppendFormat(" [Price6]={0},", dr["Price6"]);
                    insertSql.AppendFormat(" [Price7]={0},", dr["Price7"]);
                    insertSql.AppendFormat(" [Price8]={0},", dr["Price8"]);
                    insertSql.AppendFormat(" [Price9]={0},", dr["Price9"]);
                    insertSql.AppendFormat(" [Price10]={0},", dr["Price10"]);
                    insertSql.AppendFormat(" [Detail]='{0}',", dr["Detail"]);
                    insertSql.AppendFormat(" [IsDelete]={0},", dr["IsDelete"]);
                    insertSql.AppendFormat(" [IsSpecial]={0},", dr["IsSpecial"]);
                    insertSql.AppendFormat(" [ItemName]='{0}'", dr["ItemName"]);
                    insertSql.AppendFormat(" where [ID]={0}", dr["ID"]);
                    sq.InsertQuery(insertSql.ToString(), "", "", 0, 0);
                }
                sq.Close();
                return(1);
            }
            catch (Exception ex)
            {
                //throw ex;
                return(0);
            }
            return(rows);
        }
        /// <summary>
        /// 修改申请表详情数据ApplicationDetail
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public int UpdateApplicationDetail(DataTable dt, double douTotalPrice, string strUID, int intFlag)
        {
            int       rows     = 0;
            DataTable insertDT = dt.Clone();

            try
            {
                SqlQueue sq = new SqlQueue();
                foreach (DataRow dr in dt.Rows)
                {
                    StringBuilder insertSql = new StringBuilder();
                    if (dr.RowState == DataRowState.Added)
                    {
                        insertSql.Append("Insert into [ApplicationDetail]");
                        insertSql.Append(" ([CodeID],[TransNo],[ItemID],[Detail],[Price],[MoneyUnit],[Count],[IsDelete],[SelforGift],[ApprovalCount],[ApprovalDiscount],[FinalPrice],[Recipient],[Relationship],[Reason],[IsSuccess],[PhoneNum]) ");
                        insertSql.Append("values");
                        insertSql.AppendFormat(" ('{0}','{1}','{2}','{3}',{4},{5},{6},{7},{8},{9},{10},{11},'{12}','{13}','{14}',{15},'{16}')", dr["CodeID"], dr["TransNo"], dr["ItemID"], dr["Detail"], dr["Price"], dr["MoneyUnit"], dr["Count"], dr["IsDelete"], dr["SelforGift"], dr["ApprovalCount"], dr["ApprovalDiscount"], dr["FinalPrice"], dr["Recipient"], dr["Relationship"], dr["Reason"], dr["IsSuccess"], dr["PhoneNum"]);
                    }
                    else if (dr.RowState == DataRowState.Deleted)
                    {
                        dr.RejectChanges();
                        insertSql.AppendFormat("Delete from [ApplicationDetail] where [ID]={0}", dr["ID"]);
                    }
                    else
                    {
                        insertSql.Append("Update [ApplicationDetail] set ");
                        insertSql.AppendFormat(" [CodeID]='{0}',", dr["CodeID"]);
                        insertSql.AppendFormat(" [TransNo]='{0}',", dr["TransNo"]);
                        insertSql.AppendFormat(" [ItemID]='{0}',", dr["ItemID"]);
                        insertSql.AppendFormat(" [Detail]='{0}',", dr["Detail"]);
                        insertSql.AppendFormat(" [Price]={0},", dr["Price"]);
                        insertSql.AppendFormat(" [MoneyUnit]={0},", dr["MoneyUnit"]);
                        insertSql.AppendFormat(" [Count]={0},", dr["Count"]);
                        insertSql.AppendFormat(" [IsDelete]={0},", dr["IsDelete"]);
                        insertSql.AppendFormat(" [SelforGift]={0},", dr["SelforGift"]);
                        insertSql.AppendFormat(" [ApprovalCount]={0},", dr["ApprovalCount"]);
                        insertSql.AppendFormat(" [ApprovalDiscount]={0},", dr["ApprovalDiscount"]);
                        insertSql.AppendFormat(" [FinalPrice]={0},", dr["FinalPrice"]);
                        insertSql.AppendFormat(" [Recipient]='{0}',", dr["Recipient"]);
                        insertSql.AppendFormat(" [Relationship]='{0}',", dr["Relationship"]);
                        insertSql.AppendFormat(" [Reason]='{0}',", dr["Reason"]);
                        insertSql.AppendFormat(" [IsSuccess]='{0}',", dr["IsSuccess"]);
                        insertSql.AppendFormat(" [PhoneNum]='{0}'", dr["PhoneNum"]);
                        insertSql.AppendFormat(" where [ID]={0}", dr["ID"]);
                    }
                    if (insertSql.ToString().ToLower().Substring(0, 6) == "insert".Substring(0, 6) || insertSql.ToString().ToLower().Substring(0, 6) == "update".Substring(0, 6))
                    {
                        sq.InsertQuery(insertSql.ToString(), "Cache" + strUID, dr["TransNo"].ToString(), douTotalPrice, intFlag);
                    }
                    else
                    {
                        sq.InsertQuery(insertSql.ToString(), "", "", 0, 0);
                    }
                }
                sq.Close();
                return(1);
            }
            catch (Exception ex)
            {
                //throw ex;
                return(0);
            }
            return(rows);
        }