public HttpResponseMessage SaveRowMaterial(object[] data) { string result = ""; try { CmnItemMaster itemMaster = JsonConvert.DeserializeObject <CmnItemMaster>(data[0].ToString()); int accDetailID = Convert.ToInt16(data[1]); int ACTypeID = Convert.ToInt16(data[2]); if (ModelState.IsValid && itemMaster != null && accDetailID != null) { result = objCmnRawMaterial.SaveRowMaterial(itemMaster, accDetailID, ACTypeID); } else { result = ""; } } catch (Exception e) { e.ToString(); result = ""; } return(Request.CreateResponse(HttpStatusCode.OK, result)); }
private void UpdateFinishingProcess(List <vmFinishProcess> _finishing, CmnItemMaster _itemMaster) { if (_finishing.Count > 0) { Int64 FInishTypeID; GenericFactory_EF_FinishingType = new PrdFinishingType_EF(); List <PrdFinishingType> matchFinishingTypes = null; try { foreach (vmFinishProcess aitem in _finishing) { PrdFinishingType _finishingType = GenericFactory_EF_FinishingType.FindBy(x => x.IsDeleted == false && x.ItemID == _itemMaster.ItemID && x.FinishingProcessID == aitem.id).FirstOrDefault(); if (_finishingType != null) { matchFinishingTypes.Add(_finishingType); } else { SaveFinishingProcess(_finishing, _itemMaster); } } List <vmFinishProcess> _unMatchFinshingTypes = GetUnMatchFinishingType(matchFinishingTypes, _itemMaster); int result = DeleteFinishingType(_unMatchFinshingTypes, _itemMaster); } catch { } } }
/// No CompanyID Provided public string SaveYarn(CmnItemMaster model) { GenericFactory_EF_Yarn = new CmnItemMaster_EF(); string result = ""; try { SaveItemCount(model); GenericFactory_EF_CmnItemMaster = new CmnItemMaster_EF(); //Int64 NextId = GenericFactory_EF_RawMaterial.getMaxVal_int64("ItemID", "CmnItemMaster"); Int64 NextId = Convert.ToInt64(GenericFactory_EF_CmnItemMaster.getMaxID("CmnItemMaster")); model.ItemID = NextId; model.ArticleNo = model.ItemName; string UniqueCode = model.ItemTypeID.ToString() + model.ItemGroupID.ToString() + model.ItemID.ToString(); model.UniqueCode = UniqueCode; model.CreateOn = DateTime.Today; model.CreatePc = HostService.GetIP(); model.IsDeleted = false; GenericFactory_EF_Yarn.Insert(model); GenericFactory_EF_Yarn.Save(); GenericFactory_EF_CmnItemMaster.updateMaxID("CmnItemMaster", NextId); result = model.ArticleNo + "," + UniqueCode; } catch (Exception ex) { ex.ToString(); } return(result); }
private void SaveFinishingProcess(List <vmFinishProcess> _finishing, CmnItemMaster _itemMaster) { Int64 FInishTypeID; GenericFactory_EF_FinishingType = new PrdFinishingType_EF(); try { FInishTypeID = Convert.ToInt64(GenericFactory_EF_FinishingType.getMaxID("PrdFinishingType")); foreach (vmFinishProcess aitem in _finishing) { PrdFinishingType _prdFinishingType = new PrdFinishingType(); _prdFinishingType.FInishTypeID = FInishTypeID; _prdFinishingType.ItemID = _itemMaster.ItemID; _prdFinishingType.FinishingProcessID = aitem.id; _prdFinishingType.IsActive = false; _prdFinishingType.CompanyID = _itemMaster.CompanyID; _prdFinishingType.IsDeleted = false; _prdFinishingType.CreateBy = Convert.ToInt16(_itemMaster.CreateBy); _prdFinishingType.CreateOn = DateTime.Today; _prdFinishingType.CreatePc = HostService.GetIP(); GenericFactory_EF_FinishingType.Insert(_prdFinishingType); GenericFactory_EF_FinishingType.Save(); FInishTypeID++; } GenericFactory_EF_FinishingType.updateMaxID("PrdFinishingType", FInishTypeID); } catch (Exception ex) { var message = ex.Message.ToString(); } }
public int DeleteRawMaterial(CmnItemMaster model) { GenericFactory_EF_RawMaterial = new CmnItemMaster_EF(); int result = 0; try { CmnItemMaster _model = GenericFactory_EF_RawMaterial.GetAll().Where(x => x.ItemID == model.ItemID).FirstOrDefault(); _model.DeleteOn = DateTime.Today; _model.DeleteBy = model.DeleteBy; _model.DeletePc = HostService.GetIP(); _model.IsDeleted = true; GenericFactory_EF_RawMaterial.Update(_model); GenericFactory_EF_RawMaterial.Save(); result = 1; // For delete into CmnAccIntegration CmnACCIntegration _modelACCIn = GenericFactory_CmnACCIntegration.GetAll().Where(x => x.TransactionID == model.ItemID).FirstOrDefault(); _modelACCIn.DeleteOn = DateTime.Today; _modelACCIn.DeleteBy = model.DeleteBy; _modelACCIn.DeletePc = HostService.GetIP(); _modelACCIn.IsDeleted = true; GenericFactory_CmnACCIntegration.Update(_modelACCIn); GenericFactory_CmnACCIntegration.Save(); } catch (Exception e) { e.ToString(); result = 0; } return(result); }
private void SaveItemCount(CmnItemMaster model) { try { GenericFactory_EF_ItemCount = new CmnItemCount_EF(); _ctxCmn = new ERP_Entities(); int isExist = GenericFactory_EF_ItemCount.GetAll().Where(x => x.Count == model.Count).Count(); if (isExist == 0) { CmnItemCount _CmnItemCount = new CmnItemCount(); int NextId = GenericFactory_EF_Yarn.getMaxVal_int("CountID", "CmnItemCount"); _CmnItemCount.CountID = NextId; _CmnItemCount.Count = model.Count ?? 0; _CmnItemCount.Description = model.Count.ToString(); _CmnItemCount.CompanyID = model.CompanyID; _CmnItemCount.CreateBy = model.CreateBy; _CmnItemCount.CreateOn = DateTime.Now; _CmnItemCount.CreatePc = HostService.GetIP(); GenericFactory_EF_ItemCount.Insert(_CmnItemCount); GenericFactory_EF_ItemCount.Save(); } } catch { } }
public string SaveFinishGood(CmnItemMaster _itemMaster, List <vmFinishProcess> _finishing) { try { GenericFactory_EF_CmnItemMaster = new CmnItemMaster_EF(); //Int64 NextId = GenericFactory_EF_CmnItemMaster.getMaxVal_int64("ItemID", "CmnItemMaster"); Int64 NextId = Convert.ToInt64(GenericFactory_EF_CmnItemMaster.getMaxID("CmnItemMaster")); // NextId++; string ItemGroupName = GetItemGroupName(_itemMaster.ItemGroupID); // int maxGroup = GetMaxByGroupWise(_itemMaster.ItemGroupID, _itemMaster.CompanyID); _itemMaster.ArticleNo = _itemMaster.ArticleNo; //ItemGroupName + maxGroup + FinishingProcess; _itemMaster.ItemID = NextId; _itemMaster.CompanyID = Convert.ToInt16(_itemMaster.CompanyID); _itemMaster.IsDeleted = false; if (_itemMaster.IsDevelopmentComplete > 0) { _itemMaster.IsDevelopmentComplete = 1; } _itemMaster.CreateBy = Convert.ToInt16(_itemMaster.CreateBy); _itemMaster.CreateOn = DateTime.Today; _itemMaster.CreatePc = HostService.GetIP(); GenericFactory_EF_CmnItemMaster.Insert(_itemMaster); GenericFactory_EF_CmnItemMaster.Save(); GenericFactory_EF_CmnItemMaster.updateMaxID("CmnItemMaster", NextId); if (_finishing.Count > 0) { SaveFinishingProcess(_finishing, _itemMaster); } //Account Intigration if (_itemMaster.AcDetailID != 0) { GenericFactoryEF_CmnACCIntegration = new CmnACCIntegration_EF(); Int64 AccMasterID = Convert.ToInt64(GenericFactoryEF_CmnACCIntegration.getMaxID("CmnACCIntegration")); CmnACCIntegration _acc = new CmnACCIntegration(); _acc.ACID = AccMasterID; _acc.TransactionID = NextId; _acc.AcDetailID = _itemMaster.AcDetailID; _acc.IsActive = true; _acc.IsDeleted = false; _acc.ACTypeID = 1; _acc.CreateBy = Convert.ToInt16(_itemMaster.CreateBy); _acc.CreateOn = DateTime.Today; _acc.CreatePc = HostService.GetIP(); _acc.CompanyID = Convert.ToInt16(_itemMaster.CompanyID); GenericFactoryEF_CmnACCIntegration.Insert(_acc); GenericFactoryEF_CmnACCIntegration.Save(); GenericFactoryEF_CmnACCIntegration.updateMaxID("CmnACCIntegration", AccMasterID); } //Account Intigration } catch (Exception ex) { ex.ToString(); } return(_itemMaster.ArticleNo); }
/// No CompanyID Provided public string SaveRowMaterial(CmnItemMaster model, int accDetailID, int ACTypeID) { GenericFactory_EF_RawMaterial = new CmnItemMaster_EF(); GenericFactory_CmnACCIntegration = new CmnACCIntegration_EF(); string result = ""; try { GenericFactory_EF_CmnItemMaster = new CmnItemMaster_EF(); //Int64 NextId = GenericFactory_EF_RawMaterial.getMaxVal_int64("ItemID", "CmnItemMaster"); Int64 NextId = Convert.ToInt64(GenericFactory_EF_CmnItemMaster.getMaxID("CmnItemMaster")); model.ItemID = NextId; string ArticleNo = SetArticaleNo(model.ItemGroupID); model.ArticleNo = ArticleNo; string UniqueCode = model.ItemTypeID.ToString() + model.ItemGroupID.ToString() + model.ItemID.ToString(); model.UniqueCode = UniqueCode; model.CreateOn = DateTime.Today; model.CreatePc = HostService.GetIP(); model.IsDeleted = false; GenericFactory_EF_RawMaterial.Insert(model); GenericFactory_EF_RawMaterial.Save(); GenericFactory_EF_CmnItemMaster.updateMaxID("CmnItemMaster", NextId); result = ArticleNo + "," + UniqueCode; //For insert into CmnAccIntegration CmnACCIntegration modelAccIn = new CmnACCIntegration(); //Int64 NextIdAccIn = GenericFactory_CmnACCIntegration.getMaxVal_int64("ACID", "CmnACCIntegration"); GenericFactoryEF_CmnACCIntegration = new CmnACCIntegration_EF(); Int64 NextIdAccIn = Convert.ToInt64(GenericFactoryEF_CmnACCIntegration.getMaxID("CmnACCIntegration")); modelAccIn.ACID = NextIdAccIn; modelAccIn.AcDetailID = accDetailID; modelAccIn.ACTypeID = ACTypeID; modelAccIn.CompanyID = model.CompanyID; modelAccIn.CreateBy = model.CreateBy; modelAccIn.CreateOn = DateTime.Today; modelAccIn.CreatePc = HostService.GetIP(); modelAccIn.IsDeleted = false; modelAccIn.IsActive = true; modelAccIn.TransactionID = model.ItemID; GenericFactory_CmnACCIntegration.Insert(modelAccIn); GenericFactory_CmnACCIntegration.Save(); GenericFactoryEF_CmnACCIntegration.updateMaxID("CmnACCIntegration", NextIdAccIn); } catch (Exception ex) { ex.ToString(); } return(result); }
/// No CompanyID Provided public int UpdateRawMaterial(CmnItemMaster model) { GenericFactory_EF_RawMaterial = new CmnItemMaster_EF(); int result = 0; try { CmnItemMaster _model = GenericFactory_EF_RawMaterial.GetAll().Where(x => x.ItemID == model.ItemID).FirstOrDefault(); //string ArticleNo = SetArticaleNo(model.ItemGroupID); // _model.ArticleNo = ArticleNo; _model.UpdateOn = DateTime.Today; _model.UpdateBy = model.UpdateBy; _model.UpdatePc = HostService.GetIP(); // _model.ItemTypeID = model.ItemTypeID; // _model.ItemGroupID = model.ItemGroupID; _model.ItemName = model.ItemName; _model.UOMID = model.UOMID; _model.ItemColorID = model.ItemColorID; _model.ItemSizeID = model.ItemSizeID; _model.ItemBrandID = model.ItemBrandID; _model.ItemModelID = model.ItemModelID; _model.Description = model.Description; _model.Note = model.Note; GenericFactory_EF_RawMaterial.Update(_model); GenericFactory_EF_RawMaterial.Save(); result = 1; // For update into CmnAccIntegration CmnACCIntegration _modelACCIn = GenericFactory_CmnACCIntegration.GetAll().Where(x => x.TransactionID == model.ItemID).FirstOrDefault(); _modelACCIn.UpdateOn = DateTime.Today; _modelACCIn.UpdateBy = model.UpdateBy; _modelACCIn.UpdatePc = HostService.GetIP(); GenericFactory_CmnACCIntegration.Update(_modelACCIn); GenericFactory_CmnACCIntegration.Save(); result = 1; } catch (Exception e) { e.ToString(); result = 0; } return(result); }
public HttpResponseMessage UpdateRawMaterial(CmnItemMaster model) { int result = 0; try { result = objCmnRawMaterial.UpdateRawMaterial(model); } catch (Exception e) { e.ToString(); result = -0; } return(Request.CreateResponse(HttpStatusCode.OK, result)); }
public HttpResponseMessage DeleteFinishGood(CmnItemMaster _itemMaster) { int result = 0; try { result = _objFinishGood.DeleteFinishGood(_itemMaster); } catch (Exception e) { e.ToString(); result = -0; } return(Request.CreateResponse(HttpStatusCode.OK, result)); }
public HttpResponseMessage CheckItemCode(CmnItemMaster _obj) { objCmnItemGroupMgtEF = new SystemCommonDDL(); objYarnMgt = new CmnYarnMgt(); bool status = false; try { status = objYarnMgt.CheckItemCode(_obj.ItemName); } catch (Exception) { throw; } return(Request.CreateResponse(HttpStatusCode.OK, status)); }
public HttpResponseMessage SaveFinishGood(object[] data) { CmnItemMaster _itemMaster = JsonConvert.DeserializeObject <CmnItemMaster>(data[0].ToString()); List <vmFinishProcess> _finishing = JsonConvert.DeserializeObject <List <vmFinishProcess> >(data[1].ToString()); string result = ""; try { result = _objFinishGood.SaveFinishGood(_itemMaster, _finishing); } catch (Exception) { throw; } return(Request.CreateResponse(HttpStatusCode.OK, result)); }
public HttpResponseMessage UpdateYarn(CmnItemMaster model) { objCmnItemGroupMgtEF = new SystemCommonDDL(); objYarnMgt = new CmnYarnMgt(); int result = 0; try { result = objYarnMgt.UpdateYarn(model); } catch (Exception e) { e.ToString(); result = -0; } return(Request.CreateResponse(HttpStatusCode.OK, result)); }
public int DeleteFinishGood(CmnItemMaster _itemMaster) { GenericFactory_EF_CmnItemMaster = new CmnItemMaster_EF(); int result = 0; try { CmnItemMaster _ItemMasterobj = GenericFactory_EF_CmnItemMaster.GetAll().Where(x => x.IsDeleted == false && x.ItemID == _itemMaster.ItemID).FirstOrDefault(); _ItemMasterobj.DeleteOn = DateTime.Today; _ItemMasterobj.DeleteBy = _itemMaster.DeleteBy; _itemMaster.DeletePc = HostService.GetIP(); _ItemMasterobj.IsDeleted = true; GenericFactory_EF_CmnItemMaster.Update(_ItemMasterobj); GenericFactory_EF_CmnItemMaster.Save(); result = 1; } catch (Exception) { result = 0; } return(result); }
/// No CompanyID Provided public int UpdateYarn(CmnItemMaster model) { GenericFactory_EF_Yarn = new CmnItemMaster_EF(); int result = 0; try { SaveItemCount(model); CmnItemMaster _model = GenericFactory_EF_Yarn.GetAll().Where(x => x.ItemID == model.ItemID).FirstOrDefault(); _model.UpdateOn = DateTime.Today; _model.UpdateBy = model.UpdateBy; _model.UpdatePc = HostService.GetIP(); _model.ItemTypeID = model.ItemTypeID; _model.ItemGroupID = model.ItemGroupID; _model.ItemName = model.ItemName; _model.UOMID = model.UOMID; _model.ItemColorID = model.ItemColorID; _model.ItemSizeID = model.ItemSizeID; _model.ItemBrandID = model.ItemBrandID; _model.ItemModelID = model.ItemModelID; _model.Description = model.Description; _model.Note = model.Note; _model.Count = model.Count; GenericFactory_EF_Yarn.Update(_model); GenericFactory_EF_Yarn.Save(); result = 1; } catch (Exception e) { e.ToString(); result = 0; } return(result); }
public int DeleteYarn(CmnItemMaster model) { GenericFactory_EF_Yarn = new CmnItemMaster_EF(); int result = 0; try { CmnItemMaster _model = GenericFactory_EF_Yarn.GetAll().Where(x => x.ItemID == model.ItemID).FirstOrDefault(); _model.DeleteOn = DateTime.Today; _model.DeleteBy = model.DeleteBy; _model.DeletePc = HostService.GetIP(); _model.IsDeleted = true; GenericFactory_EF_Yarn.Update(_model); GenericFactory_EF_Yarn.Save(); result = 1; } catch (Exception e) { e.ToString(); result = 0; } return(result); }
public int UpdateFinishGood(CmnItemMaster _itemMaster, List <vmFinishProcess> _finishing) { GenericFactory_EF_CmnItemMaster = new CmnItemMaster_EF(); int result = 0; try { CmnItemMaster _ItemMasterobj = GenericFactory_EF_CmnItemMaster.FindBy(x => x.IsDeleted == false && x.ItemID == _itemMaster.ItemID).FirstOrDefault(); _ItemMasterobj.UpdateOn = DateTime.Today; _ItemMasterobj.IsDevelopmentComplete = _itemMaster.IsDevelopmentComplete; _ItemMasterobj.UpdateBy = _itemMaster.CreateBy; _ItemMasterobj.UpdatePc = HostService.GetIP(); _ItemMasterobj.ArticleNo = _itemMaster.ArticleNo; _ItemMasterobj.FinishingWeight = _itemMaster.FinishingWeight; _ItemMasterobj.ItemTypeID = _itemMaster.ItemTypeID; _ItemMasterobj.WeightPerUnit = _itemMaster.WeightPerUnit; _ItemMasterobj.FinishingWeightID = _itemMaster.FinishingWeightID; _ItemMasterobj.ItemGroupID = _itemMaster.ItemGroupID; _ItemMasterobj.ItemName = _itemMaster.ItemName; _ItemMasterobj.WarpYarnID = _itemMaster.WarpYarnID; _ItemMasterobj.BuyerID = _itemMaster.BuyerID; _ItemMasterobj.WeftYarnID = _itemMaster.WeftYarnID; _ItemMasterobj.WeftSupplierID = _itemMaster.WeftSupplierID; _ItemMasterobj.PPI = _itemMaster.PPI; _ItemMasterobj.ItemColorID = _itemMaster.ItemColorID; _ItemMasterobj.EPI = _itemMaster.EPI; _ItemMasterobj.GPPI = _itemMaster.GPPI; _ItemMasterobj.SetNo = _itemMaster.SetNo; _ItemMasterobj.FlangeNo = _itemMaster.FlangeNo; _ItemMasterobj.Weave = _itemMaster.Weave; _ItemMasterobj.CoatingID = _itemMaster.CoatingID; _ItemMasterobj.SPCoatingID = _itemMaster.SPCoatingID; _ItemMasterobj.OverDyedID = _itemMaster.OverDyedID; _ItemMasterobj.WeftColorID = _itemMaster.WeftColorID; //_ItemMasterobj.FinishingTypeID = _itemMaster.FinishingTypeID; _ItemMasterobj.Length = _itemMaster.Length; _ItemMasterobj.Note = _itemMaster.Note; _ItemMasterobj.TotalEnds = _itemMaster.TotalEnds; _ItemMasterobj.Description = _itemMaster.Description; _ItemMasterobj.BuyerRefID = _itemMaster.BuyerRefID; _ItemMasterobj.CuttableWidth = _itemMaster.CuttableWidth; _ItemMasterobj.HSCODE = _itemMaster.HSCODE; //----------Weaving Info------------------------------- _ItemMasterobj.WeavingMachineID = _itemMaster.WeavingMachineID; _ItemMasterobj.WeavingDate = _itemMaster.WeavingDate; _ItemMasterobj.GWidth = _itemMaster.GWidth; _ItemMasterobj.WeavingLength = _itemMaster.WeavingLength; _ItemMasterobj.GGSM = _itemMaster.GGSM; //--------Finishing Info---------------------------------- _ItemMasterobj.MinLShrinkage = _itemMaster.MinLShrinkage; _ItemMasterobj.MaxLshrinkage = _itemMaster.MaxLshrinkage; _ItemMasterobj.MinWshrinkage = _itemMaster.MinWshrinkage; _ItemMasterobj.MaxWShrinkage = _itemMaster.MaxWShrinkage; _ItemMasterobj.Skew = _itemMaster.Skew; _ItemMasterobj.EPI = _itemMaster.EPI; _ItemMasterobj.PPI = _itemMaster.PPI; _ItemMasterobj.Cotton = _itemMaster.Cotton; _ItemMasterobj.Spandex = _itemMaster.Spandex; _ItemMasterobj.Polyester = _itemMaster.Polyester; _ItemMasterobj.Lycra = _itemMaster.Lycra; _ItemMasterobj.FinishingWidth = _itemMaster.FinishingWidth; _ItemMasterobj.T4100 = _itemMaster.T4100; _ItemMasterobj.Viscos = _itemMaster.Viscos; _ItemMasterobj.Modal = _itemMaster.Modal; _ItemMasterobj.C4100 = _itemMaster.C4100; _ItemMasterobj.Tencel = _itemMaster.Tencel; _ItemMasterobj.OtherComp = _itemMaster.OtherComp; //-----------------------washing Info-------------------------- _ItemMasterobj.MinLShrinkageW = _itemMaster.MinLShrinkageW; _ItemMasterobj.MaxLshrinkageW = _itemMaster.MaxLshrinkageW; _ItemMasterobj.MaxWShrinkageW = _itemMaster.MaxWShrinkageW; _ItemMasterobj.MinWshrinkageW = _itemMaster.MinWshrinkageW; _ItemMasterobj.SkewW = _itemMaster.SkewW; _ItemMasterobj.WEPI = _itemMaster.WEPI; _ItemMasterobj.WPPI = _itemMaster.WPPI; _ItemMasterobj.WashingWidth = _itemMaster.WashingWidth; _ItemMasterobj.WashingWeigth = _itemMaster.WashingWeigth; GenericFactory_EF_CmnItemMaster.Update(_ItemMasterobj); GenericFactory_EF_CmnItemMaster.Save(); if (_finishing.Count > 0) { UpdateFinishingProcess(_finishing, _itemMaster); } //Account Intigration GenericFactoryEF_CmnACCIntegration = new CmnACCIntegration_EF(); if (_itemMaster.AcDetailID == 0) { CmnACCIntegration _acc = GenericFactoryEF_CmnACCIntegration.FindBy(x => x.TransactionID == _itemMaster.ItemID && x.IsDeleted == false).FirstOrDefault(); _acc.DeleteBy = Convert.ToInt16(_itemMaster.CreateBy); _acc.DeleteOn = DateTime.Today; _acc.DeletePc = HostService.GetIP(); _acc.IsDeleted = true; GenericFactoryEF_CmnACCIntegration.Update(_acc); GenericFactoryEF_CmnACCIntegration.Save(); } if (_itemMaster.AcDetailID != 0) { Int64 AccMasterID = Convert.ToInt64(GenericFactoryEF_CmnACCIntegration.getMaxID("CmnACCIntegration")); CmnACCIntegration _acc = GenericFactoryEF_CmnACCIntegration.FindBy(x => x.TransactionID == _itemMaster.ItemID && x.IsDeleted == false).FirstOrDefault(); _acc.AcDetailID = _itemMaster.AcDetailID; _acc.IsActive = true; _acc.IsDeleted = false; _acc.ACTypeID = 1; _acc.UpdateBy = Convert.ToInt16(_itemMaster.CreateBy); _acc.UpdateOn = DateTime.Today; _acc.UpdatePc = HostService.GetIP(); GenericFactoryEF_CmnACCIntegration.Update(_acc); GenericFactoryEF_CmnACCIntegration.Save(); GenericFactoryEF_CmnACCIntegration.updateMaxID("", AccMasterID); } //Account Intigration result = 1; } catch (Exception ex) { result = 0; } return(result); }
private int DeleteFinishingType(List <vmFinishProcess> _unMatchFinshingTypes, CmnItemMaster _itemMaster) { int result = 0; GenericFactory_EF_FinishingType = new PrdFinishingType_EF(); try { foreach (vmFinishProcess aitem in _unMatchFinshingTypes) { PrdFinishingType _finishingType = _ctxCmn.PrdFinishingTypes.Where(x => x.ItemID == _itemMaster.ItemID && x.FinishingProcessID == aitem.id).FirstOrDefault(); _finishingType.DeleteBy = _itemMaster.CreateBy; _finishingType.DeleteOn = DateTime.Now; _finishingType.UpdatePc = HostService.GetIP(); GenericFactory_EF_FinishingType.Update(_finishingType); GenericFactory_EF_FinishingType.Save(); } result = 1; } catch { result = 0; } return(result); }
private List <vmFinishProcess> GetUnMatchFinishingType(List <PrdFinishingType> matchFinishingTypes, CmnItemMaster _itemMaster) { List <vmFinishProcess> _unMatchFinshingTypes = null; List <PrdFinishingType> finishingTypes = _ctxCmn.PrdFinishingTypes.Where(x => x.ItemID == _itemMaster.ItemID).ToList(); try { foreach (PrdFinishingType aitem in finishingTypes) { PrdFinishingType _prdFinishingType = matchFinishingTypes.Where(x => x.FinishingProcessID == aitem.FinishingProcessID).FirstOrDefault(); if (_prdFinishingType == null) { vmFinishProcess _finishProcess = new vmFinishProcess(); _finishProcess.id = aitem.FinishingProcessID ?? 0; _unMatchFinshingTypes.Add(_finishProcess); } } } catch { } return(_unMatchFinshingTypes); }