Exemplo n.º 1
0
 /// <summary>
 /// بعداز با موفقیت آپلود شدن هر تصویر بانک رو آپلود می کنه
 /// </summary>
 /// <param name="Code"></param>
 public static void UpdateStateAfterSuccessfullUpload_eachImg(Int64 ImgId)
 {
     try
     {
         string NowDate = UiUtility.FarsiDate_ConvertDMYToYMD(BLLDate.getPersianDate(System.DateTime.Now)) + " " + System.DateTime.Now.TimeOfDay.ToString().Substring(0, 5);
         using (var context = new AutoClickDBEntities())
         {
             FilesINBarCode x = context.FilesINBarCodes.Where(s => s.FileId == ImgId && s.UploadedDateTime == null).FirstOrDefault();
             //age goft oonayi ke ye khata nadashtan faghat =>p.errorr==null
             x.UploadedDateTime   = NowDate;
             x.UploadedDateTime_G = System.DateTime.Now;
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
     }
 }
Exemplo n.º 2
0
        /// <summary>
        ///  بعداز زدن دکمه ثبت نهایی در صورت موفقیت آمیز بودن همه عکس های کد رو یه جا آپدیت می کنه
        /// </summary>
        public static void UpdateStateAfterSuccessfullUpload(double Code)
        {
            try
            {
                string NowDate = UiUtility.FarsiDate_ConvertDMYToYMD(BLLDate.getPersianDate(System.DateTime.Now)) + " " + System.DateTime.Now.TimeOfDay.ToString().Substring(0, 5);
                using (var context = new AutoClickDBEntities())
                {
                    ImagesHistory ImagesHistoryOb = new ImagesHistory();
                    ImagesHistoryOb.BarCodeData.کد_تفضیلی    = Code;
                    ImagesHistoryOb.SuccessfulUploadDateTime = NowDate;
                    context.ImagesHistories.Add(ImagesHistoryOb);

                    List <FilesINBarCode> x = context.FilesINBarCodes.Where(s => s.FK_Barcode == Code && s.UploadedDateTime == null).ToList();
                    //age goft oonayi ke ye khata nadashtan faghat =>p.errorr==null
                    x.ForEach(s => { s.UploadedDateTime = NowDate; s.UploadedDateTime_G = System.DateTime.Now; });
                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// برای یک کلاینت یه تعداد تصویر رو رزرو می کنه
        /// </summary>
        /// <param name="Moghoofeh"></param>
        /// <param name="Related_ClassesIds"></param>
        /// <param name="ClientInfo"></param>
        /// <param name="cnt"></param>
        public static void Reserve_Client(bool Moghoofeh, List <int> Related_ClassesIds, string ClientInfo, int cnt)
        {
            try
            {
                string CodePre = Moghoofeh ? "1" : "2";
                string NowDate = UiUtility.FarsiDate_ConvertDMYToYMD(BLLDate.getPersianDate(System.DateTime.Now)) + " " + System.DateTime.Now.TimeOfDay.ToString().Substring(0, 5);
                using (var context = new AutoClickDBEntities())
                {
                    List <double> dd = context.FilesINBarCodes.Where(s => s.UploadedDateTime == null && Related_ClassesIds.Contains(s.FK_FileClass))
                                       .Select
                                           (p => p.FK_Barcode).Distinct().ToList().Where(x => x.ToString().StartsWith(CodePre)).Take(cnt).ToList();



                    List <FilesINBarCode> ReservedList = context.FilesINBarCodes.Where(s => dd.Contains(s.FK_Barcode) && s.UploadedDateTime == null && Related_ClassesIds.Contains(s.FK_FileClass)).ToList();
                    ReservedList.ForEach(s => { s.ReservedDateTime_G = System.DateTime.Now; s.ReservedDateTime = NowDate; s.ReservedFor = ClientInfo; });
                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// بعد از زدن دکمه ثبت نهایی در صورت بروز خطا
        /// </summary>
        /// <param name="Code"></param>
        public static void UpdateStateAfterErrorAccurance(double Code, string GlobalErrorInUploadMessage, string ErrorMessage)
        {
            try
            {
                string NowDate = UiUtility.FarsiDate_ConvertDMYToYMD(BLLDate.getPersianDate(System.DateTime.Now));
                using (var context = new AutoClickDBEntities())
                {
                    ImagesHistory ImagesHistoryOb = new ImagesHistory();
                    ImagesHistoryOb.BarCodeData.کد_تفضیلی       = Code;
                    ImagesHistoryOb.GlobalErrorInUploadDateTime = NowDate;
                    ImagesHistoryOb.GlobalErrorInUploadMessage  = GlobalErrorInUploadMessage + " تاریخ: " + NowDate;
                    context.ImagesHistories.Add(ImagesHistoryOb);

                    List <FilesINBarCode> x = context.FilesINBarCodes.Where(s => s.FK_Barcode == Code && s.UploadedDateTime == null).ToList();
                    //age goft oonayi ke ye khata nadashtan faghat =>p.errorr==null
                    x.ForEach(s => s.ErrorMessage = ErrorMessage + " تاریخ: " + NowDate);
                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
        }