Beispiel #1
0
    protected void btnDelete_ServerClick(Object sender, EventArgs e)
    {

        string id = this.dOldId.Value.Trim().ToUpper();
        try
        {
            VendorCodeDef item = new VendorCodeDef();
            item.ID = id;
            iVendorCode.DeleteVendorCode(item);
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;
        }
        catch (Exception ex)
        {
            //show error
            showErrorMessage(ex.Message);
            return;
        }
        ShowVendorList();
        this.updatePanel2.Update();
        ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "DeleteComplete();DealHideWait();", true);
    }
Beispiel #2
0
    protected void btnAdd_ServerClick(Object sender, EventArgs e)
    {
        VendorCodeDef item = new VendorCodeDef();
        string selVender = "";
        item.Vendor = this.cmbMaintainVendor.InnerDropDownList.SelectedValue;
        selVender = item.Vendor;
        if (item.Vendor == "AST")
        {
            item.Vendor = this.dPartNo.Text.Trim().ToUpper();
        }
        var idex = this.dIdex.Text.Trim();
        if (idex.StartsWith("0"))
        {
            idex = idex.Substring(1);
        }
        item.Idex = idex;
        item.VendorCode = this.dVendorCode.Text.Trim().ToUpper();
        item.Editor = this.HiddenUserName.Value;

        try
        {
            iVendorCode.AddVendorCode(item, selVender);
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;
        }
        catch (Exception ex)
        {
            showErrorMessage(ex.Message);
            return;
        }
        ShowVendorList();
        String itemId = replaceSpecialChart(item.VendorCode);
        this.updatePanel2.Update();
        ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "AddUpdateComplete('" + itemId + "');DealHideWait();", true);

    }
Beispiel #3
0
 /// <summary>
 /// 删除一条Vendor Code的记录数据
 /// </summary>
 /// <param name="obj">VendorCodeDef结构</param>
 public void DeleteVendorCode(VendorCodeDef obj)
 {
     try
     {
         IProductRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository>();
         //SupplierCodeInfo item = itemRepository.FindSupplierCodeInfo(Int32.Parse(obj.ID));
         //if (item != null)
         //{
             itemRepository.RemoveSupplierCodeInfo(Int32.Parse(obj.ID));
         //}
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #4
0
        private VendorCodeDef convert(SupplierCodeInfo data)
        {
            VendorCodeDef item = new VendorCodeDef();
            item.ID = data.id.ToString();
            item.Vendor = data.vendor;
            item.Idex = data.idex;
            item.VendorCode = data.code;
            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");
            }
            return item;
        }
Beispiel #5
0
        /// <summary>
        /// 保存一条Vendor Code的记录数据(Add)
        /// </summary>
        /// <param name="obj">VendorCodeDef结构</param>
        public void AddVendorCode(VendorCodeDef obj, string SelVender)
        {
            try
            {
                IProductRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository>();

                //Modify 2012/08/01,UC Update
                //若Vendor<>’AST’,若Vendor Code框中内容已经存在于SupplierCode数据表的Code栏位中,则提示用户“此Vendor Code 已經存在!”,放弃后续操作。
                IList<SupplierCodeInfo> exists =new List<SupplierCodeInfo>();
                if (SelVender != "AST")
                {
                    //若Vendor Code框中内容已经存在于SupplierCode数据表的Code栏位中,则提示用户“此Vendor Code 已經存在!”
                    exists = itemRepository.GetSupplierCodeListByCode(obj.VendorCode);
                    if (exists != null && exists.Count > 0)
                    {
                        List<string> erpara = new List<string>();
                        FisException ex;
                        ex = new FisException("DMT100", erpara);
                        throw ex;

                    }
                }
                else
                {
                    //Modify 2012/08/01,UC Update
                    //若Vendor=‘AST’,则检查PartNo是否在SupplierCode数据表的Code栏位,若存在,则提示用户“此PartNo已经存在”,放弃后续操作 
                    exists = itemRepository.GetSupplierCodeListByCode(obj.Vendor);
                    if (exists != null && exists.Count > 0)
                    {
                        List<string> erpara = new List<string>();
                        FisException ex;
                        ex = new FisException("DMT097", erpara);
                        throw ex;
                    }
                }

                //若Vendor和Priority框中内容已经同时作为某个SupplierCode记录的Vendor和Indx,则提示用户“此Vendor Code的優先級重復!”
                exists = itemRepository.GetSupplierCodeListByCode(obj.Vendor, obj.Idex);
                if (exists != null && exists.Count > 0)
                {
                    List<string> erpara = new List<string>();
                    FisException ex;
                    ex = new FisException("DMT101", erpara);
                    throw ex;

                }

                SupplierCodeInfo item = new SupplierCodeInfo();
                item.vendor = obj.Vendor;
                item.code = obj.VendorCode;
                item.idex = obj.Idex;
                item.editor = obj.Editor;
                item.cdt = DateTime.Now;
                item.udt = DateTime.Now;
                itemRepository.AddSupplierCodeInfo(item);
            }
            catch (Exception)
            {
                throw;
            }
        }