Exemplo n.º 1
0
        public bool UpdateTpLcdStation(tblTpLcdMaster tblTpLcdMaster)
        {
            try
            {
                var masterData = _entity.tblTpLcdMaster.FirstOrDefault(x => x.Code == tblTpLcdMaster.Code);


                if (masterData != null)
                {
                    if (!string.IsNullOrEmpty(tblTpLcdMaster.Code))
                    {
                        masterData.Passed = tblTpLcdMaster.Passed;
                    }
                    if (tblTpLcdMaster.UpdatedBy != null)
                    {
                        masterData.UpdatedBy = tblTpLcdMaster.UpdatedBy;
                    }
                    if (tblTpLcdMaster.UpdatedDate != null)
                    {
                        masterData.UpdatedDate = tblTpLcdMaster.UpdatedDate;
                    }



                    _entity.Entry(masterData).State = EntityState.Modified;
                    _entity.SaveChanges();
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(true);
        }
 public tblTpLcdMaster GetTpLcdStationInfo(tblTpLcdMaster tblTpLcdMaster)
 {
     try
     {
         return(_iLcdGlueStation.GetTpLcdStationInfo(tblTpLcdMaster));
     }
     catch (Exception ex) { throw ex; }
 }
Exemplo n.º 3
0
 public Result InsertTpLcdStation(tblTpLcdMaster tblTpLcdMaster)
 {
     try
     {
         return(_lcdGlueStationManager.InsertTpLcdStation(tblTpLcdMaster));
     }
     catch (Exception ex)
     {
         return(new Result {
             IsSuccess = false, Message = ex.Message
         });
     }
 }
Exemplo n.º 4
0
 public bool InsertTpLcdStation(tblTpLcdMaster tblTpLcdMaster)
 {
     try
     {
         _entity.tblTpLcdMaster.Add(tblTpLcdMaster);
         _entity.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return(true);
 }
Exemplo n.º 5
0
        public tblTpLcdMaster GetTpLcdStationInfo(tblTpLcdMaster tblTpLcdMaster)
        {
            var tplcd = new tblTpLcdMaster();

            try
            {
                tplcd = _lcdGlueStationManager.GetTpLcdStationInfo(tblTpLcdMaster);
            }
            catch (Exception ex)
            {
            }

            return(tplcd);
        }
Exemplo n.º 6
0
        public tblTpLcdMaster GetTpLcdStationInfo(tblTpLcdMaster tblTpLcdMaster)
        {
            tblTpLcdMaster master;

            try
            {
                master =
                    _entity.tblTpLcdMaster.WhereIf(tblTpLcdMaster.Code != null,
                                                   x => x.Code == tblTpLcdMaster.Code)
                    .WhereIf(tblTpLcdMaster.Passed != null, x => x.Passed == tblTpLcdMaster.Passed)
                    .WhereIf(tblTpLcdMaster.AddedBy != null, x => x.AddedBy == tblTpLcdMaster.AddedBy)
                    .FirstOrDefault();
            }

            catch (Exception ex)
            {
                throw ex;
            }

            return(master);
        }
        public Result InsertTpLcdStation(tblTpLcdMaster tblTpLcdMaster)
        {
            try
            {
                using (
                    var transaction = new TransactionScope(TransactionScopeOption.Required,
                                                           ApplicationState.TransactionOptions))
                {
                    var result = new Result {
                        IsSuccess = _iLcdGlueStation.InsertTpLcdStation(tblTpLcdMaster)
                    };

                    if (result.IsSuccess)
                    {
                        transaction.Complete();
                    }
                    return(result);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public JsonResult InsertTpLcdStation(tblTpLcdMaster tpLcdData, List <tblLcdGlueRework> reworkList)
        {
            var userId    = (long)_dictionary[2].Id;
            var projectId = (long)_dictionary[3].Id;
            var result    = new Result();


            try
            {
                var isExists = _lcdGlueStationService.GetTpLcdStationInfo(new tblTpLcdMaster {
                    Code = tpLcdData.Code
                });
                var workingProject =
                    _lcdGlueStationService.LoadWorkingModelData()
                    .FirstOrDefault(a => a.AddedBy == userId && a.CurentlyRunning == "Y");


                if (isExists == null)
                {
                    if (workingProject != null)
                    {
                        var tblTpLcdMaster = new tblTpLcdMaster();
                        tblTpLcdMaster.Code        = tpLcdData.Code;
                        tblTpLcdMaster.ProjectId   = workingProject.ProjectId;
                        tblTpLcdMaster.ProjectName = workingProject.ProjectName;
                        tblTpLcdMaster.Passed      = tpLcdData.Passed.ToUpper();
                        tblTpLcdMaster.AddedBy     = userId;
                        tblTpLcdMaster.AddedDate   = DateTime.Now;

                        result = _lcdGlueStationService.InsertTpLcdStation(tblTpLcdMaster);
                        if (result.IsSuccess == true && tpLcdData.Passed.ToUpper() == "N")
                        {
                            var Reresult = new Result();
                            var rework   = new tblLcdGlueRework();

                            foreach (tblLcdGlueRework item in reworkList)
                            {
                                //rework.LineId = lineId;
                                rework.ProjectId   = workingProject.ProjectId;
                                rework.ProjectName = workingProject.ProjectName;
                                rework.Code        = tpLcdData.Code;
                                rework.Issue       = item.Issue;
                                rework.FailedFrom  = "TPLCD";
                                rework.Status      = "P";
                                rework.AddedBy     = userId;
                                rework.AddedDate   = DateTime.Now;

                                Reresult = _lcdGlueStationService.InsertTpLcdReworkStation(rework);
                            }
                        }
                    }

                    else
                    {
                        result.Message = "No Project Or Model Found";
                    }
                }

                else
                {
                    if (workingProject != null)
                    {
                        var tblTpLcdMaster = new tblTpLcdMaster();
                        tblTpLcdMaster.Code = tpLcdData.Code;
                        //tblTpLcdMaster.ProjectId = workingProject.ProjectId;
                        //tblTpLcdMaster.ProjectName = workingProject.ProjectName;
                        tblTpLcdMaster.Passed      = tpLcdData.Passed.ToUpper();
                        tblTpLcdMaster.UpdatedBy   = userId;
                        tblTpLcdMaster.UpdatedDate = DateTime.Now;

                        result = _lcdGlueStationService.UpdateTpLcdStation(tblTpLcdMaster);
                        if (result.IsSuccess == true && tpLcdData.Passed.ToUpper() == "N")
                        {
                            var Reresult = new Result();
                            var rework   = new tblLcdGlueRework();

                            foreach (tblLcdGlueRework item in reworkList)
                            {
                                //rework.LineId = lineId;
                                rework.ProjectId   = isExists.ProjectId;
                                rework.ProjectName = workingProject.ProjectName;
                                rework.Code        = tpLcdData.Code;
                                rework.Issue       = item.Issue;
                                rework.FailedFrom  = "TPLCD";
                                rework.Status      = "P";
                                rework.AddedBy     = userId;
                                rework.AddedDate   = DateTime.Now;

                                Reresult = _lcdGlueStationService.InsertTpLcdReworkStation(rework);
                            }
                        }
                    }


                    else
                    {
                        result.Message = "No Project Or Model Found";
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(Json(result));
        }