Пример #1
0
        public int InsertFileUploadLog(params string[] parameters)
        {
            int fileId = 0;
            fileUploadLogModel objFU = new fileUploadLogModel();

            this.uow.BeginTransaction();
            try
            {
                objFU.fileName     = parameters[0].ToString();
                objFU.filePath     = parameters[1].ToString();
                objFU.createdBy    = Convert.ToInt32(parameters[2]);
                objFU.createdOn    = DateTime.Now;
                objFU.completedOn  = DateTime.Now;
                objFU.ipAddress    = parameters[3].ToString();
                objFU.uploadType   = Convert.ToInt32(parameters[4]);
                objFU.refData      = Convert.ToString(parameters[5]);
                objFU.uploadStatus = 1;
                objFU.validInv     = 0;
                objFU.invalidInv   = 0;
                this.uow.FileUploadLog.Add(objFU);
                if (this.uow.Save() > 0)
                {
                    fileId = objFU.fileId;
                }
                this.uow.CommitTransaction();
            }
            catch (Exception ex)
            {
                this.uow.RollbackTransaction();
                throw ex;
            }

            return(fileId);
        }
 public ActionResult PartialCancel(int OrderID, string LotNos, int FileNo = 0)
 {
     try
     {
         int LoginID = GetLogin();
         if (LoginID > 0)
         {
             OrderInfoViewModel objInfo = this.objMemoService.MemoInfo(OrderID);
             MemoDetail         obj     = this.objMemoService.CancelPartialMemo(OrderID, LotNos, LoginID);
             if (FileNo != 0)
             {
                 fileUploadLogModel objFile = this.objMemoService.GetFileByID(FileNo);
                 if (objFile != null)
                 {
                     String    path       = Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["INVUpload"]);
                     DataTable dtValid    = ListtoDataTable.ToDataTable <InventoryUpload>(obj.Inv.Where(x => x.LotStatus == "Valid").ToList());
                     DataTable dtNotValid = ListtoDataTable.ToDataTable <InventoryUpload>(obj.Inv.Where(x => x.LotStatus == "InValid").ToList());
                     ExportToExcel.SaveExcel(path, FileNo.ToString() + "_Valid", "Valid", dtValid);
                     ExportToExcel.SaveExcel(path, FileNo.ToString() + "_InValid", "InValid", dtNotValid);
                     objFile.validInv   = obj.Inv.Where(x => x.LotStatus == "Valid").Count();
                     objFile.invalidInv = obj.Inv.Where(x => x.LotStatus == "InValid").Count();
                     this.objMemoService.UpdateFile(objFile);
                     if (obj.Counts.OrderId > 0)
                     {
                         this.objMemoService.UpdateFile(obj.Counts.OrderId, FileNo);
                     }
                 }
             }
             if (objInfo != null && obj.Counts != null && obj.Counts.OrderId > 0)
             {
                 this.objMemoService.SendMailMemo(obj.Counts.OrderId, GetEmailID(), GetFullName(), objInfo.UserDetail.loginID, "List of inventory Partial Canceled Memo from memo-", "", Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["EmailTemplate_CancelMemo"]), objInfo, LotNos);
                 bool log = this.objUDSvc.UserActivitylogs(LoginID, "Partial canceled memo", LotNos);
             }
             return(Json(new Response {
                 Code = 200, IsSuccess = true, Message = "", Result = obj.Counts.validCount
             }));
         }
         return(Json(new Response {
             IsSuccess = false, Message = string.Format(StringResource.Invalid, "Session")
         }));
     }
     catch (Exception ex)
     {
         ErrorLog.Log("MemoController", "PartialCancel", ex);
         return(Json(new Response {
             IsSuccess = false, Message = ex.Message
         }));
     }
 }
 public ActionResult Book(string LotNos, int CustomerID, int isConfirmed, int isSellDirect, string Remark, int FileNo = 0)
 {
     try
     {
         int LoginID = GetLogin();
         if (LoginID > 0)
         {
             MemoDetail obj = this.objMemoService.CreateMemo(LotNos, LoginID, CustomerID, isConfirmed, isSellDirect, Remark);
             if (FileNo != 0)
             {
                 fileUploadLogModel objFile = this.objMemoService.GetFileByID(FileNo);
                 if (objFile != null)
                 {
                     String    path       = Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["INVUpload"]);
                     DataTable dtValid    = ListtoDataTable.ToDataTable <InventoryUpload>(obj.Inv.Where(x => x.LotStatus == "Valid").ToList());
                     DataTable dtNotValid = ListtoDataTable.ToDataTable <InventoryUpload>(obj.Inv.Where(x => x.LotStatus == "InValid").ToList());
                     ExportToExcel.SaveExcel(path, FileNo.ToString() + "_Valid", "Valid", dtValid);
                     ExportToExcel.SaveExcel(path, FileNo.ToString() + "_InValid", "InValid", dtNotValid);
                     objFile.validInv   = obj.Inv.Where(x => x.LotStatus == "Valid").Count();
                     objFile.invalidInv = obj.Inv.Where(x => x.LotStatus == "InValid").Count();
                     this.objMemoService.UpdateFile(objFile);
                     if (obj.Counts.OrderId > 0)
                     {
                         this.objMemoService.UpdateFile(obj.Counts.OrderId, FileNo);
                     }
                 }
             }
             if (obj != null && obj.Counts.OrderId != 0)
             {
                 this.objMemoService.SendMailMemo(obj.Counts.OrderId, GetEmailID(), GetFullName(), CustomerID, "List of inventory put on memo to", "", Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["EmailTemplate_PutOnMemo"]));
                 bool log = this.objUDSvc.UserActivitylogs(LoginID, "Put on memo", LotNos);
             }
             return(Json(new Response {
                 Code = 200, IsSuccess = true, Message = "", Result = obj.Counts
             }));
         }
         return(Json(new Response {
             IsSuccess = false, Message = string.Format(StringResource.Invalid, "Session")
         }));
     }
     catch (Exception ex)
     {
         ErrorLog.Log("MemoController", "Book", ex);
         return(Json(new Response {
             IsSuccess = false, Message = ex.Message
         }));
     }
 }
 public ActionResult SplitMemo(int OrderID, string LotNos, int CustomerID, int isConfirmed, int isSellDirect, string Remark, int FileNo = 0)
 {
     try
     {
         int LoginID = GetLogin();
         if (LoginID > 0)
         {
             OrderInfoViewModel objInfo = this.objMemoService.MemoInfo(OrderID);
             int RowCount = this.objMemoService.SplitMemo(OrderID, LotNos, LoginID, CustomerID, isConfirmed, isSellDirect, Remark);
             if (FileNo != 0)
             {
                 fileUploadLogModel objFile = this.objMemoService.GetFileByID(FileNo);
                 objFile.validInv   = LotNos.Split(',').Length;
                 objFile.invalidInv = 0;
                 this.objMemoService.UpdateFile(objFile);
             }
             if (objInfo != null && RowCount > 0)
             {
                 this.objMemoService.SendMailMemo(RowCount, GetEmailID(), GetFullName(), objInfo.UserDetail.loginID, "List of inventory SplitMemo from memo-", "", Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["EmailTemplate_SplitMemo"]));
                 bool log = this.objUDSvc.UserActivitylogs(LoginID, "Split memo", LotNos);
             }
             return(Json(new Response {
                 Code = 200, IsSuccess = true, Message = "", Result = RowCount
             }));
         }
         return(Json(new Response {
             IsSuccess = false, Message = string.Format(StringResource.Invalid, "Session")
         }));
     }
     catch (Exception ex)
     {
         ErrorLog.Log("MemoController", "PartialCancel", ex);
         return(Json(new Response {
             IsSuccess = false, Message = ex.Message
         }));
     }
 }
Пример #5
0
 public int UpdateFile(fileUploadLogModel obj)
 {
     uow.FileUploadLog.Edit(obj);
     return(uow.Save());
 }