public ActionResult _delRecord(int id) { SignDocumet signDocumet = signDocumetRepository.Get(id); signDocumetRepository.Delete(signDocumet); return(null); }
public ActionResult _addOrEditRecord(int id, int unitId, int signTypeId, int signDocTypeId, string prikaz, string fio, string workplaceName, int?tabn, int?workerId, int?ord, int storagenameId, int shopId) { SignDocumet signDocumet = signDocumetRepository.Get(id); //Если вставляется новая запись, то пытаемся найти запись с выбранным цехом if (signDocumet == null) { signDocumet = new SignDocumet(); signDocumet.OrganizationId = getIntCurrentEnterpriseId(); signDocumet.StorageNameId = storagenameId; signDocumet.ShopId = shopId; } if (unitId != null && unitId != 0) { signDocumet.Unit = organizationRepository.Get(unitId); } else { signDocumet.Unit = null; } SignTypes signType = signTypesRepository.Get(signTypeId); signDocumet.SignType = signType; signDocumet.CodeSign = signType.Code; signDocumet.NameSign = signType.Name; SignDocTypes signDocType = signDocTypesRepository.Get(signDocTypeId); signDocumet.SignDocType = signDocType; signDocumet.CodeDocumetn = signDocType.Code; signDocumet.Value = prikaz; if (workerId.HasValue && workerId != 0 && workerId != -1) { signDocumet.Worker = workerRepository.Get(workerId.Value); signDocumet.Tabn = signDocumet.Worker.TabN; } //if (tabn.HasValue) signDocumet.Tabn = tabn; if (fio != null) { signDocumet.Fio = fio; } else { signDocumet.Fio = signDocumet.Worker.Fio; } if (ord.HasValue) { signDocumet.Ord = ord; } signDocumet.WorkPlaceName = workplaceName; // сохраняем изменения signDocumetRepository.SaveOrUpdate(signDocumet); return(null); }
public static SignDocumet rebuildSignDocumet(SignDocumet inSignDocumet, List <string> excludeProperty) { SignDocumet st = new SignDocumet(inSignDocumet.Id); st.OrganizationId = inSignDocumet.OrganizationId; st.ShopId = inSignDocumet.ShopId; if (!isExclude(excludeProperty, "Unit")) { st.Unit = rebuildOrganization(inSignDocumet.Unit); } st.StorageNameId = inSignDocumet.StorageNameId; if (inSignDocumet.Worker != null) { Sex s = null; if (inSignDocumet.Worker.Sex != null) { s = new Sex(inSignDocumet.Worker.Sex.Id); s.Name = inSignDocumet.Worker.Sex.Name; } st.Worker = new Worker(inSignDocumet.Worker.Id, inSignDocumet.Worker.TabN, inSignDocumet.Worker.Fio, s, inSignDocumet.Worker.IsActive); } /* * if (inSignDocumet.Worker != null) * { * st.Worker = rebuildWorker(inSignDocumet.Worker); * } */ if (inSignDocumet.SignDocType != null) { st.SignDocType = rebuildSignDocTypes(inSignDocumet.SignDocType); } if (inSignDocumet.SignType != null) { st.SignType = rebuildSignTypes(inSignDocumet.SignType); } st.Tabn = inSignDocumet.Tabn; st.Fio = inSignDocumet.Fio; st.Ord = inSignDocumet.Ord; st.CodeDocumetn = inSignDocumet.CodeDocumetn; st.CodeSign = inSignDocumet.CodeSign; st.NameSign = inSignDocumet.NameSign; st.Value = inSignDocumet.Value; st.WorkPlaceName = inSignDocumet.WorkPlaceName; return(st); }
public ActionResult _SelectSignDocumet(int storagenameId, int shopId, int?unitId) { IList <SignDocumet> list = new List <SignDocumet>(); Dictionary <string, object> queryParams = new Dictionary <string, object>(); queryParams.Add("OrganizationId", getIntCurrentEnterpriseId()); queryParams.Add("StorageNameId", storagenameId); if (shopId != null && shopId != 0) { queryParams.Add("ShopId", shopId); } if (unitId != null) { queryParams.Add("Unit.Id", unitId); } //else //queryParams.Add("[]Unit", null); Dictionary <string, object> orderParams = new Dictionary <string, object>(); orderParams.Add("StorageNameId", ASC); if (shopId != null && shopId != 0) { orderParams.Add("ShopId", ASC); } if (unitId != null) { orderParams.Add("Unit", ASC); } orderParams.Add("CodeDocumetn", ASC); orderParams.Add("NameSign", ASC); orderParams.Add("Ord", ASC); IList <SignDocumet> signDocumets = signDocumetRepository.GetByLikeCriteria(queryParams, orderParams); foreach (SignDocumet item in signDocumets) { SignDocumet newItem = rebuildSignDocumet(item); list.Add(newItem); } return(View(new GridModel(list))); }
public static SignDocumet rebuildSignDocumet(SignDocumet inSignDocumet) { return(rebuildSignDocumet(inSignDocumet, null)); }