コード例 #1
0
 /// <summary>
 /// 获得凭证编号
 /// </summary>
 /// <param name="pzlx"></param>
 /// <returns></returns>
 public static string GetZWPZBH(ZWPZLX pzlx)
 {
     using (CtxRuntime ctxBase = new CtxRuntime())
     {
         string year   = LoginInfo.LoginDate.Year.ToString();
         string month  = LoginInfo.LoginDate.Month.ToString("00");
         ZWPZBH zWPZBH = (from t in ctxBase.ZWPZBH
                          where t.ZWPZBH_KJND == year
                          where t.ZWPZBH_KJQJ == month
                          where t.ZWPZBH_PZZ == pzlx.ZWPZLX_PZZ
                          select t).SingleOrDefault();
         if (zWPZBH != null)
         {
             string result = $"{pzlx.ZWPZLX_PZZ}{zWPZBH.ZWPZBH_PZBH}";
             zWPZBH.ZWPZBH_PZBH = (int.Parse(zWPZBH.ZWPZBH_PZBH) + 1).ToString("0000");
             zWPZBH.ZWPZBH_PZRQ = DHelper.ConverToDateString(LoginInfo.LoginDate);
             try
             {
                 ctxBase.SaveChanges();
                 return(result);
             }
             catch
             {
                 return(null);
             }
         }
         return(null);
     }
 }
コード例 #2
0
 /// <summary>
 /// 设置凭证类型
 /// </summary>
 /// <param name="lx"></param>
 /// <returns></returns>
 public bool SetVoucherType(ZWPZLX lx)
 {
     if (lx == null || Entity == null)
     {
         return(false);
     }
     try
     {
         Entity.ZWPZLX = CtxEntity.ZWPZLX.Single(t => t.ZWPZLX_LXBH == lx.ZWPZLX_LXBH);
         return(true);
     }
     catch (Exception ex)
     {
         Msg = "凭证类型设置失败";
         Ex  = ex;
         return(false);
     }
 }