Exemplo n.º 1
0
        protected void btnSaveWZD_Click(object sender, EventArgs e)
        {
            try
            {
                WorkZoneDetail wzd = new WorkZoneDetail();
                wzd           = WorkZoneDetail.GetWorkZoneDetail(int.Parse(HiddenWorkZoneId.Value), int.Parse(HiddenWorkZoneDetailId.Value));
                wzd.Comment   = txtCommetWZD.Text;
                wzd.ImageFile = string.Format(Constant.WORKNC_WZ_DETAIL_IMAGE_NAME, wzd.WorkZoneDetailId);
                wzd.Update();
                if (ViewState["imgWZD"] == null)
                {
                    return;
                }

                WorkZone wz = WorkZone.GetWorkZone(int.Parse(HiddenWorkZoneId.Value));

                string path = "~/" + Common.GetFolderWorkZoneDetail(wz.CompanyId, wz.CompanyName, wz.FactoryId, wz.FactoryName, wz.WorkZoneId, wz.Name);

                SaveImage("imgWZD", path, wzd.ImageFile);
                ViewState.Remove("imgWZD");
                panelMain.Visible       = true;
                panelEidtDetail.Visible = false;
            }
            catch (Exception ex)
            {
                RegisterStartupScript("alert(\"" + GetJSMessage(GetResource("Title_Error"), ex.Message) + "\");");
                logger.Error("Error in Save WorkZoneDetail:", ex);
            }
        }
Exemplo n.º 2
0
        private void FillWorkZoneDetail()
        {
            // grdWorkZoneDetail.Columns[16].Visible = grdWorkZoneDetail.Columns[17].Visible = true;
            string id = Request.QueryString["Id"];

            if (id == string.Empty)
            {
                return;
            }


            List <WorkZoneDetail> listWZD = new List <WorkZoneDetail>();

            listWZD = WorkZoneDetail.GetWorkZoneDetailByWorkZoneID(int.Parse(id));
            if (listWZD.Count == 0)
            {
                WorkZoneDetail WZD = new WorkZoneDetail();
                WZD.WorkZoneId       = -1;
                WZD.WorkZoneDetailId = -1;
                listWZD.Add(WZD);
                grdWorkZoneDetail.DataSource = listWZD;
                grdWorkZoneDetail.DataBind();
                if (grdWorkZoneDetail.Rows[0].Cells[17].Text == "-1")
                {
                    grdWorkZoneDetail.Rows[0].Visible = false;
                    return;
                }
            }
            grdWorkZoneDetail.DataSource = listWZD;
            grdWorkZoneDetail.DataBind();
            //grdWorkZoneDetail.Columns[16].Visible = grdWorkZoneDetail.Columns[17].Visible = false;
        }
Exemplo n.º 3
0
        public static List <FactoryStatus> GetListFactoryStatusFilter(int companyId, string factoryName, string fromDate, string toDate)
        {
            DateTime dtFrom = new DateTime(2000, 1, 1);
            DateTime dtTo   = new DateTime(2200, 1, 1);

            if (!string.IsNullOrWhiteSpace(fromDate))
            {
                dtFrom = Convert.ToDateTime(fromDate);
            }
            if (!string.IsNullOrWhiteSpace(toDate))
            {
                dtTo = Convert.ToDateTime(toDate);
            }
            if (string.IsNullOrWhiteSpace(factoryName))
            {
                factoryName = "";
            }

            var context = new DBContext();

            var query =
                (from w in context.GetTable <WorkZone>()
                 join
                 f in context.GetTable <Factory>() on new { w.FactoryId } equals new { f.FactoryId }
                 where
                 (
                     f.CompanyId == companyId &&
                     w.CompanyId == companyId &&
                     f.Name.ToLower().Contains(factoryName.ToLower()) &&
                     (w.ProgramDate != null && dtFrom.Date <= w.ProgramDate.Value.Date && w.ProgramDate.Value.Date <= dtTo.Date) &&
                     f.isDeleted == false
                 )
                 select new
            {
                ImageFile = f.ImageFile,
                Status = WorkZoneDetail.GetStatusForWorkZone(w.WorkZoneId),
                FactoryId = w.FactoryId,
                FactoryName = f.Name
            }
                ).GroupBy(p => new { p.FactoryId, p.FactoryName }).ToList();

            List <FactoryStatus> list = new List <FactoryStatus>();
            string companyPath        = string.Format(Constant.PATH_COMPANY, companyId, Company.GetCompanyName(companyId));

            foreach (var i in query)
            {
                FactoryStatus s = new FactoryStatus();
                s.FactoryId   = i.First().FactoryId;
                s.FactoryName = i.First().FactoryName;
                string factoryPath = string.Format(Constant.PATH_FACTORY, s.FactoryId, s.FactoryName);
                s.ImageFile = string.IsNullOrEmpty(i.First().ImageFile) ? "" : string.Format(@"{0}{1}{2}/{3}", Common.AppSettingKey(Constant.PORTAL_CONFIG), companyPath, factoryPath, i.First().ImageFile.Replace(" ", "%20"));//Ima

                s.InProcess   = i.Where(p => p.Status == 0).Count();
                s.HaveProblem = i.Where(p => p.Status == 1).Count();
                s.Finished    = i.Where(p => p.Status == 2).Count();

                list.Add(s);
            }
            return(list);
        }
Exemplo n.º 4
0
        private void ShowWorkZOneDetail()
        {
            WorkZoneDetail wzd = new WorkZoneDetail();

            wzd                = WorkZoneDetail.GetWorkZoneDetail(int.Parse(HiddenWorkZoneId.Value), int.Parse(HiddenWorkZoneDetailId.Value));
            txtNo.Text         = wzd.No;
            txtNCfileName.Text = wzd.NCFileName;
            txtPathType.Text   = wzd.PathType;
            txtCommetWZD.Text  = wzd.Comment;
            txtImgWZD.Text     = wzd.ImageFile;

            WorkZone wz             = WorkZone.GetWorkZone(int.Parse(HiddenWorkZoneId.Value));
            string   pathFileDetail = Server.MapPath("~/" + Common.GetFolderWorkZoneDetail(wz.CompanyId, wz.CompanyName, wz.FactoryId, wz.FactoryName, wz.WorkZoneId, wz.Name)) + "/" + wzd.ImageFile;

            if (File.Exists(pathFileDetail))
            {
                imgWZD.ImageUrl = "~/" + Common.GetFolderWorkZoneDetail(wz.CompanyId, wz.CompanyName, wz.FactoryId, wz.FactoryName, wz.WorkZoneId, wz.Name) + "/" + txtImgWZD.Text + "?" + (new Random()).Next(int.MinValue, int.MaxValue) + "";
            }
            else
            {
                imgWZD.ImageUrl = "~/Images/no-image.png";
            }

            panelMain.Visible       = false;
            panelEidtDetail.Visible = true;
        }
Exemplo n.º 5
0
        public void UpdateDetailStatus(WorkZoneDetail workZoneDetail)// int WorkZoneId, int WorkZoneDetailId, int Status, string CreateAccount) //
        {
            logger.DebugFormat("updateDetailStatus Begin, workZoneId= {0}, workZoneDetailId = {1}, updateStatus ={2}, userName = {3}", workZoneDetail.WorkZoneId, workZoneDetail.WorkZoneDetailId, workZoneDetail.Status, workZoneDetail.CreateAccount);
            WorkZoneDetail.UpdateDetailStatus(workZoneDetail.WorkZoneId, workZoneDetail.WorkZoneDetailId, workZoneDetail.Status, workZoneDetail.CreateAccount);

            if (workZoneDetail.Status == 2)
            {
                logger.Debug("Case Finish workZone - remove detail problem");
                try
                {
                    WorkZone wk = WorkZone.GetWorkZone(workZoneDetail.WorkZoneId);

                    string pathFolderProblem = Path.Combine(System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath, Common.GetFolderWorkZoneProblem(wk.CompanyId, wk.CompanyName, wk.FactoryId, wk.FactoryName, wk.WorkZoneId, wk.Name));

                    List <DetailProblem> listProblem = DetailProblem.GetAllDetailProblem(workZoneDetail.WorkZoneId, workZoneDetail.WorkZoneDetailId);
                    foreach (DetailProblem i in listProblem)
                    {
                        i.Delete();

                        string pathFile = Path.Combine(pathFolderProblem, i.ImageFile);
                        if (File.Exists(pathFile))
                        {
                            File.Delete(pathFile);
                        }
                    }
                }
                catch (Exception ex)
                {
                    logger.Warn("Ignore case delete problem", ex);
                }
            }
        }
Exemplo n.º 6
0
        public static List <WorkZoneStatus> GetListWorkZoneStatusFromFactory(int FactoryId)
        {
            List <WorkZoneStatus> list = new List <WorkZoneStatus>();
            var context = new DBContext();

            list =
                (from w in context.GetTable <WorkZone>()
                 join m in context.GetTable <Machine>() on new { w.MachineId } equals new { m.MachineId }
                 where
                 (
                     w.FactoryId == FactoryId &&
                     m.isDeleted == false
                 )
                 select new WorkZoneStatus()
            {
                WorkZoneId = w.WorkZoneId,
                WorkZoneName = w.Name,
                CompanyId = w.CompanyId,
                ImageFile = w.ImageFile,
                Upload = string.Format("{0:yyyy-MM-dd}", w.ModifiedDate),
                Machine = m.Name,
                Operator = w.NCDataProgramer,
                StatusId = WorkZoneDetail.GetStatusForWorkZone(w.WorkZoneId),            //w.Status,
                Date = !w.ProgramDate.HasValue ? "" : w.ProgramDate.Value.ToString(),
            }
                ).ToList();

            foreach (WorkZoneStatus i in list)
            {
                i.Status = Common.GetResourceString(string.Format("STATUS_{0}", i.StatusId));

                if (i.Date != "")
                {
                    i.Date = DateTime.Parse(i.Date).ToString("yyyy-MM-dd");
                }
                if (string.IsNullOrEmpty(i.ImageFile))
                {
                    i.ImageFile = "";     //no image
                }
                else
                {
                    string pathWorkZone = Common.GetFolderWorkZone(i.CompanyId, Company.GetCompanyName(i.CompanyId), FactoryId, Factory.GetFactoryName(FactoryId), i.WorkZoneId, i.WorkZoneName);
                    pathWorkZone = pathWorkZone.Replace("Portal", "");
                    i.ImageFile  = string.Format(@"{0}{1}/{2}", Common.AppSettingKey(Constant.PORTAL_CONFIG), pathWorkZone, i.ImageFile).Replace(" ", "%20");
                }
            }
            return(list);
        }
Exemplo n.º 7
0
 public List <WorkZoneDetail> TestGetListWorkZoneDetail(int workZoneId)
 {
     return(WorkZoneDetail.GetListWorkZoneDetail(workZoneId));
 }
Exemplo n.º 8
0
        private List <WorkZoneDetail> GetListWorkZoneDetail(string directoryWorkZone)
        {
            logger.Debug("BEGIN GetListWorkZoneDetail from directoryWorkZone = " + directoryWorkZone);
            string pathWorkZoneDetail = Path.Combine(directoryWorkZone, "zoneinfo.csv");

            if (!File.Exists(pathWorkZoneDetail))
            {
                throw new Exception(Common.GetResourceString("MSG_ZONE_INFO_CSV_NOT_FOUND"));
            }

            //Read CSV file
            List <WorkZoneDetail> listWorkZoneDetail = new List <WorkZoneDetail>();
            StreamReader          sr = new StreamReader(pathWorkZoneDetail, Encoding.GetEncoding(932));
            string inputLine         = "";

            String[] inputLineValues = null;
            Regex    r = new Regex(",(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))");

            while ((inputLine = sr.ReadLine()) != null)
            {
                inputLineValues = inputLine.Split('\n');
                if (inputLineValues[0] != null && inputLineValues[0].Trim() != "")
                {
                    string[] values = r.Split(inputLineValues[0]);
                    if (values.Length >= 2)
                    {
                        #region Get WorkZone Detail
                        if (string.IsNullOrWhiteSpace(values[0]) || values[0] == "")
                        {
                            continue;
                        }
                        WorkZoneDetail objWorkZoneDetail = new WorkZoneDetail();
                        objWorkZoneDetail.No       = values[0];                     //A
                        objWorkZoneDetail.PathType = CorrectString(values[1]);      //B
                        objWorkZoneDetail.Comment  = CorrectString(values[2]);      //C

                        if (!string.IsNullOrEmpty(values[34]) && values[34] != "-") //AI
                        {
                            objWorkZoneDetail.ToolLenth = double.Parse(values[34].Replace('-', '0'));
                        }

                        if (!string.IsNullOrEmpty(values[8]) && values[8] != "-")//I
                        {
                            objWorkZoneDetail.Tno = double.Parse(values[8]);
                        }

                        if (!string.IsNullOrEmpty(values[10]) && values[10] != "-")//K
                        {
                            objWorkZoneDetail.Tolerance = double.Parse(values[10]);
                        }

                        if (!string.IsNullOrEmpty(values[11]) && values[11] != "-")//L
                        {
                            objWorkZoneDetail.StockAllowance = double.Parse(values[11]);
                        }

                        //NC Data
                        objWorkZoneDetail.NCFileName  = CorrectString(values[28]);                           //-> AC
                        objWorkZoneDetail.MachineTime = values[61];                                          //BJ
                        if (!string.IsNullOrWhiteSpace(values[55]) && values[55] != "" && values[55] != "-") //BD
                        {
                            objWorkZoneDetail.MachineDistance = double.Parse(values[55]);
                        }

                        //Tool Infomation
                        objWorkZoneDetail.ToolShape = CorrectString(values[6]);   //G

                        if (!string.IsNullOrEmpty(values[3]) && values[3] != "-") //D
                        {
                            objWorkZoneDetail.ToolDia = double.Parse(values[3].ToUpper().Replace("D", ""));
                        }

                        if (!string.IsNullOrEmpty(values[4]) && values[4] != "-")//E
                        {
                            objWorkZoneDetail.ToolConerR = double.Parse(values[4].ToUpper().Replace("R", ""));
                        }

                        objWorkZoneDetail.HolderName = CorrectString(values[25]); //Z

                        //Cut Condition
                        if (!string.IsNullOrEmpty(values[18]) && values[18] != "-")//S
                        {
                            objWorkZoneDetail.Spindle = double.Parse(values[18]);
                        }

                        if (!string.IsNullOrEmpty(values[20]) && values[20] != "-")//U
                        {
                            objWorkZoneDetail.CuttingFeedRate = double.Parse(values[20]);
                        }

                        if (!string.IsNullOrWhiteSpace(values[19]) && values[19] != "" && values[19] != "-")//T
                        {
                            objWorkZoneDetail.ApproachFeedRate = double.Parse(values[19]);
                        }


                        objWorkZoneDetail.Status = 0;


                        string pathFileImage = Path.Combine(directoryWorkZone, string.Format(Constant.WORKNC_WZ_DETAIL_IMAGE_NAME, objWorkZoneDetail.No));

                        objWorkZoneDetail.Base64Data = null;
                        if (File.Exists(pathFileImage))
                        {
                            objWorkZoneDetail.ImageFile = Path.GetFileName(pathFileImage);

                            // Load file meta data with FileInfo
                            FileInfo fileInfo = new FileInfo(pathFileImage);

                            // The byte[] to save the data in
                            byte[] data = new byte[fileInfo.Length];
                            using (FileStream fs = fileInfo.OpenRead())
                            {
                                fs.Read(data, 0, data.Length);
                            }
                            objWorkZoneDetail.Base64Data = Convert.ToBase64String(data);
                        }
                        listWorkZoneDetail.Add(objWorkZoneDetail);
                        #endregion
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            sr.Close();
            return(listWorkZoneDetail);
        }
Exemplo n.º 9
0
        private void ShowWorkZOneDetail()
        {
            WorkZoneDetail wzd = new WorkZoneDetail();

            wzd = WorkZoneDetail.GetWorkZoneDetail(int.Parse(HiddenWorkZoneId.Value), int.Parse(HiddenWorkZoneDetailId.Value));
            txtNo.Text = wzd.No;
            txtNCfileName.Text = wzd.NCFileName;
            txtPathType.Text = wzd.PathType;
            txtCommetWZD.Text = wzd.Comment;
            txtImgWZD.Text = wzd.ImageFile;

            WorkZone wz = WorkZone.GetWorkZone(int.Parse(HiddenWorkZoneId.Value));
            string pathFileDetail = Server.MapPath("~/" + Common.GetFolderWorkZoneDetail(wz.CompanyId, wz.CompanyName, wz.FactoryId, wz.FactoryName, wz.WorkZoneId, wz.Name)) + "/" + wzd.ImageFile;

            if (File.Exists(pathFileDetail))
                imgWZD.ImageUrl = "~/" + Common.GetFolderWorkZoneDetail(wz.CompanyId, wz.CompanyName, wz.FactoryId, wz.FactoryName, wz.WorkZoneId, wz.Name) + "/" + txtImgWZD.Text + "?" + (new Random()).Next(int.MinValue, int.MaxValue) + "";
            else
                imgWZD.ImageUrl = "~/Images/no-image.png";

            panelMain.Visible = false;
            panelEidtDetail.Visible = true;
        }
Exemplo n.º 10
0
        private void FillWorkZoneDetail()
        {
            // grdWorkZoneDetail.Columns[16].Visible = grdWorkZoneDetail.Columns[17].Visible = true;
            string id = Request.QueryString["Id"];
            if (id == string.Empty)
                return;

            List<WorkZoneDetail> listWZD = new List<WorkZoneDetail>();
            listWZD = WorkZoneDetail.GetWorkZoneDetailByWorkZoneID(int.Parse(id));
            if (listWZD.Count == 0)
            {
                WorkZoneDetail WZD = new WorkZoneDetail();
                WZD.WorkZoneId = -1;
                WZD.WorkZoneDetailId = -1;
                listWZD.Add(WZD);
                grdWorkZoneDetail.DataSource = listWZD;
                grdWorkZoneDetail.DataBind();
                if (grdWorkZoneDetail.Rows[0].Cells[17].Text == "-1")
                {
                    grdWorkZoneDetail.Rows[0].Visible = false;
                    return;
                }
            }
            grdWorkZoneDetail.DataSource = listWZD;
            grdWorkZoneDetail.DataBind();
            //grdWorkZoneDetail.Columns[16].Visible = grdWorkZoneDetail.Columns[17].Visible = false;
        }
Exemplo n.º 11
0
        protected void btnSaveWZD_Click(object sender, EventArgs e)
        {
            try
            {
                WorkZoneDetail wzd = new WorkZoneDetail();
                wzd = WorkZoneDetail.GetWorkZoneDetail(int.Parse(HiddenWorkZoneId.Value) , int.Parse(HiddenWorkZoneDetailId.Value));
                wzd.Comment = txtCommetWZD.Text;
                wzd.ImageFile = string.Format(Constant.WORKNC_WZ_DETAIL_IMAGE_NAME, wzd.WorkZoneDetailId);
                wzd.Update();
                if (ViewState["imgWZD"] == null)
                    return;

                WorkZone wz = WorkZone.GetWorkZone(int.Parse(HiddenWorkZoneId.Value));

                string path = "~/" + Common.GetFolderWorkZoneDetail(wz.CompanyId , wz.CompanyName , wz.FactoryId  ,wz.FactoryName , wz.WorkZoneId , wz.Name);

                SaveImage("imgWZD", path, wzd.ImageFile);
                ViewState.Remove("imgWZD");
                panelMain.Visible = true;
                panelEidtDetail.Visible = false;

            }
            catch (Exception ex)
            {
                RegisterStartupScript("alert(\"" + GetJSMessage(GetResource("Title_Error"), ex.Message) + "\");");
                logger.Error("Error in Save WorkZoneDetail:", ex);
            }
        }
Exemplo n.º 12
0
        public void UpdateDetailStatus(WorkZoneDetail workZoneDetail)
        {
            logger.DebugFormat("updateDetailStatus Begin, workZoneId= {0}, workZoneDetailId = {1}, updateStatus ={2}, userName = {3}",workZoneDetail.WorkZoneId, workZoneDetail.WorkZoneDetailId, workZoneDetail.Status, workZoneDetail.CreateAccount );
            WorkZoneDetail.UpdateDetailStatus(workZoneDetail.WorkZoneId, workZoneDetail.WorkZoneDetailId, workZoneDetail.Status, workZoneDetail.CreateAccount);

            if (workZoneDetail.Status == 2)
            {
                logger.Debug("Case Finish workZone - remove detail problem");
                try
                {
                    WorkZone wk = WorkZone.GetWorkZone(workZoneDetail.WorkZoneId);

                    string pathFolderProblem = Path.Combine(System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath, Common.GetFolderWorkZoneProblem(wk.CompanyId, wk.CompanyName, wk.FactoryId, wk.FactoryName, wk.WorkZoneId, wk.Name));

                    List<DetailProblem> listProblem = DetailProblem.GetAllDetailProblem(workZoneDetail.WorkZoneId, workZoneDetail.WorkZoneDetailId);
                    foreach(DetailProblem i in listProblem)
                    {
                        i.Delete();

                        string pathFile = Path.Combine(pathFolderProblem, i.ImageFile);
                        if (File.Exists(pathFile))
                            File.Delete(pathFile);

                    }
                }
                catch (Exception ex)
                {
                    logger.Warn("Ignore case delete problem" ,ex);
                }
            }
        }
Exemplo n.º 13
0
        public void UploadFile(DetailProblem problem)
        {
            logger.DebugFormat("Begin UploadFile , WorkZoneId = {0},  workZOneDetailId id = {1}", problem.WorkZoneId, problem.WorkZoneDetailId);
            WorkZone wk = WorkZone.GetWorkZone(problem.WorkZoneId);
            string   pathFolderProblem = Path.Combine(System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath, Common.GetFolderWorkZoneProblem(wk.CompanyId, wk.CompanyName, wk.FactoryId, wk.FactoryName, wk.WorkZoneId, wk.Name));

            logger.Debug("PhysicalPath pathFolder =" + pathFolderProblem);

            string uploadFilePath = "";

            try
            {
                using (DBContext db = new DBContext())
                {
                    using (System.Data.Common.DbTransaction tran = db.UseTransaction())
                    {
                        try
                        {
                            if (problem.FileId == 0) // case insert New
                            {
                                logger.Debug(" Case Insert new problem");

                                WorkZoneDetail d = WorkZoneDetail.GetWorkZoneDetail(problem.WorkZoneId, problem.WorkZoneDetailId);
                                d.Status          = 1; // Has Problem
                                d.ModifiedAccount = problem.CreateAccount;
                                d.Update();


                                problem.FileId = DetailProblem.GetNextFileID(d.WorkZoneId, d.WorkZoneDetailId);
                                if (problem.Base64Data != null)
                                {
                                    problem.ImageFile = string.Format("{0}_{1}.png", d.WorkZoneDetailId, problem.FileId);
                                }
                                problem.ModifiedAccount = problem.CreateAccount;
                                problem.Insert();

                                logger.Debug(" Update problem and WorkZone Detail");

                                if (!Directory.Exists(pathFolderProblem))
                                {
                                    Directory.CreateDirectory(pathFolderProblem);
                                }

                                if (!string.IsNullOrEmpty(problem.Base64Data))
                                {
                                    uploadFilePath = Path.Combine(pathFolderProblem, problem.ImageFile);
                                    logger.Debug("Case Create file problem = " + uploadFilePath);
                                    Byte[] data = Convert.FromBase64String(problem.Base64Data);
                                    File.WriteAllBytes(uploadFilePath, data);
                                    problem.Base64Data = null;
                                }
                            }
                            else if (problem.FileId != 0) // Update or Delete
                            {
                                DetailProblem p = DetailProblem.GetDetailProblem(problem.WorkZoneId, problem.WorkZoneDetailId, problem.FileId);
                                if (string.IsNullOrEmpty(problem.ImageFile))
                                {
                                    //delete
                                    logger.Debug("Case Delete detail Problem");
                                    p.Delete();

                                    uploadFilePath = Path.Combine(pathFolderProblem, p.ImageFile);
                                    logger.Debug("Case Delete file uploadFilePath = " + uploadFilePath);
                                    if (File.Exists(uploadFilePath))
                                    {
                                        File.Delete(uploadFilePath);
                                    }
                                }
                                else
                                {
                                    logger.Debug("Case update detail Problem");
                                    p.Comment         = problem.Comment;
                                    p.ModifiedAccount = problem.CreateAccount;
                                    p.Update();
                                }
                            }
                            tran.Commit();
                        }
                        catch (Exception ex)
                        {
                            tran.Rollback();
                            logger.Error("Error UploadFile", ex);
                            throw ex;
                        }
                    }
                }
                logger.Debug("End UploadFile");
            }
            catch (Exception ex)
            {
                logger.Error("Error UploadFile ", ex);
                throw ex;
            }
        }