Ejemplo n.º 1
0
        /// <summary>
        /// 保存一条Bom Description的记录数据(Add), 若Code与存在记录的Code的名称相同,则提示业务异常
        /// </summary>
        /// <param name="obj">BomDescrDef结构</param>
        public void AddBomDescr(BomDescrDef obj)
        {
            try
            {
                IBOMRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IBOMRepository>();

                //Code与存在记录的Code的名称相同,则提示业务异常
                IList<DescTypeInfo> exists = itemRepository.GetBOMDescrsByCode(obj.Code);
                if (exists != null && exists.Count > 0)
                {
                    List<string> erpara = new List<string>();
                    FisException ex;
                    ex = new FisException("DMT089", erpara);
                    throw ex;

                }

                DescTypeInfo newItem = new DescTypeInfo();
                newItem.code = obj.Code;
                newItem.editor = obj.Editor;
                newItem.tp = obj.Type;
                newItem.description = obj.Descr;
                itemRepository.InsertBOMDescr(newItem);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 根据Type取得对应的Bom Description数据的list(按Code栏位排序)
        /// </summary>
        /// <param name="type">过滤条件Type</param>
        /// <returns></returns>
        public IList<BomDescrDef> GetBomDescrList(String type)
        {
            List<BomDescrDef> retLst = new List<BomDescrDef>();
            try
            {
                IBOMRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IBOMRepository>();
                IList<DescTypeInfo> getData = itemRepository.GetBOMDescrsByTp(type);

                if (getData != null)
                {
                    for (int i = 0; i < getData.Count; i++)
                    {
                        DescTypeInfo data = getData[i];
                        BomDescrDef item = new BomDescrDef();
                        item.ID = data.id.ToString();
                        item.Code = data.code;
                        item.Descr = data.description;
                        item.Type = data.tp;
                        item.Editor = data.editor;
                        if (data.cdt == DateTime.MinValue)
                        {
                            item.Cdt = "";
                        }
                        else
                        {
                            item.Cdt = ((System.DateTime)data.cdt).ToString("yyyy-MM-dd HH:mm:ss");
                        }

                        if (data.udt == DateTime.MinValue)
                        {
                            item.Udt = "";
                        }
                        else
                        {
                            item.Udt = ((System.DateTime)data.udt).ToString("yyyy-MM-dd HH:mm:ss");
                        }
                        retLst.Add(item);
                    }
                }

                return retLst;
            }
            catch (Exception)
            {
                throw;
            } 
        }
Ejemplo n.º 3
0
 protected void btnDelete_ServerClick(Object sender, EventArgs e)
 {
     string oldId = this.dOldId.Value;
     try
     {
         BomDescrDef item = new BomDescrDef();
         item.ID = oldId;
         iBomDescrMaintain.DeleteBomDescr(item);
     }
     catch (FisException ex)
     {
         showErrorMessage(ex.mErrmsg);
         return;
     }
     catch (Exception ex)
     {
         //show error
         showErrorMessage(ex.Message);
         return;
     }
     ShowListByType();
     this.updatePanel2.Update();
     ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "DeleteComplete();DealHideWait();", true);
 }
Ejemplo n.º 4
0
    protected void btnAdd_ServerClick(Object sender, EventArgs e)
    {
        BomDescrDef item = new BomDescrDef();

        item.Code = this.dCode.Text.Trim();
        item.Type = this.cmbMaintainPartType.InnerDropDownList.SelectedValue;

        item.Descr = this.dDescr.Text.Trim();
        item.Editor = this.HiddenUserName.Value;
   
        try
        {
            iBomDescrMaintain.AddBomDescr(item);
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;
        }
        catch (Exception ex)
        {
            //show error
            showErrorMessage(ex.Message);
            return;
        }
        ShowListByType();
        String itemId = replaceSpecialChart(item.Code);
        this.updatePanel2.Update();
        ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "AddUpdateComplete('" + itemId + "');DealHideWait();", true);

    }
Ejemplo n.º 5
0
 /// <summary>
 /// 删除一条Bom Description的记录数据
 /// </summary>
 /// <param name="obj">BomDescrDef结构</param>
 public void DeleteBomDescr(BomDescrDef obj)
 {
     try
     {
         IBOMRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IBOMRepository>();
         itemRepository.DeleteBOMDescrById(Int32.Parse(obj.ID));
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 保存一条Bom Description的记录数据(update), 若Code与存在记录的Code的名称相同,则提示业务异常
        /// </summary>
        /// <param name="obj">更新BomDescrDef结构</param>
        /// <param name="oldCode">修改前Code</param>
        public void UpdateBomDescr(BomDescrDef obj, String oldCode)
        {
            try
            {
                IBOMRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IBOMRepository>();

                //Code与存在记录的Code的名称相同,则提示业务异常
                IList<DescTypeInfo> exists = itemRepository.GetBOMDescrsByCode(obj.Code);
                if (exists != null && exists.Count > 0 && oldCode != obj.Code)
                {
                    List<string> erpara = new List<string>();
                    FisException ex;
                    ex = new FisException("DMT089", erpara);
                    throw ex;

                }

                DescTypeInfo itemOld = itemRepository.FindBOMDescrById(Int32.Parse(obj.ID));
                if (itemOld == null)
                {
                    List<string> erpara = new List<string>();
                    FisException ex;
                    ex = new FisException("DMT082", erpara);
                    throw ex;
                }

                DescTypeInfo newItem = new DescTypeInfo();
                newItem.code = obj.Code;
                newItem.id = Int32.Parse(obj.ID);
                newItem.editor = obj.Editor;
                newItem.tp = obj.Type;
                newItem.description = obj.Descr;
                newItem.cdt = DateTime.Now; //Convert.ToDateTime(obj.Cdt);
                itemRepository.UpdateBOMDescrById(newItem);
            }
            catch (Exception)
            {
                throw;
            }
        }