/// <summary> /// 根据ParamsX是否为空进行重置 /// </summary> /// <param name="olsd"></param> /// <returns></returns> private string[] resetParams(OfflineLableSettingDef olsd) { string[] paramArray = new string[8]; paramArray[0] = olsd.param1; paramArray[1] = olsd.param2; paramArray[2] = olsd.param3; paramArray[3] = olsd.param4; paramArray[4] = olsd.param5; paramArray[5] = olsd.param6; paramArray[6] = olsd.param7; paramArray[7] = olsd.param8; for (int i = 0; i <= 7; i++) { if (paramArray[i].Trim() != "") continue; else { for (int j = i + 1; j <= 7; j++) { if (paramArray[j].Trim() != "") { paramArray[i] = paramArray[j]; paramArray[j] = ""; break; } } } } return paramArray; }
/// <summary> /// 添加一条offlinelabelsetting数据 /// </summary> /// <param name="obj"></param> public void addOfflineLabelSetting(OfflineLableSettingDef obj) { try { ILabelTypeRepository iplr = RepositoryFactory.GetInstance().GetRepository<ILabelTypeRepository>(); IList<OfflineLableSettingDef> lstOffline= new List<OfflineLableSettingDef>(); lstOffline = iplr.GetOfflineLabelSetting(obj.fileName); if (lstOffline == null || lstOffline.Count <= 0) { string[] getParams = resetParams(obj); OfflineLableSettingDef OfSetting = new OfflineLableSettingDef(); OfSetting.fileName = obj.fileName; OfSetting.labelSpec = obj.labelSpec; OfSetting.description = obj.description; OfSetting.PrintMode = obj.PrintMode; OfSetting.SPName = obj.SPName; OfSetting.param1 = getParams[0]; OfSetting.param2 = getParams[1]; OfSetting.param3 = getParams[2]; OfSetting.param4 = getParams[3]; OfSetting.param5 = getParams[4]; OfSetting.param6 = getParams[5]; OfSetting.param7 = getParams[6]; OfSetting.param8 = getParams[7]; OfSetting.cdt = obj.cdt; OfSetting.editor = obj.editor; OfSetting.udt = obj.udt; iplr.AddOfflineLabelSetting(OfSetting); } else { //已经存在具有相同File的OfflineLableSettingDef记录 List<string> erpara = new List<string>(); FisException ex; ex = new FisException("DMT084", erpara); throw ex; } } catch (FisException e) { logger.Error(e.mErrmsg); throw e; } catch (Exception e) { logger.Error(e.Message); throw; } }
/// <summary> /// 删除offlinelabelsetting数据 /// </summary> /// <param name="obj"></param> public void deleteOfflineLabelSetting(OfflineLableSettingDef obj) { ILabelTypeRepository iplr = RepositoryFactory.GetInstance().GetRepository<ILabelTypeRepository>(); OfflineLableSettingDef OfSetting = new OfflineLableSettingDef(); OfSetting.id = obj.id; OfSetting.fileName = obj.fileName; OfSetting.labelSpec = obj.labelSpec; OfSetting.description = obj.description; OfSetting.PrintMode = obj.PrintMode; OfSetting.SPName = obj.SPName; OfSetting.param1 = obj.param1; OfSetting.param2 = obj.param2; OfSetting.param3 = obj.param3; OfSetting.param4 = obj.param4; OfSetting.param5 = obj.param5; OfSetting.param6 = obj.param6; OfSetting.param7 = obj.param7; OfSetting.param8 = obj.param8; OfSetting.cdt = obj.cdt; OfSetting.editor = obj.editor; OfSetting.udt = obj.udt; try { iplr.DeleteOfflineLabelSetting(OfSetting); } catch (FisException e) { logger.Error(e.mErrmsg); throw e; } catch (Exception e) { logger.Error(e.Message); throw; } }
/// <summary> /// 删除一条数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDelete_ServerClick(Object sender, EventArgs e) { OfflineLableSettingDef item = new OfflineLableSettingDef(); string FileName = this.dFileName.Text; string oldFileName = this.hidFileName.Value.Trim(); try { IList<OfflineLableSettingDef> listOffline = new List<OfflineLableSettingDef>(); listOffline = offlineLabelSetting.getOfflineLabelSetting(oldFileName); if (listOffline.Count > 0) { item = listOffline.First(); } offlineLabelSetting.deleteOfflineLabelSetting(item); } catch (FisException ex) { showErrorMessage(ex.mErrmsg); return; } catch (Exception ex) { showErrorMessage(ex.Message); return; } ShowOfflineLabelSettingList(); this.UpdatePanel2.Update(); ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "DeleteComplete();", true); }
///// <summary> ///// 添加数据方法 ///// </summary> ///// <param name="sender"></param> ///// <param name="e"></param> protected void btnAdd_serverClick(Object sender, EventArgs e) { OfflineLableSettingDef item = new OfflineLableSettingDef(); string FileName = this.dFileName.Text; item.fileName = this.dFileName.Text; item.description = this.dDescr.Text; item.labelSpec = this.dLabelSpec.Text; item.PrintMode = int.Parse(this.cmbPrintModel.SelectedValue); item.SPName = this.txtSPName.Text.ToString().Trim(); item.param1 = this.dParam1.Text; item.param2 = this.dParam2.Text; item.param3 = this.dParam3.Text; item.param4 = this.dParam4.Text; item.param5 = this.dParam5.Text; item.param6 = this.dParam6.Text; item.param7 = this.dParam7.Text; item.param8 = this.dParam8.Text; item.editor = this.HiddenUsername.Value; item.cdt = DateTime.Now; item.udt = DateTime.Now; try { offlineLabelSetting.addOfflineLabelSetting(item); } catch (FisException ex) { showErrorMessage(ex.mErrmsg); return; } catch (Exception ex) { //show error showErrorMessage(ex.Message); return; } ShowOfflineLabelSettingList(); this.UpdatePanel2.Update(); FileName = replaceSpecialChart(FileName); ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "AddUpdateComplete('" + FileName + "');", true); }
private void show_index_(OfflineLableSettingDef info, int index_num, ArrayList bufferList) { string paramN = get_parameterN(info, index_num); if ((paramN != "") && !isInArrayList(paramN, bufferList)) { bufferList.Add(paramN); show_inner(paramN, show_index); show_index++; g_boxSelected[index_num] = 1; } else { g_boxSelected[index_num] = 0; } }
public string get_parameterN(OfflineLableSettingDef info, int index) { switch (index) { case 0: return info.param1; case 1: return info.param2; case 2: return info.param3; case 3: return info.param4; case 4: return info.param5; case 5: return info.param6; case 6: return info.param7; case 7: return info.param8; } return info.param1; }