Exemple #1
0
 /// <summary>
 /// 取得所有family数据的list(按Family列的字母序排序)
 /// </summary>
 /// <returns></returns>
 public IList<FamilyDef> GetFamilyInfoList()
 {
     List<IMES.DataModel.FamilyDef> retLst = new List<FamilyDef>();
     try
     {
         IFamilyRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository>();
         IList<Family> getData = itemRepository.FindAll();
         for (int i = 0; i < getData.Count; i++)
         {
             FamilyDef item = new FamilyDef();
             item.CustomerID = getData[i].Customer;
             item.Descr = getData[i].Description;
             item.Family = getData[i].FamilyName;
             item.Editor = getData[i].Editor;
             retLst.Add(item);
         }
         return retLst;
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #2
0
 /// <summary>
 /// "删除一条family的记录数据
 /// </summary>
 /// <param name="?"></param>
 public void DeleteFamily(FamilyDef obj)
 {
     try
     {
         IFamilyRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository>();
         UnitOfWork uow = new UnitOfWork();
         Family item = itemRepository.Find(obj.Family);
         itemRepository.Remove(item, uow);
         uow.Commit();
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #3
0
        /// <summary>
        /// 保存一条family的记录数据(update), 若Family名称为其他存在的Family的名称相同,则提示业务异常
        /// </summary>
        /// <param name="Object"></param>
        public void UpdateFamily(FamilyDef obj, String oldFamilyId)
        {
            try
            {
                IFamilyRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository>();
                Family item = new Family(obj.Family, obj.Descr, obj.CustomerID);
                item.FamilyName = obj.Family;
                item.Customer = obj.CustomerID;
                item.Description = obj.Descr;
                item.Editor = obj.Editor;
                item.Udt = DateTime.Now;
                itemRepository.ChangeFamily(item, oldFamilyId);
            }
            catch (Exception)
            {
                throw;
            }

        }
Exemple #4
0
        /// <summary>
        /// 保存一条family的记录数据(Add)
        /// </summary>
        /// <param name="Object"></param>
        public void AddFamily(FamilyDef obj)
        {
            FamilyDef familyObj = obj;

            try
            {
                IFamilyRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository>();

                UnitOfWork uow = new UnitOfWork();
                Family item = new Family(obj.Family,obj.Descr,obj.CustomerID);
                item.FamilyName = obj.Family;
                item.Customer = obj.CustomerID;
                item.Description = obj.Descr;
                item.Editor = obj.Editor;
                item.Cdt = DateTime.Now;
                item.Udt = DateTime.Now;
                itemRepository.Add(item, uow);
                uow.Commit();
            }
            catch (Exception)
            {
                throw;
            }


        }
Exemple #5
0
        /// <summary>
        ///  取得一条family的记录数据
        /// </summary>
        /// <param name="?"></param>
        /// <returns></returns>
        public FamilyDef GetFamily(String id)
        {
            FamilyDef ret = new FamilyDef();

            ret.Family = "Family0";
            ret.Descr = "Descr0";
            return ret;

            //try
            //{
            //    IFamilyRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository>();
            //    ret = itemRepository.Find(id);
            //    return ret;
            //}
            //catch (Exception)
            //{
            //    throw;
            //}

        }
Exemple #6
0
        /// <summary>
        /// 取得Customer下的family数据的list(按Family列的字母序排序)
        /// </summary>
        /// <param name="?"></param>
        /// <returns></returns>
        public IList<IMES.DataModel.FamilyDef> GetFamilyInfoList(String customerId)
        {

            //List<IMES.DataModel.FamilyDef> retLst = new List<FamilyDef>();

            //IMES.DataModel.FamilyDef item1 = new IMES.DataModel.FamilyDef();
            //item1.Family = "family1";
            //item1.Descr = "Descr1";
            //item1.CustomerID = "IES";

            //IMES.DataModel.FamilyDef item2 = new IMES.DataModel.FamilyDef();
            //item2.Family = "family2";
            //item2.Descr = "Descr2";
            //item2.CustomerID = "IES";

            //retLst.Add(item1);
            //retLst.Add(item2);

            //return retLst;
            List<IMES.DataModel.FamilyDef> retLst = new List<FamilyDef>();

            try
            {
                IFamilyRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository>();
                IList<Family> getData=itemRepository.GetFamilyList(customerId);
                for(int i=0;i<getData.Count;i++)
                {
                    FamilyDef item =new FamilyDef();
                    item.CustomerID = getData[i].Customer;
                    item.Descr = getData[i].Description;
                    item.Family = getData[i].FamilyName;
                    item.Editor = getData[i].Editor;


                    if (getData[i].Cdt == DateTime.MinValue)
                    {
                        item.cdt = "";
                    }
                    else
                    {
                        item.cdt = ((System.DateTime)getData[i].Cdt).ToString("yyyy-MM-dd HH:mm:ss");
                    }

                    if (getData[i].Udt == DateTime.MinValue)
                    {
                        item.udt = "";
                    }
                    else
                    {
                        item.udt = ((System.DateTime)getData[i].Udt).ToString("yyyy-MM-dd HH:mm:ss");
                    }
                    //item.cdt = getData[i].Cdt.ToString("yyyy-MM-dd");
                    //item.udt = getData[i].Udt.ToString("yyyy-MM-dd");
                    retLst.Add(item);
                }
                return retLst;
            }
            catch (Exception)
            {
                throw;
            }

        }
Exemple #7
0
    protected void btnAdd_ServerClick(Object sender, EventArgs e)
    {
        FamilyDef item = new FamilyDef();

        string familyId = this.dFamily.Text.Trim().ToUpper();
        string description = this.dDescription.Text.Trim();
        string customer = this.cmbcustom.SelectedValue.ToString();
        item.Family = familyId;
        item.Descr = description;
        item.CustomerID = customer;
        item.Editor = this.HiddenUserName.Value;
        //item.CustomerID = this.cmbCustomer.InnerDropDownList.SelectedValue;
        
        try
        {
            iFamily.AddFamily(item);
          
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;
        }
        catch (Exception ex)
        {
            //show error
            showErrorMessage(ex.Message);
            return;
        }
        ShowFamilyListByCustom();
        familyId = replaceSpecialChart(familyId);

        ScriptManager.RegisterStartupScript(this.updatePanel, typeof(System.Object), "saveUpdate", "AddUpdateComplete('" + familyId + "');", true);
    }