private LabelRuleSet convertToObjFromMaintainInfo(LabelRuleSet obj, LabelRuleSetMaintainInfo temp) { obj.ID = temp.Id; obj.RuleID = temp.RuleID; obj.AttributeName = temp.AttributeName; obj.AttributeValue = temp.AttributeValue; obj.Editor = temp.Editor; obj.Mode = temp.Mode; return obj; }
private LabelRuleSetMaintainInfo convertToMaintainInfoFromObj(LabelRuleSet temp) { LabelRuleSetMaintainInfo labelRuleSet = new LabelRuleSetMaintainInfo(); labelRuleSet.Id = temp.ID; labelRuleSet.RuleID = temp.RuleID; labelRuleSet.Mode = temp.Mode; labelRuleSet.Editor = temp.Editor; labelRuleSet.Cdt = temp.Cdt; labelRuleSet.AttributeName = temp.AttributeName; labelRuleSet.AttributeValue = temp.AttributeValue; labelRuleSet.Udt = temp.Udt; return labelRuleSet; }
public IList<LabelRuleSetMaintainInfo> GetLabelRuleSetByRuleID(int RuleID) { IList<LabelRuleSetMaintainInfo> labelRuleSetList = new List<LabelRuleSetMaintainInfo>(); try { IList<LabelRuleSet> tmpLabelRuleSetList = labelTypeRepository.GetLabelRuleSetByRuleID(RuleID); foreach (LabelRuleSet temp in tmpLabelRuleSetList) { LabelRuleSetMaintainInfo labelRuleSet = new LabelRuleSetMaintainInfo(); labelRuleSet = convertToMaintainInfoFromObj(temp); labelRuleSetList.Add(labelRuleSet); } } catch (FisException e) { logger.Error(e.mErrmsg); throw e; } catch (Exception e) { logger.Error(e.Message); throw; } return labelRuleSetList; }
public int SaveLabelRuleSet(LabelRuleSetMaintainInfo infoLabelRuleSet) { FisException ex; List<string> paraError = new List<string>(); try { LabelRuleSet labelRuleSetObj = null; if (infoLabelRuleSet.Id != 0) { labelRuleSetObj = labelTypeRepository.GetLabelRuleSetByID(infoLabelRuleSet.Id); } if (labelRuleSetObj == null) { //检查是否已存在相同的LabelRuleSet int count = labelTypeRepository.CheckExistedAttributeName(infoLabelRuleSet.RuleID, infoLabelRuleSet.Mode, infoLabelRuleSet.AttributeName); if (count > 0) { ex = new FisException("DMT136", paraError); throw ex; } labelRuleSetObj = new LabelRuleSet(); labelRuleSetObj = convertToObjFromMaintainInfo(labelRuleSetObj, infoLabelRuleSet); IUnitOfWork work = new UnitOfWork(); labelTypeRepository.AddLabelRuleSetDefered(work, labelRuleSetObj); work.Commit(); } else { labelRuleSetObj = convertToObjFromMaintainInfo(labelRuleSetObj, infoLabelRuleSet); IUnitOfWork work = new UnitOfWork(); labelTypeRepository.SaveLabelRuleSetDefered(work, labelRuleSetObj); work.Commit(); } return labelRuleSetObj.ID; } catch (FisException e) { logger.Error(e.mErrmsg); throw e; } catch (Exception e) { logger.Error(e.Message); throw; } }
protected void btnSave2_Click(object sender, System.EventArgs e) { string ruleSetId = null; try { LabelRuleSetMaintainInfo tmp = new LabelRuleSetMaintainInfo(); //tmp.Mode = selMode.SelectedValue; switch (selMode.SelectedValue) { case constCustomer: tmp.Mode = "0"; break; case constModel: tmp.Mode = "1"; break; case constModelInfo: tmp.Mode = "2"; break; case constDelivery: tmp.Mode = "3"; break; case constDeliveryInfo: tmp.Mode = "4"; break; case constPart: tmp.Mode = "5"; break; case constPartInfo: tmp.Mode = "6"; break; } tmp.AttributeName = cmbAttribute.InnerDropDownList.SelectedValue; tmp.AttributeValue = txtValue.Text; tmp.RuleID = Int32.Parse(hidRuleId.Value); tmp.Editor = editor; if (hidRuleSettingItemId.Value.Length > 0) { tmp.Id = Int32.Parse(hidRuleSettingItemId.Value); } else { tmp.Id = 0; } if ((cmbAttribute.InnerDropDownList.SelectedValue != hidAttribute.Value) && (hidRuleSettingItemId.Value.Length > 0)) { tmp.Id = 0; } ruleSetId = iLabelSettingManager.SaveLabelRuleSet(tmp).ToString(); bindRuleSettingTable(); } catch (FisException ex) { showErrorMessage_Save2Complete(ex.mErrmsg, hidRuleSettingItemId.Value); return; } catch (Exception ex) { //show error showErrorMessage_Save2Complete(ex.Message, hidRuleSettingItemId.Value); return; } ScriptManager.RegisterStartupScript(this.updatePanel3, typeof(System.Object), "Save2Complete", "Save2Complete(\"" + ruleSetId + "\");", true); }