コード例 #1
0
ファイル: CommonImpl.cs プロジェクト: wra222/testgit
        /// <summary>
        ///  保存一条Warranty的记录数据 (update)
        /// </summary>
        /// <param name="Object"></param>
        public void UpdateWarranty(WarrantyDef obj, String oldWarrantyId)
        {

            IWarrantyRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IWarrantyRepository>();
            if (itemRepository.GetExistWarranty(obj.Customer, obj.Descr, Int32.Parse(obj.id)).Rows.Count > 0)
            {
                //throw new ApplicationException("Already exist warranty with the same description under the customer in database.");
                List<string> erpara = new List<string>();
                FisException ex;
                ex = new FisException("DMT001", erpara);
                throw ex;
            }

            try
            {              
                UnitOfWork uow = new UnitOfWork();
                Warranty item = itemRepository.Find(Int32.Parse(obj.id));
                item.Customer = obj.Customer;
                item.Type = obj.Type;
                item.DateCodeType = obj.DateCodeType;
                item.WarrantyFormat = obj.WarrantyFormat;
                item.ShipTypeCode = obj.ShipTypeCode;
                item.WarrantyCode = obj.WarrantyCode;
                item.Descr = obj.Descr;
                item.Editor = obj.Editor;
                item.Udt = DateTime.Now;
                itemRepository.Update(item, uow);
                uow.Commit();
            }
            catch (Exception)
            {
                throw;
            }

        }
コード例 #2
0
ファイル: CommonImpl.cs プロジェクト: wra222/testgit
        /// <summary>
        /// 保存一条Warranty的记录数据(Add)
        /// </summary>
        /// <param name="?"></param>
        public string AddWarranty(WarrantyDef obj)
        {

            IWarrantyRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IWarrantyRepository>();
            if (itemRepository.GetExistWarranty(obj.Customer, obj.Descr).Rows.Count > 0)
            {
                //throw new ApplicationException("Already exist warranty with the same description under the customer in database.");
                List<string> erpara = new List<string>();
                FisException ex;
                ex = new FisException("DMT001", erpara);
                throw ex;
            }

            int id = 0;
            try
            {
                UnitOfWork uow = new UnitOfWork();
                Warranty item = new Warranty
                    (id, 
                    obj.Customer,
                    obj.Type,
                    obj.DateCodeType,
                    obj.WarrantyFormat,
                    obj.ShipTypeCode,
                    obj.WarrantyCode,
                    obj.Descr,
                    obj.Editor,
                    DateTime.Now,
                    DateTime.Now
                    );
  
                itemRepository.Add(item, uow);
                uow.Commit();
                id=item.Id;
            }
            catch (Exception)
            {
                throw;
            }
            return id.ToString();

        }
コード例 #3
0
ファイル: CommonImpl.cs プロジェクト: wra222/testgit
        /// <summary>
        /// 取得一条Warranty的记录数据
        /// </summary>
        /// <param name="?"></param>
        /// <returns></returns>
        public WarrantyDef GetWarranty(String id)
        {
            WarrantyDef ret = new WarrantyDef();
            return ret;

        }
コード例 #4
0
ファイル: CommonImpl.cs プロジェクト: wra222/testgit
        /// <summary>
        /// 取得Customer Id下的Warranty数据的list(按Description栏位排序)
        /// </summary>
        /// <param name="?"></param>
        /// <returns></returns>
        public IList<WarrantyDef> GetWarrantyList(String customerId)
        {
            List<WarrantyDef> result=new List<WarrantyDef> ();

            try
            {
                IWarrantyRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IWarrantyRepository>();
                IList<Warranty> getData = itemRepository.GetWarrantyList(customerId);
                for (int i = 0; i < getData.Count; i++)
                {
                    WarrantyDef item = new WarrantyDef();
                    item.Customer = Null2String(getData[i].Customer);
                    item.DateCodeType = Null2String(getData[i].DateCodeType);
                    item.Descr = Null2String(getData[i].Descr);
                    item.Editor = Null2String(getData[i].Editor);
                    item.id = Null2String(getData[i].Id);
                    item.ShipTypeCode = Null2String(getData[i].ShipTypeCode);
                    item.ShipTypeCodeText = item.ShipTypeCode;
                    item.Type = Null2String(getData[i].Type);
                    item.TypeText = item.Type;
                    item.WarrantyCode = Null2String(getData[i].WarrantyCode);
                    item.WarrantyFormat = Null2String(getData[i].WarrantyFormat);
                    item.WarrantyFormatText = item.WarrantyFormat;

                    //item.cdt = getData[i].Cdt.ToString("yyyy-MM-dd");
                    //item.udt = getData[i].Udt.ToString("yyyy-MM-dd");


                    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");
                    }


                    result.Add(item);
                }
                return result;
            }
            catch (Exception)
            {
                throw;
            }

        }
コード例 #5
0
ファイル: Warranty.aspx.cs プロジェクト: wra222/testgit
    protected void btnAdd_ServerClick(Object sender, EventArgs e)
    {
        WarrantyDef item = new WarrantyDef();
        item.Customer = this.cmbCustomer.InnerDropDownList.SelectedValue;
        //if (this.dShipType.Checked == true)
        //{
        //    item.DateCodeType = DATACODE_TYPE_SHIPTYPE;
        //}
        //else
        //{
        //    item.DateCodeType = DATACODE_TYPE_WARRANTYTYPE;
        //}

        item.Descr = this.dDesc.Text.Trim();
        item.Editor = this.HiddenUserName.Value; 
        item.id = "0";
        item.ShipTypeCode = this.dShipTypeCode.Text.Trim().ToUpper();
        item.ShipTypeCodeText = item.ShipTypeCode;
        item.Type = this.cmbWarrantyType.InnerDropDownList.SelectedValue;
        item.TypeText = this.cmbWarrantyType.InnerDropDownList.SelectedItem.Text;
        item.WarrantyCode = this.dWarrantyCode.Text.Trim().ToUpper();
        item.WarrantyFormat = this.cmbWarrantyFormat.InnerDropDownList.SelectedValue;
        item.WarrantyFormatText = this.cmbWarrantyFormat.InnerDropDownList.SelectedItem.Text;

        string ret = "0";
        try
        {
            ret=iWarranty.AddWarranty(item);
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;
        }
        catch (Exception ex)
        {
            //show error
            showErrorMessage(ex.Message);
            return;
        }

        ShowWarrantyListByCustom();
        this.updatePanel1.Update();
        ScriptManager.RegisterStartupScript(this.updatePanel1, typeof(System.Object), "saveUpdate", "AddUpdateComplete('" + ret + "');DealHideWait();", true);
    }
コード例 #6
0
ファイル: PNOPLabelPrintImpl.cs プロジェクト: wra222/testgit
        /// <summary>
        /// InitDCode,Type = "MBDateCode",Customer = "HP"
        /// </summary>
        /// <returns></returns>
        public IList<WarrantyDef> InitDCode()
        {
            List<WarrantyDef> ret = new List<WarrantyDef>();
            IWarrantyRepository iWarrantyRepository = RepositoryFactory.GetInstance().GetRepository<IWarrantyRepository, Warranty>();
            Warranty condition = new Warranty();
            condition.Type = "MBDateCode";
            condition.Customer = "HP";
            IList<Warranty> warrantys = iWarrantyRepository.GetWarrantyListByCondition(condition);
            
            foreach (Warranty item in warrantys)
            {
                WarrantyDef iteminfo = new WarrantyDef();
                iteminfo.id = Convert.ToString(item.Id);
                iteminfo.Descr = item.Descr;
                ret.Add(iteminfo);
            }
            return ret;

        }