Exemplo n.º 1
0
 public void DeleteSerialResult(SerialResult objSerialResult)
 {
     if (objSerialResult != null)
     {
         try
         {
             SerialResult objTemp = db.SerialResults.FirstOrDefault(o => o.id == objSerialResult.id && o.book_number == objSerialResult.book_number);
             if (objTemp != null)
             {
                 objTemp.IsUsed = false;
                 objTemp.DeletedDate = DateTime.Now;
                 objTemp.DeletedBy = objSerialResult.DeletedBy;
                 //db.SerialResults.Remove(objTemp);
                 db.SaveChanges();
             }
         }
         catch (Exception ex)
         {
             log.Fatal(ex);
         }
     }
 }
Exemplo n.º 2
0
        public bool SaveSerialBook(string strUserName, SerialBook oBook, DateTime dtStart, DateTime dtEnd, ref string strResponse)
        {
            bool result = false;
            if (oBook == null)
            {
                strResponse = "Dữ liệu không phù hợp";
            }
            else
            {
                if (IsSerialBookResultExisted(oBook.Customer_Id, oBook.Book_Number, dtStart, dtEnd))
                {
                    strResponse = string.Format("Số sổ book_number {0} của khách hàng {1} đã tồn tại!", oBook.Customer_Id, oBook.Book_Number);
                    log.Info(strResponse);
                }
                else
                {
                    try
                    {
                        string strSerials = string.Empty;
                        foreach (string str in oBook.Masoduthuongs)
                        {
                            strSerials += str + "|";
                        }
                        int nSeq = 0;
                        using (Promotion.DataModel.LuckySerial_BO objLuckySerial_BO = new LuckySerial_BO())
                        {
                            List<Promotion.DataModel.LuckySerial> lstData = objLuckySerial_BO.GetByInputTime(dtStart, dtEnd).ToList();
                            if (lstData != null && lstData.Count > 0)
                            {
                                nSeq = lstData.Count;
                            }

                        }
                        nSeq++;

                        using (Promotion.DataModel.SerialResult_BO objSerialResult_BO = new SerialResult_BO())
                        {
                            Promotion.DataModel.SerialResult objSerialResult = new SerialResult();
                            objSerialResult.book_number = oBook.Book_Number;
                            objSerialResult.customer_id = oBook.Customer_Id;
                            objSerialResult.customer_name = oBook.Customer_Name;
                            objSerialResult.CMND = oBook.CMTND;
                            objSerialResult.tel = oBook.Telephone;
                            objSerialResult.amount = oBook.TotalAmount;
                            objSerialResult.kyhan = oBook.Period;
                            objSerialResult.currency = oBook.Currency;
                            objSerialResult.Serials = strSerials;
                            objSerialResult.Input_time = DateTime.Now;
                            objSerialResult.SavedBy = strUserName;
                            objSerialResult.EFFECT_DATE = oBook.ValueDate;
                            objSerialResult.MATURITY_DATE = oBook.MaturityDate;
                            objSerialResult.Sector = oBook.Sector;
                            objSerialResult.ACCT_NUM = oBook.ACCOUNT_NUMBER;
                            objSerialResult.CO_CODE = oBook.CO_CODE;
                            objSerialResult.TERM = oBook.TERM;
                            objSerialResult.Seq = nSeq;
                            objSerialResult.DAO_CODE = oBook.DAO_CODE;
                            objSerialResult.DEPT_CODE = oBook.DEPT_CODE;
                            //objSerialResult.cMoney = oBook.TERM;
                            objSerialResult_BO.CreateSerialResult(objSerialResult);

                        }
                        log.Info(strSerials);
                        result = true;
                    }
                    catch (Exception ex)
                    {
                        log.Fatal(ex);
                    }
                }
            }

            return result;
        }
Exemplo n.º 3
0
 public void CreateSerialResult(SerialResult objSerialResult)
 {
     if (objSerialResult != null)
     {
         try
         {
             objSerialResult.IsUsed = true;
             db.SerialResults.Add(objSerialResult);
             db.SaveChanges();
         }
         catch (Exception ex)
         {
             log.Fatal(ex);
         }
     }
 }