Esempio n. 1
0
        /// <summary>
        /// 删除收款单
        /// </summary>
        /// <returns>true 成功,false失败</returns>
        public static bool DeleteIncomeBill(string ID, string BillingID, string Price)
        {
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];

            bool   isSucc       = false;
            string SetBillingID = string.Empty;

            try
            {
                isSucc = IncomeBillDBHelper.DeleteIncomeBill(ID, BillingID, Price);
                //定义变量
                string remark;
                //成功时
                if (isSucc)
                {
                    //设置操作成功标识
                    remark = ConstUtil.LOG_PROCESS_SUCCESS;
                }
                else
                {
                    //设置操作成功标识
                    remark = ConstUtil.LOG_PROCESS_FAILED;
                }
                string[] noList = ID.Split(',');
                for (int i = 0; i < noList.Length; i++)
                {
                    //获取编号
                    string no = noList[i];
                    //替换两边的 '
                    no = no.Replace("'", string.Empty);
                    //操作日志
                    LogInfoModel logModel = InitLogInfo(no, 1);
                    //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空
                    logModel.Element = ConstUtil.LOG_PROCESS_DELETE;
                    //设置操作成功标识
                    logModel.Remark = remark;
                    //登陆日志
                    LogDBHelper.InsertLog(logModel);
                }

                if (isSucc)
                {
                    DataTable dt = BillingDBHelper.GetBillingYAccountsDT(BillingID);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        foreach (DataRow rows in dt.Rows)
                        {
                            if (Convert.ToDecimal(rows["YAccounts"]) == 0)
                            {
                                SetBillingID += rows["ID"].ToString() + ",";
                            }
                        }
                    }
                    //如果存在已付金额为0则更新结算状态
                    if (SetBillingID.Length > 0)
                    {
                        SetBillingID = SetBillingID.TrimEnd(new char[] { ',' });
                        isSucc       = BillingDBHelper.UpdateAccountStatusByID(SetBillingID, "0");
                    }
                }
                return(isSucc);
            }
            catch (Exception ex)
            {
                WriteSystemLog(userInfo, 1, ex);
                return(false);
            }
        }