Esempio n. 1
0
        /// <summary>
        ///  取得PartType的所有记录数据
        /// </summary>
        /// <param name="?"></param>
        /// <returns>IList<PartTypeDef></returns>
        public IList<PartTypeAttributeDef> GetPartTypeList()
        {

            IList<PartTypeAttributeDef> chepList = new List<PartTypeAttributeDef>();
            IList<PartTypeDef> listInfo = new List<PartTypeDef>();
            try
            {
                IPartRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>();
                listInfo = itemRepository.GetPartTypeDefList();
                foreach (PartTypeDef kitLocInfo in listInfo)
                {
                    PartTypeAttributeDef item = new PartTypeAttributeDef();
                    item.code = kitLocInfo.code;
                    item.index = kitLocInfo.indx;
                    item.description = kitLocInfo.description;
                    item.site = kitLocInfo.site;
                    item.cust = kitLocInfo.cust;
                    item.editor = kitLocInfo.editor;
                    item.id = kitLocInfo.id;
                    if (kitLocInfo.cdt == DateTime.MinValue)
                    {
                        item.cdt = "";
                    }
                    else
                    {
                        item.cdt = ((System.DateTime)kitLocInfo.cdt).ToString("yyyy-MM-dd HH:mm:ss");
                    }
                    if (kitLocInfo.udt == DateTime.MinValue)
                    {
                        item.udt = "";
                    }
                    else
                    {
                        item.udt = ((System.DateTime)kitLocInfo.udt).ToString("yyyy-MM-dd HH:mm:ss");
                    }

                    chepList.Add(item);
                }
                return chepList;
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 更新一条PartType的记录数据
 /// </summary>
 /// <param name="Object">PartTypeAttributeDef PartType,string id</param>
 public void UpdatePartType(PartTypeAttributeDef item, string id)
 {
     FisException ex;
     List<string> paraError = new List<string>();
     try
     {
         IPartRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>();
         UnitOfWork uow = new UnitOfWork();
         //当前信息是否存在
         PartTypeDef partType = itemRepository.GetPartTypeInfo(int.Parse(id));
         if (partType == null)
         {
             //要更新的原始数据已被删除
             ex = new FisException("DMT082", paraError);
             throw ex;
         }
         IList<PartTypeDef> lstPartTypeDef = itemRepository.GetPartTypeByCode(item.code);
         foreach (PartTypeDef partTypeDef in lstPartTypeDef)
         {
             //判断非当前记录和要更新的数据是否有重复
             if (partTypeDef.id != int.Parse(id) & partTypeDef.code == item.code)
             {
                 //要更新的数据已经存在于其他记录
                 ex = new FisException("DMT087", paraError);
                 throw ex;
             }
         }
         partType.tp = item.tp;
         partType.code = item.code;
         partType.indx = item.index;
         partType.description = item.description;
         partType.site = item.site;
         partType.cust = item.cust;
         partType.editor = item.editor;
         partType.id = int.Parse(id);
         partType.cdt = DateTime.Now;
         partType.udt = DateTime.Now;
         itemRepository.UpdatePartTypeDefered(uow, partType);
         uow.Commit();
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 3
0
 /// <summary>
 ///  取得一条PartType的记录数据
 /// </summary>
 /// <param name="?">String id</param>
 /// <returns>PartTypeDef</returns>
 public PartTypeAttributeDef GetPartTypeInfo(String id)
 {
     PartTypeAttributeDef partTypeDef = new PartTypeAttributeDef();
     return partTypeDef;
 }
Esempio n. 4
0
        /// <summary>
        /// 添加一条PartType的记录数据(Add)
        /// </summary>
        /// <param name="Object">PartTypeAttributeDef partTypeDef</param>
        public string AddPartType(PartTypeAttributeDef item)
        {
            FisException ex;
            List<string> paraError = new List<string>();
            try
            {
                PartTypeDef partType = new PartTypeDef();
                IPartRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>();
                UnitOfWork uow = new UnitOfWork();

                IList<PartTypeDef> lstCode = itemRepository.GetPartTypeByCode(item.code);

                if (lstCode.Count != 0)
                {
                    //要添加的数据已经存在
                    ex = new FisException("DMT087", paraError);
                    throw ex;
                }
                partType.tp = item.tp;
                partType.code = item.code;
                partType.indx = item.index;
                partType.description = item.description;
                partType.site = item.site;
                partType.cust = item.cust;
                partType.editor = item.editor;
                partType.cdt = DateTime.Now;
                partType.udt = DateTime.Now;
                itemRepository.AddPartTypeDefered(uow, partType);
                uow.Commit();
                string id = "";
                foreach (PartTypeDef partTypeDef in itemRepository.GetPartTypeByCode(item.code))
                {
                    id = partTypeDef.id.ToString();
                }
                return id;
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 5
0
    protected void btnAdd_ServerClick(Object sender, EventArgs e)
    {
        PartTypeAttributeDef item = new PartTypeAttributeDef();
        String id = null;
        item.tp = this.cmbMaintainPartType.InnerDropDownList.SelectedValue.Trim();
        item.code = this.code.Text.Trim().ToUpper();
        item.index = this.index.Text.Trim().ToUpper();
        item.description = this.descr.Text.Trim().ToUpper();

        if (this.site.Checked == true)
        {
            item.site = PUB;
        }
        else {
            var input = "";
            var SiteChekList = this.CmbMaintainPartTypeSite.InnerDropDownList;
            for (int i = 0; i < SiteChekList.Items.Count; i++ )
            {
                if (SiteChekList.Items[i].Selected == true)
                {
                    input = input + "<"+SiteChekList.Items[i].Text+">";
                }
            }
            item.site = input;
        }
        if (this.cust.Checked == true)
        {
            item.cust = PUB;
        }
        else
        {
            var input = "";
            var CustChekList = this.CmbMaintainPartTypeCust.InnerDropDownList;
            for (int i = 0; i < CustChekList.Items.Count; i++)
            {
                if (CustChekList.Items[i].Selected == true)
                {
                    input = input + "<" + CustChekList.Items[i].Text + ">";
                }
            }
            item.cust = input;
        }
        item.editor = this.HiddenUserName.Value;

        try
        {
            id = iPartTypeAttribute.AddPartType(item);
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;
        }
        catch (Exception ex)
        {
            //show error
            showErrorMessage(ex.Message);
            return;
        }
        ShowListByPartType();
        id = replaceSpecialChart(id);
        this.updatePanel2.Update();
        ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "DealHideWait();AddUpdateComplete('" + id + "');", true);

    }