public bool UpdateLoginUser(tblLogin login, string newPassword)
        {
            _entity.Configuration.LazyLoadingEnabled = false;
            tblLogin loginList = _entity.tblLogin.FirstOrDefault(x => x.Id == login.Id && x.Password == login.Password);

            //FirstOrDefault(x => x.Id == login.Id && x.Password == login.Password);


            if (loginList != null)
            {
                if (login.Password != "")
                {
                    loginList.Password = newPassword;
                }


                _entity.Entry(loginList).State = EntityState.Modified;
                _entity.SaveChanges();
            }
            else
            {
                return(false);
            }


            return(true);
        }
        public bool UpdateProductionLine(tblProductionLine productionLine)
        {
            _entity.Configuration.LazyLoadingEnabled = false;
            tblProductionLine list = _entity.tblProductionLine.FirstOrDefault(x => x.LineId == productionLine.LineId);


            if (list != null)
            {
                if (productionLine.LineName != "")
                {
                    list.LineName = productionLine.LineName;
                }


                _entity.Entry(list).State = EntityState.Modified;
                _entity.SaveChanges();
            }
            else
            {
                return(false);
            }


            return(true);
        }
        public bool UpdateBatteryLine(tblBatteryComponentInfo productionLine)
        {
            _entity.Configuration.LazyLoadingEnabled = false;
            tblBatteryComponentInfo list = _entity.tblBatteryComponentInfo.FirstOrDefault(x => x.Id == productionLine.Id);

            if (list != null)
            {
                if (productionLine.ProjectName != "")
                {
                    list.ProjectName = productionLine.ProjectName;
                }

                list.PcbPassed = productionLine.PcbPassed;

                list.PcbIssued  = productionLine.PcbIssued;
                list.PcbFailed  = productionLine.PcbFailed;
                list.CellIssued = productionLine.CellIssued;
                list.CellPassed = productionLine.CellPassed;
                list.CellFailed = productionLine.CellFailed;

                _entity.Entry(list).State = EntityState.Modified;
                _entity.SaveChanges();
            }

            else
            {
                return(false);
            }
            return(true);
        }
Esempio n. 4
0
        public bool UpdateGlueWorkingModels(tblLcdGlueWorkingModels workingModel)
        {
            try
            {
                _entity.Configuration.LazyLoadingEnabled = false;
                var startDate = DateTime.Today;
                var endDate   = startDate.AddDays(1).AddTicks(-1);



                //if( workingModel.Id!=null)



                var wModel = _entity.tblLcdGlueWorkingModels.Where(x => x.AddedBy == workingModel.AddedBy && (x.AddedDate >= startDate && x.AddedDate <= endDate)).ToList();

                if (wModel.Count > 0)
                {
                    foreach (var items in wModel)
                    {
                        var workModels = _entity.tblLcdGlueWorkingModels.FirstOrDefault(x => x.AddedBy == items.AddedBy && (x.AddedDate >= startDate && x.AddedDate <= endDate) && x.ProjectName == items.ProjectName && x.ProjectId == items.ProjectId);


                        if (workModels == null)
                        {
                            continue;
                        }
                        workModels.CurentlyRunning = workModels.Id == workingModel.Id ? "Y" : "N";

                        _entity.Entry(workModels).State = EntityState.Modified;
                        _entity.SaveChanges();
                    }
                    return(true);
                }



                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 5
0
        public bool UpdateCkdMmiInfo(tblCkdMmiMaster mmItabltestComponent)
        {
            _entity.Configuration.LazyLoadingEnabled = false;
            var mmiMaster =
                _entity.tblCkdMmiMaster.FirstOrDefault(x => x.BarCode == mmItabltestComponent.BarCode);


            if (mmiMaster != null)
            {
                if (mmItabltestComponent.Passed != null)
                {
                    mmiMaster.Passed = mmItabltestComponent.Passed;
                }
                if (mmItabltestComponent.UpdatedBy != null)
                {
                    mmiMaster.UpdatedBy = mmItabltestComponent.UpdatedBy;
                }
                if (mmItabltestComponent.UpdatedDate != null)
                {
                    mmiMaster.UpdatedDate = mmItabltestComponent.UpdatedDate;
                }



                _entity.Entry(mmiMaster).State = EntityState.Modified;
                _entity.SaveChanges();
            }
            else
            {
                return(false);
            }



            return(true);
        }
        public bool InsertInventoryOutInfo(List <tblInventoryForServiceItem> im)
        {
            try
            {
                foreach (var s in im)
                {
                    var list = new tblInventoryForServiceItem();

                    list =
                        _entities.tblInventoryForServiceItems.FirstOrDefault(
                            x => x.IMEI1 == s.IMEI1 || x.IMEI2 == s.IMEI1);
                    if (list != null)
                    {
                        if (s.IsInventoryOut == null)
                        {
                            list.IsInventoryOut = true;
                        }
                        if (s.IsInventoryOutDate == null)
                        {
                            list.IsInventoryOutDate = DateTime.Now;
                        }
                        _entities.Entry(list).State = EntityState.Modified;
                        _entities.SaveChanges();
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch
            (Exception
             exception)
            {
                throw exception;
            }

            return(true);
        }
Esempio n. 7
0
        public bool UpdateQcStatusHistory(List <ProductionMaster> productionList)
        {
            foreach (var item in productionList)
            {
                _entity.Configuration.LazyLoadingEnabled = false;
                ProductionMaster productionMaster =
                    _entity.ProductionMaster.FirstOrDefault(x => x.MobileCode == item.MobileCode);


                if (productionMaster != null)
                {
                    if (item.Passed != null)
                    {
                        productionMaster.Passed = item.Passed;
                    }
                    if (item.QcStation != null)
                    {
                        productionMaster.QcStation = item.QcStation;
                    }
                    if (!string.IsNullOrEmpty(item.Imei1))
                    {
                        productionMaster.Imei1 = item.Imei1;
                    }
                    if (!string.IsNullOrEmpty(item.Imei2))
                    {
                        productionMaster.Imei2 = item.Imei2;
                    }
                    if (item.AddedBy != null)
                    {
                        productionMaster.AddedBy = item.AddedBy;
                    }
                    if (item.AddedDate != null)
                    {
                        productionMaster.AddedDate = item.AddedDate;
                    }
                    if (item.UpdatedBy != null)
                    {
                        productionMaster.UpdatedBy = item.UpdatedBy;
                    }
                    if (item.UpdatedDate != null)
                    {
                        productionMaster.UpdatedDate = item.UpdatedDate;
                    }
                    if (item.FinallyPassed != null)
                    {
                        productionMaster.FinallyPassed = item.FinallyPassed;
                    }
                    if (item.FinallyPassedBy != null)
                    {
                        productionMaster.FinallyPassedBy = item.FinallyPassedBy;
                    }
                    if (item.FinallyPassedTime != null)
                    {
                        productionMaster.FinallyPassedTime = item.FinallyPassedTime;
                    }

                    if (item.FunctionalBy != null)
                    {
                        productionMaster.FunctionalBy = item.FunctionalBy;
                    }
                    if (item.FunctionalAD != null)
                    {
                        productionMaster.FunctionalAD = item.FunctionalAD;
                    }
                    if (item.AestheticBy != null)
                    {
                        productionMaster.AestheticBy = item.AestheticBy;
                    }
                    if (item.AestheticAD != null)
                    {
                        productionMaster.AestheticAD = item.AestheticAD;
                    }

                    if (item.AgingBy != null)
                    {
                        productionMaster.AgingBy = item.AgingBy;
                    }
                    if (item.AgingAD != null)
                    {
                        productionMaster.AgingAD = item.AgingAD;
                    }

                    if (item.PackagingBy != null)
                    {
                        productionMaster.PackagingBy = item.PackagingBy;
                    }
                    if (item.PackagingAD != null)
                    {
                        productionMaster.PackagingAD = item.PackagingAD;
                    }

                    if (item.PackagingAstheticBy != null)
                    {
                        productionMaster.PackagingAstheticBy = item.PackagingAstheticBy;
                    }
                    if (item.PackagingAstheticAD != null)
                    {
                        productionMaster.PackagingAstheticAD = item.PackagingAstheticAD;
                    }
                    if (item.PackagingOQCBy != null)
                    {
                        productionMaster.PackagingOQCBy = item.PackagingOQCBy;
                    }
                    if (item.PackagingOQCAD != null)
                    {
                        productionMaster.PackagingOQCAD = item.PackagingOQCAD;
                    }
                    if (item.PackagingLineId != null)
                    {
                        productionMaster.PackagingLineId = item.PackagingLineId;
                    }

                    if (item.OQCBatchNumber != null)
                    {
                        productionMaster.OQCBatchNumber = item.OQCBatchNumber;
                    }

                    _entity.Entry(productionMaster).State = EntityState.Modified;
                    _entity.SaveChanges();
                }
                else
                {
                    return(false);
                }
            }

            return(true);
        }