示例#1
0
    /// <summary>
    /// lableTempLate的保存按钮按下时触发的事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSaveLabelTemplate_Click(Object sender, EventArgs e)
    {
        try
        {
            PrintTemplateMaintainInfo tmpPrintTemplateInfo = new PrintTemplateMaintainInfo();
            tmpPrintTemplateInfo.LabelType = hidLabelType.Value;
            tmpPrintTemplateInfo.Piece = Int32.Parse(txtPiece.Text);
            tmpPrintTemplateInfo.SpName = txtSPName.Text;
            tmpPrintTemplateInfo.TemplateName = txtTemplateName.Text;
            if (this.drpLayout.SelectedIndex == 0)
            {
                tmpPrintTemplateInfo.Layout = 0;
            }
            else
            {
                tmpPrintTemplateInfo.Layout = 1;
            }
            tmpPrintTemplateInfo.Description = txtDescription3.Text;
            tmpPrintTemplateInfo.Editor = editor;
            //如果Template内容没变, 表示将来需要通过hidTemplateName保存
            if (hidTemplateName.Value == txtTemplateName.Text)
            {
                iLabelSettingManager.SavePrintTemplate(tmpPrintTemplateInfo);
            }
            //否则,做新增
            else
            {
                iLabelSettingManager.AddPrintTemplate(tmpPrintTemplateInfo);
            }


            bindLabelTemplateTable();
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;
        }
        catch (Exception ex)
        {
            //show error
            showErrorMessage(ex.Message);
            return;
        }
        this.updatePanel2.Update();
        ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "Add3Complete", "Add3Complete(\"" + txtTemplateName.Text + "\"); resetTableHeight();DealHideWait();", true);
    }
示例#2
0
 private PrintTemplate convertToObjFromMaintainInfo(PrintTemplate obj, PrintTemplateMaintainInfo temp)
 {
     obj.TemplateName = temp.TemplateName;
     obj.LblType = temp.LabelType;
     obj.Piece = temp.Piece;
     obj.SpName = temp.SpName;
     obj.Layout = temp.Layout;
     obj.Description = temp.Description;
     obj.Editor = temp.Editor;
     return obj;
 }
示例#3
0
        private PrintTemplateMaintainInfo convertToMaintainInfoFromObj(PrintTemplate temp)
        {
            PrintTemplateMaintainInfo printTemplate = new PrintTemplateMaintainInfo();

            printTemplate.LabelType = temp.LblType;
            printTemplate.TemplateName = temp.TemplateName;
            printTemplate.SpName = temp.SpName;
            printTemplate.Piece = temp.Piece;
            printTemplate.Layout = temp.Layout;
            printTemplate.Description = temp.Description;
            printTemplate.Editor = temp.Editor;
            printTemplate.Cdt = temp.Cdt;
            printTemplate.Udt = temp.Udt;

            return printTemplate;
        }
示例#4
0
        public void SavePrintTemplate(PrintTemplateMaintainInfo infoPrintTemplate)
        {
            FisException ex;
            List<string> paraError = new List<string>();
            try
            {
                PrintTemplate printTemplateObj = new PrintTemplate();
                printTemplateObj = convertToObjFromMaintainInfo(printTemplateObj, infoPrintTemplate);
                IUnitOfWork work = new UnitOfWork();
                labelTypeRepository.SavePrintTemplateDefered(work, printTemplateObj);
                work.Commit();

            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;
            }
        }
示例#5
0
        public void AddPrintTemplate(PrintTemplateMaintainInfo infoPrintTemplate)
        {
            FisException ex;
            List<string> paraError = new List<string>();
            try
            {
                //检查是否已存在相同的Process
                if (labelTypeRepository.CheckExistedTemplateName(infoPrintTemplate.TemplateName) > 0)
                {
                    ex = new FisException("DMT134", paraError);
                    throw ex;
                }
                else
                {
                    PrintTemplate printTemplateObj = new PrintTemplate();
                    printTemplateObj = convertToObjFromMaintainInfo(printTemplateObj, infoPrintTemplate);
                    IUnitOfWork work = new UnitOfWork();
                    labelTypeRepository.AddPrintTemplateDefered(work, printTemplateObj);
                    work.Commit();
                }

            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;
            }
        }
示例#6
0
        public IList<PrintTemplateMaintainInfo> getPrintTemplateListByLableType(string strLableType)
        {
            IList<PrintTemplateMaintainInfo> printTemplateList = new List<PrintTemplateMaintainInfo>();
            try
            {
                IList<PrintTemplate> tmpPrintTemplateList = labelTypeRepository.GetPrintTemplateListByLabelType(strLableType);

                foreach (PrintTemplate temp in tmpPrintTemplateList)
                {
                    PrintTemplateMaintainInfo printTemplate = new PrintTemplateMaintainInfo();

                    printTemplate = convertToMaintainInfoFromObj(temp);

                    printTemplateList.Add(printTemplate);
                }

            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;
            }

            return printTemplateList;
        }