Ejemplo n.º 1
0
        /// <summary>
        /// 添加一个申请单
        /// </summary>
        /// <param name="modelMainBill">主表</param>
        /// <param name="modelTravelApplication">记录申请表之外的信息</param>
        /// <param name="strMsg"></param>
        /// <returns></returns>
        public int AddNote(Models.Bill_Main modelMainBill, Models.T_SpecialRebatesAppmode spemode, out string strMsg)
        {
            try
            {
                strMsg = "";
                if (modelMainBill == null || spemode == null)
                {
                    throw new Exception("主表或出差申请单模型不能为空");
                }
                //bool isSpecial = IsSpecialRebatesTruckCode(spemode.TruckCode);
                //bool iskpsq = IsKpsqTruckCode(spemode.TruckCode);
                //if (!iskpsq)
                //{
                //    if (!isSpecial)
                //    {
                //主表
                int iMainRel = bllMainBill.Add(modelMainBill);
                if (iMainRel <= 0)
                {
                    throw new Exception("向主表插入数据时发生未知错误!");
                }
                //出差申请单
                string[] strTravelPersionCode = spemode.SysPersionCode.Split(new string[] { "|&|" }, StringSplitOptions.RemoveEmptyEntries);
                int      iPersionLength       = strTravelPersionCode.Length;
                if (iPersionLength <= 0)
                {
                    throw new Exception("出差申请人个数不能为0!");
                }
                //  Delete(spemode.Code);
                int iRel = this.Add(spemode);

                return(1);

                //    }
                //    else
                //    {
                //        throw new Exception("该车辆已经申请过特殊返利!");
                //        return -1;
                //    }

                //}
                //else
                //{
                //    throw new Exception("该车辆已经做过开票申请!");
                //    return -1;
                //}
            }
            catch (Exception ex)
            {
                strMsg = ex.Message;
                return(-1);
            }
        }
Ejemplo n.º 2
0
        public int Add(Models.Bill_Main modelMainBill)
        {
            int iRel     = dalMain.DeleteMain(modelMainBill.BillCode);
            int iMainRel = dalMain.InsertMain(modelMainBill);

            if (iMainRel < 1)
            {
                throw new Exception("未知错误!");
            }
            else
            {
                return(1);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 添加一个申请单
 /// </summary>
 /// <param name="modelMainBill">主表</param>
 /// <param name="modelTravelApplication">记录申请表之外的信息</param>
 /// <param name="strMsg"></param>
 /// <returns></returns>
 public int AddNote(Models.Bill_Main modelMainBill, Models.Bill_TravelApplication modelTravelApplication, out string strMsg)
 {
     try
     {
         strMsg = "";
         if (modelMainBill == null || modelTravelApplication == null)
         {
             throw new Exception("主表或出差申请单模型不能为空");
         }
         //主表
         int iMainRel = bllMainBill.Add(modelMainBill);
         if (iMainRel <= 0)
         {
             throw new Exception("向主表插入数据时发生未知错误!");
         }
         //出差申请单
         string[] strTravelPersionCode = modelTravelApplication.travelPersionCode.Split(new string[] { "|&|" }, StringSplitOptions.RemoveEmptyEntries);
         int      iPersionLength       = strTravelPersionCode.Length;
         if (iPersionLength <= 0)
         {
             throw new Exception("出差申请人个数不能为0!");
         }
         //先删除
         Delete(modelTravelApplication.maincode);
         //循环添加
         for (int i = 0; i < iPersionLength; i++)
         {
             modelTravelApplication.travelPersionCode = strTravelPersionCode[i].ToString();
             int iRel = this.Add(modelTravelApplication);
             if (iRel <= 0)
             {
                 throw new Exception("向出差申请单插入数据时发生未知错误!");
             }
         }
         return(1);
     }
     catch (Exception ex)
     {
         strMsg = ex.Message;
         return(-1);
     }
 }