public void SaveUoM(MATERIAL_UOM data, string userid) { try { string newdata = string.Format("{0} - {1}", data.MEINH, data.UMREN); var changes = new CHANGES_HISTORY { FORM_TYPE_ID = Core.Enums.MenuList.MaterialMaster, FORM_ID = data.STICKER_CODE + data.WERKS, FIELD_NAME = "CONVERTION_ADDED", MODIFIED_BY = userid, MODIFIED_DATE = DateTime.Now, OLD_VALUE = string.Empty, NEW_VALUE = newdata }; _repositoryUoM.InsertOrUpdate(data); _changesHistoryBll.AddHistory(changes); //_uow.SaveChanges(); } catch (Exception ex) { throw ex; } }
private void SetChanges(UOM origin, UOM data, string userId) { var changesData = new Dictionary <string, bool>(); changesData.Add("UOM_ID", origin.UOM_ID == data.UOM_ID); changesData.Add("UOM_DESC", origin.UOM_DESC == data.UOM_DESC); changesData.Add("IS_EMS", origin.IS_EMS == data.IS_EMS); //changesData.Add("HEADER_FOOTER_FORM_MAP", origin.HEADER_FOOTER_FORM_MAP.Equals(poa.HEADER_FOOTER_FORM_MAP)); foreach (var listChange in changesData) { if (!listChange.Value) { var changes = new CHANGES_HISTORY { FORM_TYPE_ID = Core.Enums.MenuList.Uom, FORM_ID = data.UOM_ID.ToString(), FIELD_NAME = listChange.Key, MODIFIED_BY = userId, MODIFIED_DATE = DateTime.Now }; switch (listChange.Key) { case "UOM_ID": changes.OLD_VALUE = origin.UOM_ID.ToString(); changes.NEW_VALUE = data.UOM_ID.ToString(); break; case "UOM_DESC": changes.OLD_VALUE = origin.UOM_DESC; changes.NEW_VALUE = data.UOM_DESC; break; case "IS_EMS": changes.OLD_VALUE = origin.IS_EMS.HasValue? origin.IS_EMS.Value? "Yes" : "No" : "No"; changes.NEW_VALUE = data.IS_EMS.HasValue ? data.IS_EMS.Value ? "Yes" : "No" : "No"; break; default: break; } _changeBLL.AddHistory(changes); } } }
private bool SetChange(ProductionDto origin, ProductionDto data, string userId) { bool isModified = false; var changeData = new Dictionary <string, bool>(); changeData.Add("COMPANY_CODE", origin.CompanyCode == data.CompanyCode); changeData.Add("WERKS", origin.PlantWerks == data.PlantWerks); changeData.Add("FA_CODE", origin.FaCode == data.FaCode); changeData.Add("PRODUCTION_DATE", origin.ProductionDate == data.ProductionDate); changeData.Add("BRAND_DESC", origin.BrandDescription == data.BrandDescription); changeData.Add("QTY_PACKED", origin.QtyPacked == Convert.ToDecimal(data.QtyPackedStr)); changeData.Add("QTY", origin.Qty == Convert.ToDecimal(data.QtyStr)); changeData.Add("UOM", origin.Uom == data.Uom); //changeData.Add("PROD_QTY_STICK", origin.ProdQtyStick == Convert.ToDecimal(data.ProdQtyStickStr)); string isFromSapString = string.IsNullOrEmpty(origin.Batch) ? "" : "[FROM SAP]"; foreach (var listChange in changeData) { if (listChange.Value) { continue; } { var changes = new CHANGES_HISTORY { FORM_TYPE_ID = Core.Enums.MenuList.CK4C, FORM_ID = "Daily_" + data.CompanyCode + "_" + data.PlantWerks + "_" + data.FaCode + "_" + data.ProductionDate.ToString("ddMMMyyyy"), FIELD_NAME = listChange.Key, MODIFIED_BY = userId, MODIFIED_DATE = DateTime.Now }; switch (listChange.Key) { case "COMPANY_CODE": changes.OLD_VALUE = origin.CompanyCode; changes.NEW_VALUE = data.CompanyCode; changes.FIELD_NAME = "Company" + isFromSapString; break; case "WERKS": changes.OLD_VALUE = origin.PlantWerks; changes.NEW_VALUE = data.PlantWerks; changes.FIELD_NAME = "Plant"; break; case "FA_CODE": changes.OLD_VALUE = origin.FaCode; changes.NEW_VALUE = data.FaCode; changes.FIELD_NAME = "Finish Goods"; break; case "PRODUCTION_DATE": changes.OLD_VALUE = origin.ProductionDate.ToString(); changes.NEW_VALUE = data.ProductionDate.ToString(); changes.FIELD_NAME = "Daily Production Date"; break; case "BRAND_DESC": changes.OLD_VALUE = origin.BrandDescription; changes.NEW_VALUE = data.BrandDescription; changes.FIELD_NAME = "Brand Description"; break; case "QTY_PACKED": changes.OLD_VALUE = origin.QtyPacked.ToString(); changes.NEW_VALUE = data.QtyPackedStr; changes.FIELD_NAME = "Qty Packed" + isFromSapString; break; case "QTY": changes.OLD_VALUE = origin.Qty.ToString(); changes.NEW_VALUE = data.QtyStr; changes.FIELD_NAME = "Produced Qty" + isFromSapString; break; case "UOM": changes.OLD_VALUE = origin.Uom; changes.NEW_VALUE = data.Uom; changes.FIELD_NAME = "Uom"; break; //case "PROD_QTY_STICK": // changes.OLD_VALUE = origin.ProdQtyStick.ToString(); // changes.NEW_VALUE = data.ProdQtyStickStr; // changes.FIELD_NAME = " Produced Qty Stick"; // break; default: break; } _changesHistoryBll.AddHistory(changes); isModified = true; } } return(isModified); }
private bool SetChange(WasteDto origin, WasteDto data, string userId) { bool isModified = false; var changeData = new Dictionary <string, bool>(); changeData.Add("COMPANY_CODE", origin.CompanyCode == data.CompanyCode); changeData.Add("WERKS", origin.PlantWerks == data.PlantWerks); changeData.Add("FA_CODE", origin.FaCode == data.FaCode); changeData.Add("WASTE_DATE", origin.WasteProductionDate == data.WasteProductionDate); changeData.Add("BRAND_DESC", origin.BrandDescription == data.BrandDescription); changeData.Add("PLANT_NAME", origin.PlantName == data.PlantName); changeData.Add("COMPANY_NAME", origin.CompanyName == data.CompanyName); changeData.Add("MARKER_REJECT_STICK_QTY", origin.MarkerRejectStickQty == Convert.ToDecimal(data.MarkerStr)); changeData.Add("PACKER_REJECT_STICK_QTY", origin.PackerRejectStickQty == Convert.ToDecimal(data.PackerStr)); changeData.Add("DUST_WASTE_GRAM_QTY", origin.DustWasteGramQty == Convert.ToDecimal(data.DustGramStr)); changeData.Add("FLOOR_WASTE_GRAM_QTY", origin.FloorWasteGramQty == Convert.ToDecimal(data.FloorGramStr)); //changeData.Add("DUST_WASTE_STICK_QTY", origin.DustWasteStickQty == data.DustWasteStickQty); //changeData.Add("FLOOR_WASTE_STICK_QTY", origin.FloorWasteStickQty == data.FloorWasteStickQty); changeData.Add("STAMP_WASTE_QTY", origin.StampWasteQty == Convert.ToDecimal(data.StampWasteQtyStr)); foreach (var listChange in changeData) { if (listChange.Value) { continue; } { var changes = new CHANGES_HISTORY() { FORM_TYPE_ID = Core.Enums.MenuList.CK4C, FORM_ID = "Waste_" + data.CompanyCode + "_" + data.PlantWerks + "_" + data.FaCode + "_" + data.WasteProductionDate.ToString("ddMMMyyyy"), FIELD_NAME = listChange.Key, MODIFIED_BY = userId, MODIFIED_DATE = DateTime.Now }; switch (listChange.Key) { case "COMPANY_CODE": changes.OLD_VALUE = origin.CompanyCode; changes.NEW_VALUE = data.CompanyCode; changes.FIELD_NAME = "Company"; break; case "WERKS": changes.OLD_VALUE = origin.PlantWerks; changes.NEW_VALUE = data.PlantWerks; changes.FIELD_NAME = "Plant"; break; case "FA_CODE": changes.OLD_VALUE = origin.FaCode; changes.NEW_VALUE = data.FaCode; changes.FIELD_NAME = "Finish Goods"; break; case "WASTE_DATE": changes.OLD_VALUE = origin.WasteProductionDate.ToString(); changes.NEW_VALUE = data.WasteProductionDate.ToString(); changes.FIELD_NAME = "Waste Production Date"; break; case "BRAND_DESC": changes.OLD_VALUE = origin.BrandDescription; changes.NEW_VALUE = data.BrandDescription; changes.FIELD_NAME = "Brand Description"; break; case "PLANT_NAME": changes.OLD_VALUE = origin.PlantName; changes.NEW_VALUE = data.PlantName; changes.FIELD_NAME = "Plant"; break; case "COMPANY_NAME": changes.OLD_VALUE = origin.CompanyName; changes.NEW_VALUE = data.CompanyName; changes.FIELD_NAME = "Company"; break; case "MARKER_REJECT_STICK_QTY": changes.OLD_VALUE = origin.MarkerRejectStickQty.ToString(); changes.NEW_VALUE = data.MarkerStr; changes.FIELD_NAME = "Maker Reject Cigarette(stick)"; break; case "PACKER_REJECT_STICK_QTY": changes.OLD_VALUE = origin.PackerRejectStickQty.ToString(); changes.NEW_VALUE = data.PackerStr; changes.FIELD_NAME = "Packer Reject Cigarette(stick)"; break; case "DUST_WASTE_GRAM_QTY": changes.OLD_VALUE = origin.DustWasteGramQty.ToString(); changes.NEW_VALUE = data.DustGramStr; changes.FIELD_NAME = "Dust Waste QTY (gram)"; break; case "FLOOR_WASTE_GRAM_QTY": changes.OLD_VALUE = origin.FloorWasteGramQty.ToString(); changes.NEW_VALUE = data.FloorGramStr; changes.FIELD_NAME = "Floor Waste QTY (gram)"; break; //case "DUST_WASTE_STICK_QTY": // changes.OLD_VALUE = origin.DustWasteStickQty.ToString(); // changes.NEW_VALUE = data.DustWasteStickQty.ToString(); // changes.FIELD_NAME = "Dust Waste QTY (Stick)"; // break; //case "FLOOR_WASTE_STICK_QTY": // changes.OLD_VALUE = origin.FloorWasteStickQty.ToString(); // changes.NEW_VALUE = data.FloorWasteStickQty.ToString(); // changes.FIELD_NAME = "Floor Waste QTY (Stick)"; // break; case "STAMP_WASTE_QTY": changes.OLD_VALUE = origin.StampWasteQty.ToString(); changes.NEW_VALUE = data.StampWasteQtyStr; break; default: break; } _changesHistoryBll.AddHistory(changes); isModified = true; } } return(isModified); }