protected void btnAdd_Click(Object sender, EventArgs e)
    {
        string name = txtName.Text;
        string region = CmbRegion.InnerDropDownList.Text;
        string desc = txtDesc.Text;
        string modelInfoNameID;

        ModelInfoNameMaintainInfo model = new ModelInfoNameMaintainInfo();

        model.Name = name;
        model.Region = region;
        model.Descr = desc;
        model.Editor = editor;

        try
        {

            modelInfoNameID = iModelManager.AddModelInfoName(model).ToString();
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;

        }
        catch (Exception ex)
        {
            showErrorMessage(ex.Message);
            return;
        }

        bindTable();
        ScriptManager.RegisterStartupScript(this.updatePanel3, typeof(System.Object), "SaveComplete", "SaveComplete(\"" + modelInfoNameID + "\");", true);

    }
    protected void btnDelete_Click(Object sender, EventArgs e)
    {
        string name = txtName.Text;
        string region = CmbRegion.InnerDropDownList.Text;
        string desc = txtDesc.Text;
        string modelInfoNameId = hidModelInfoNameId.Value;

        ModelInfoNameMaintainInfo model = new ModelInfoNameMaintainInfo();

        model.Name = name;
        model.Region = region;
        model.Descr = desc;

        if (modelInfoNameId.Length != 0)
        {
            model.Id = Int32.Parse(modelInfoNameId);
        }

        model.Editor = editor;

        try
        {
            iModelManager.DeleteModelInfoName(model);
            modelInfoNameId = "-1";
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
        }
        catch (Exception ex)
        {
            //show error
            showErrorMessage(ex.Message);
        }
        bindTable();
        ScriptManager.RegisterStartupScript(this.updatePanel3, typeof(System.Object), "SaveComplete", "SaveComplete(\"" + modelInfoNameId + "\");", true);
    }
Exemple #3
0
        public void DeleteModelInfoName(ModelInfoNameMaintainInfo Object)
        {
            try
            {
                ModelInfoName modelInfoName = convertToObjFromMaintainInfo(Object);

                IUnitOfWork work = new UnitOfWork();
                modelRepository.DeleteModelInfoNameDefered(work, modelInfoName);
                work.Commit();
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;
            }

        }
Exemple #4
0
        public void SaveModelInfoName(ModelInfoNameMaintainInfo Object)
        {
            FisException ex;
            List<string> paraError = new List<string>();
            try
            {
                int count;
                //count = modelRepository.CheckExistedModelInfoName(Object.Region, Object.Name, Object.Id.ToString());
                count = modelRepository.CheckExistedModelInfoName(Object.Region, Object.Name, Object.Id.ToString());

                //取得ModelInfoName中等于region和modelInfoName的记录个数。
                if (count > 0)
                {
                    //paraError.Add(Object.PartNo);
                    //paraError.Add(Object.AssemblyCode);
                    //ex = new FisException("CHK020", paraError);
                    ex = new FisException("DMT011", paraError);//new SystemException("There is the same Rule!");//
                    throw ex;
                }
                else
                {
                    ModelInfoName objModelInfoName = convertToObjFromMaintainInfo(Object);

                    IUnitOfWork work = new UnitOfWork();

                    modelRepository.SaveModelInfoNameDefered(work, objModelInfoName);

                    work.Commit();
                }

            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;
            }
        }
Exemple #5
0
        public IList<ModelInfoNameMaintainInfo> GetModelInfoNameList()
        {
            IList<ModelInfoNameMaintainInfo> modelInfoNameList = new List<ModelInfoNameMaintainInfo>();
            try
            {
                IList<ModelInfoName> tmpModelInfoNameList = modelRepository.GetModelInfoNameList();

                foreach (ModelInfoName temp in tmpModelInfoNameList)
                {
                    ModelInfoNameMaintainInfo modelInfoName = new ModelInfoNameMaintainInfo();

                    modelInfoName = convertToMaintainInfoFromObj(temp);

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

            return modelInfoNameList;
        }
Exemple #6
0
        private ModelInfoName convertToObjFromMaintainInfo(ModelInfoNameMaintainInfo temp)
        {
            ModelInfoName modelinfo = new ModelInfoName();

            modelinfo.Name = temp.Name;
            modelinfo.Region = temp.Region;
            modelinfo.ID = temp.Id;
            modelinfo.Editor = temp.Editor;
            modelinfo.Cdt = temp.Cdt;
            modelinfo.Udt = temp.Udt;
            modelinfo.Description = temp.Descr;

            return modelinfo;
        }
Exemple #7
0
        private ModelInfoNameMaintainInfo convertToMaintainInfoFromObj(ModelInfoName temp)
        {
            ModelInfoNameMaintainInfo modelInfoName = new ModelInfoNameMaintainInfo();

            modelInfoName.Name = temp.Name;
            modelInfoName.Region = temp.Region;
            modelInfoName.Editor = temp.Editor;
            modelInfoName.Cdt = temp.Cdt;
            modelInfoName.Udt = temp.Udt;
            modelInfoName.Descr = temp.Description;
            modelInfoName.Id = temp.ID;

            return modelInfoName;
        }