示例#1
0
 protected void ddlVendorName_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ddlVendorName.SelectedIndex > 0)
     {
         SupplierTransaction sup      = new SupplierTransaction();
         Supplier            supplier = new Supplier();
         supplier                = sup.GetVendorDetailsByVendorId(connstring, ddlVendorName.SelectedItem.Value.Trim());
         txtAddress1.Text        = ((supplier.VendorAddress.Trim() == "") ? "No Data Available" : supplier.VendorAddress.Trim());
         txtAddress2.Text        = ((supplier.VendorAddress1.Trim() == "") ? "No Data Available" : supplier.VendorAddress1.Trim());
         txtContactPerson.Text   = ((supplier.ContactPerson.Trim() == "") ? "No Data Available" : supplier.ContactPerson.Trim());
         txtTelephoneNumber.Text = ((supplier.TelephoneNumber.Trim() == "") ? "No Data Available" : supplier.TelephoneNumber.Trim());
         txtEmailAddress.Text    = ((supplier.VendorEmail.Trim() == "") ? "No Data Available" : supplier.VendorEmail.Trim());
         lblMessage.Text         = "";
         hdnVendorId.Value       = ddlVendorName.SelectedItem.Value.Trim();
     }
     else
     {
         txtAddress1.Text        = "";
         txtAddress2.Text        = "";
         txtContactPerson.Text   = "";
         txtTelephoneNumber.Text = "";
         txtEmailAddress.Text    = "";
         lblMessage.Text         = "";
         hdnVendorId.Value       = "";
     }
 }
        public async Task <IHttpActionResult> Post(SupplierTransaction item)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            item.ObjectState = ObjectState.Added;
            _service.Insert(item);

            try
            {
                await _unitOfWorkAsync.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (ItemExists(item.SupplierTransactionID))
                {
                    return(Conflict());
                }
                throw;
            }

            return(Created(item));
        }
示例#3
0
 private void GetAllVendorsForAParticularCategory()
 {
     if (hdnCategoryId.Value.Trim() != "")
     {
         SupplierTransaction sup = new SupplierTransaction();
         hdnVendorsForACategoryId.Value = sup.GetSuppliersByCategoryId(connstring, hdnCategoryId.Value.Trim(), "");
     }
 }
示例#4
0
        private void ShowVendors()
        {
            SupplierTransaction vendor             = new SupplierTransaction();
            DataTable           dtOneTimeSuppliers = vendor.GetOneTimeSuppliers(connstring, hdnCategoryId.Value.Trim());

            ddlVendorName.DataSource     = dtOneTimeSuppliers;
            ddlVendorName.DataTextField  = "VendorName";
            ddlVendorName.DataValueField = "VendorId";
            ddlVendorName.DataBind();
            ddlVendorName.Items.Insert(0, "");
        }
示例#5
0
    protected void ddlSearch_Click(object sender, EventArgs e)
    {
        SupplierTransaction s = new SupplierTransaction();
        string ISOStandard    = GetISOStandard();

        gvSuppliers.DataSource = s.SearchVendors(connstring, ddlCategory.SelectedItem.Value.Trim(),
                                                 ddlSubCategory.SelectedItem.Value.Trim(), ISOStandard, ddlPCAAB.SelectedItem.Value.Trim(),
                                                 ddlBrands.SelectedItem.Value.Trim(), ddlServices.SelectedItem.Value.Trim(),
                                                 ddlLocations.SelectedItem.Value.Trim(), ddlItemsCarried.SelectedItem.Value.Trim());
        gvSuppliers.DataBind();
    }
示例#6
0
 private void GetAllVendorsForAParticularCategory()
 {
     if (hdnCategoryId.Value.Trim() != "")
     {
         SupplierTransaction sup = new SupplierTransaction();
         hdnVendorsForACategoryId.Value = sup.GetSuppliersByCategoryId(connstring, hdnCategoryId.Value.Trim(), "");
     }
     else
     {
         Response.Redirect("createauction.aspx");
     }
 }
示例#7
0
    protected void lnkOK_Click(object sender, EventArgs e)
    {
        SupplierTransaction supp = new SupplierTransaction();
        OtherTransaction    oth  = new OtherTransaction();

        if (!(supp.VendorExists(oth.Replace(txtVendorName.Text.Trim()))))
        {
            string vUserName = tbUserName.Text.Replace(" ", "");
            //if (vUserName.Length > 8)
            //    vUserName = vUserName.Substring(0, 8).ToUpper();
            //else
            //    vUserName = vUserName.ToUpper();

            if (supp.CheckUser(tbUserName.Text.Trim()))
            {
                string randomPwd = RandomPasswordGenerator.GenerateRandomPassword();

                int vVendorId = supp.InsertUser(connstring, vUserName, EncryptionHelper.Encrypt(randomPwd), ((int)Constant.USERTYPE.VENDOR).ToString().Trim());
                ViewState["sUserID"] = vVendorId;

                web_usercontrol_mobileno uctrlMobileNo1 = (web_usercontrol_mobileno)FindControl("uctrlMobileNo");

                supp.InsertOneTimeSupplier(vVendorId.ToString().Trim(), txtVendorName.Text.Trim(),
                                           ((int)Constant.SUPPLIERTYPE.OneTimeSupplier).ToString().Trim(),
                                           txtEmailAddress.Text.Trim(),
                                           txtAddress1.Text.Trim(),
                                           txtAddress2.Text.Trim(),
                                           txtContactPerson.Text.Trim(),
                                           txtTelephoneNumber.Text.Trim(), uctrlMobileNo1.MobileNumber);

                supp.SaveCategoriesAndSubCategories(vVendorId, ViewState[Constant.QS_CATEGORYID].ToString(), ViewState[Constant.QS_SUBCATEGORYID].ToString());

                string emailOk = "";
                if (SendEmail())
                {
                    emailOk = " and notified";
                }
                lblMessage.Text = txtVendorName.Text.Trim() + " has been successfully added" + emailOk + ".";
                lnkClose.Attributes.Add("onclick", "AddSuppliersB('" + vVendorId + "', '" + txtVendorName.Text.Trim() + "');");
                DisableFields();
            }
            else
            {
                lblMessage.Text = tbUserName.Text.Trim() + " already exists.";
            }
        }
        else
        {
            lblMessage.Text = txtVendorName.Text.Trim() + " already exists in the vendor list.";
        }
    }
示例#8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        FormsAuthenticationHelper.AuthenticateUserWithReturnUrl();
        connstring = Client.ConnectionString(HttpContext.Current.Session["clientid"].ToString());
        if (Int32.Parse(Session[Constant.SESSION_USERTYPE].ToString().Trim()) != (int)Constant.USERTYPE.BUYER)
        {
            Response.Redirect("../unauthorizedaccess.aspx");
        }

        if (!IsPostBack)
        {
            InitJavascript();
            if (Session["VendorId"] != null)
            {
                ViewState["VendorId"] = Session["VendorId"].ToString().Trim();
            }
            FillDropDownLists();
            SupplierTransaction st = new SupplierTransaction();
            Supplier            s  = st.QuerySuppliers(connstring, ViewState["VendorId"].ToString().Trim());
            lblCompanyName.Text       = s.VendorName.Trim();
            lblAddressHeadOffice.Text = s.VendorAddress.Trim() + " " + s.VendorAddress1.Trim();
            lblTelephone.Text         = s.TelephoneNumber.Trim();
            lblFax.Text                   = s.Fax.Trim();
            lblExtension.Text             = s.Extension.Trim();
            lblPOBox.Text                 = s.POBOX.Trim();
            lblPostalCode.Text            = s.PostalCode.Trim();
            lblEmail.Text                 = s.VendorEmail.Trim();
            ddlSupplierType.SelectedIndex = ddlSupplierType.Items.IndexOf(ddlSupplierType.Items.FindByValue(s.Accredited.Trim()));
            ddlPCABClass.SelectedIndex    = ddlPCABClass.Items.IndexOf(ddlPCABClass.Items.FindByValue(s.PCABClass.Trim()));
            switch (s.ISOStandard.Trim())
            {
            case "01":
                chkISOStandard_white.Items[1].Selected = true;
                break;

            case "10":
                chkISOStandard_white.Items[0].Selected = true;
                break;

            case "11":
                chkISOStandard_white.Items[0].Selected = true;
                chkISOStandard_white.Items[1].Selected = true;
                break;
            }

            FillCategoriesSubCategories();
            FillListBoxes();
        }
    }
        public async Task <IResponse> UpdateSupplierTransactionAsync(SupplierTransaction entity)
        {
            Logger?.LogInformation("'{0}' has been invoked", nameof(UpdateSupplierTransactionAsync));

            try
            {
                UnitOfWork.Repository <SupplierTransaction>().Update(entity);
                await UnitOfWork.SaveChangesAsync();

                return(new Response());
            }
            catch (Exception ex)
            {
                return(new Response(Logger, nameof(UpdateSupplierTransactionAsync), ex));
            }
        }
示例#10
0
        /// <summary>
        /// Creates a transaction entity associated with supplier.
        /// </summary>
        /// <param name="walletSnapshot"></param>
        /// <param name="db"></param>
        /// <returns>Retruns the newly creaated transaction with the customer included in it.</returns>
        private SupplierTransaction AddNewTransaction(HyperStoreServiceContext db, decimal walletSnapshot)
        {
            var transaction = new SupplierTransaction
            {
                SupplierTransactionId = Guid.NewGuid(),
                TransactionNo         = Utility.GenerateSupplierTransactionNo(),
                TransactionDate       = DateTime.Now,
                TransactionAmount     = (decimal)this.TransactionAmount,
                SupplierOrderNo       = this.Description,
                IsCredit       = (bool)this.IsCredit,
                SupplierId     = (Guid)this.SupplierId,
                WalletSnapshot = walletSnapshot
            };

            db.SupplierTransactions.Add(transaction);
            return(transaction);
        }
示例#11
0
    protected void gvSuppliers_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        SupplierTransaction s = new SupplierTransaction();
        string    ISOStandard = GetISOStandard();
        DataTable dt          = s.SearchVendors(connstring, ddlCategory.SelectedItem.Value.Trim(),
                                                ddlSubCategory.SelectedItem.Value.Trim(), ISOStandard, ddlPCAAB.SelectedItem.Value.Trim(),
                                                ddlBrands.SelectedItem.Value.Trim(), ddlServices.SelectedItem.Value.Trim(),
                                                ddlLocations.SelectedItem.Value.Trim(), ddlItemsCarried.SelectedItem.Value.Trim());

        if (dt != null)
        {
            DataView m_DataView = new DataView(dt);
            gvSuppliers.DataSource = m_DataView;
            gvSuppliers.PageIndex  = e.NewPageIndex;
            gvSuppliers.DataBind();
        }
    }
示例#12
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string vISOStandard = "";

        if ((chkISOStandard_white.Items[0].Selected == true) && (chkISOStandard_white.Items[1].Selected == true))
        {
            vISOStandard = "11";
        }
        else if ((chkISOStandard_white.Items[0].Selected == true) && (chkISOStandard_white.Items[1].Selected == false))
        {
            vISOStandard = "10";
        }
        else if ((chkISOStandard_white.Items[0].Selected == false) && (chkISOStandard_white.Items[1].Selected == true))
        {
            vISOStandard = "01";
        }
        else
        {
            vISOStandard = "00";
        }


        SupplierTransaction s = new SupplierTransaction();
        int i = s.UpdateSupplier(connstring, ViewState["VendorId"].ToString().Trim(), ddlSupplierType.SelectedItem.Value.Trim(), ddlPCABClass.SelectedItem.Value.Trim(), vISOStandard);

        s.DeleteVendorCategorySubCategory(connstring, ViewState["VendorId"].ToString().Trim());
        string vSubCategory = hdnSubCategory.Text.Trim();

        string[] VendorSubCategory = vSubCategory.Split(Convert.ToChar(","));
        s.InsertSubCategory(connstring, ViewState["VendorId"].ToString().Trim(), VendorSubCategory);
        string vCategory = hdnCategories.Text.Trim();

        string[] VendorCategory = vCategory.Split(Convert.ToChar(","));
        s.InsertCategory(connstring, ViewState["VendorId"].ToString().Trim(), VendorCategory);
        s.DeleteBSLP(connstring, ViewState["VendorId"].ToString().Trim());
        s.InsertBrandsMain(connstring, Session["VendorId"].ToString().Trim(), hdnBrands.Text.Trim());
        s.InsertItemsCarriedMain(connstring, Session["VendorId"].ToString().Trim(), hdnItems.Text.Trim());
        s.InsertServicesOfferedMain(connstring, Session["VendorId"].ToString().Trim(), hdnServices.Text.Trim());
        s.InsertLocationMain(connstring, Session["VendorId"].ToString().Trim(), hdnLocation.Text.Trim());

        Session["VendorId"] = ViewState["VendorId"].ToString().Trim();
        Response.Redirect("supplierdetails.aspx");
    }
示例#13
0
 /// <summary>
 /// Merge all values from one Entity into another one.
 /// </summary>
 /// <param name="source">Source Entity. Will be copied to the target.</param>
 /// <param name="target">Target Entity. Will receive the values from the source.</param>
 /// <returns>void.</returns>
 public static void Merge(SupplierTransaction source, SupplierTransaction target)
 {
     // this method merges 2 Entities.
     #region Merge Values
     target.SupplierTransactionID = source.SupplierTransactionID;
     target.SupplierID            = source.SupplierID;
     target.TransactionTypeID     = source.TransactionTypeID;
     target.PurchaseOrderID       = source.PurchaseOrderID;
     target.PaymentMethodID       = source.PaymentMethodID;
     target.SupplierInvoiceNumber = source.SupplierInvoiceNumber;
     target.TransactionDate       = source.TransactionDate;
     target.AmountExcludingTax    = source.AmountExcludingTax;
     target.TaxAmount             = source.TaxAmount;
     target.TransactionAmount     = source.TransactionAmount;
     target.OutstandingBalance    = source.OutstandingBalance;
     target.FinalizationDate      = source.FinalizationDate;
     target.IsFinalized           = source.IsFinalized;
     target.LastEditedBy          = source.LastEditedBy;
     target.LastEditedWhen        = source.LastEditedWhen;
     #endregion
 }
示例#14
0
    private void FillDropDownList()
    {
        SupplierTransaction vnd    = new SupplierTransaction();
        CategoryTransaction subCat = new CategoryTransaction();

        DataSet   dsVendors       = vnd.GetAllVendors(connstring);
        DataTable dsSubCategories = subCat.GetAllCategories(connstring);

        ddlCompanies.DataSource     = dsVendors.Tables[0];
        ddlCompanies.DataTextField  = "VendorName";
        ddlCompanies.DataValueField = "VendorID";
        ddlCompanies.DataBind();
        ddlCompanies.Items.Insert(0, new ListItem("[Company]", "0"));

        ddlSubCat.DataSource = dsSubCategories;
        //ddlSubCat.DataTextField = "SubCategoryName";
        //ddlSubCat.DataValueField = "SubCategoryId";
        ddlSubCat.DataTextField  = "CategoryName";
        ddlSubCat.DataValueField = "CategoryId";
        ddlSubCat.DataBind();
        ddlSubCat.Items.Insert(0, new ListItem("[Sub-category]", "9999"));
    }
示例#15
0
        private List <SupplierOrder> SettleUpOrders(SupplierTransaction transaction, HyperStoreServiceContext db)
        {
            List <SupplierOrder> settleUpSupplierOrder = new List <SupplierOrder>();

            if (transaction.IsCredit)
            {
                throw new Exception(String.Format("While settling up the orders transaction {0} cannot be of type credit", transaction.SupplierTransactionId));
            }
            var partiallyPaidOrders = db.SupplierOrders.Where(so => so.SupplierId == transaction.SupplierId &&
                                                              so.BillAmount - so.SettledPayedAmount > 0)
                                      .OrderBy(wo => wo.OrderDate);
            var debitTransactionAmount = transaction.TransactionAmount;

            foreach (var partiallyPaidOrder in partiallyPaidOrders)
            {
                if (debitTransactionAmount <= 0)
                {
                    break;
                }
                var remainingAmount = partiallyPaidOrder.BillAmount - partiallyPaidOrder.SettledPayedAmount;
                if (remainingAmount < 0)
                {
                    throw new Exception(string.Format("Supplier OrderNo {0}, Amount remaining to be paid: {1} cannot be less than zero", partiallyPaidOrder.SupplierOrderNo, remainingAmount));
                }
                decimal payingAmountForOrder = Math.Min(remainingAmount, debitTransactionAmount);
                debitTransactionAmount -= payingAmountForOrder;
                var IsOrderSettleUp = SettleUpOrder(partiallyPaidOrder, payingAmountForOrder, db);
                settleUpSupplierOrder.Add(partiallyPaidOrder);
                db.SupplierOrderTransactions.Add(new SupplierOrderTransaction
                {
                    SupplierOrderTransactionId = Guid.NewGuid(),
                    SupplierOrderId            = partiallyPaidOrder.SupplierOrderId,
                    TransactionId     = transaction.SupplierTransactionId,
                    PaidAmount        = payingAmountForOrder,
                    IsPaymentComplete = IsOrderSettleUp
                });
            }
            return(settleUpSupplierOrder);
        }
示例#16
0
    private void DisplaySuppliers()
    {
        SupplierTransaction s = new SupplierTransaction();

        s.GetAllVendors(connstring);
    }
示例#17
0
 /// <summary>
 /// Compare 2 Entities for changes. NavProperties are NOT taken into account. For NavProperties use the corresponding utils for those Entities
 /// </summary>
 /// <param name="one">Entity One.</param>
 /// <param name="two">Entity Two.</param>
 /// <returns>True if there is changes. False if no changes found.</returns>
 public static bool HasChanges(SupplierTransaction one, SupplierTransaction two)
 {
     // this method returns true if differences are found between the 2 entities.
     #region Detect Changes
     if (one.SupplierTransactionID != two.SupplierTransactionID)
     {
         return(true);
     }
     if (one.SupplierID != two.SupplierID)
     {
         return(true);
     }
     if (one.TransactionTypeID != two.TransactionTypeID)
     {
         return(true);
     }
     if (one.PurchaseOrderID != two.PurchaseOrderID)
     {
         return(true);
     }
     if (one.PaymentMethodID != two.PaymentMethodID)
     {
         return(true);
     }
     if (string.CompareOrdinal(one.SupplierInvoiceNumber, two.SupplierInvoiceNumber) != 0)
     {
         return(true);
     }
     if (one.TransactionDate != two.TransactionDate)
     {
         return(true);
     }
     if (one.AmountExcludingTax != two.AmountExcludingTax)
     {
         return(true);
     }
     if (one.TaxAmount != two.TaxAmount)
     {
         return(true);
     }
     if (one.TransactionAmount != two.TransactionAmount)
     {
         return(true);
     }
     if (one.OutstandingBalance != two.OutstandingBalance)
     {
         return(true);
     }
     if (one.FinalizationDate != two.FinalizationDate)
     {
         return(true);
     }
     if (one.IsFinalized != two.IsFinalized)
     {
         return(true);
     }
     if (one.LastEditedBy != two.LastEditedBy)
     {
         return(true);
     }
     if (one.LastEditedWhen != two.LastEditedWhen)
     {
         return(true);
     }
     #endregion
     return(false);
 }
        public async Task <IHttpActionResult> Put([FromODataUri] int SupplierTransactionID, SupplierTransaction item)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            if (SupplierTransactionID == item.SupplierTransactionID)
            {
                return(BadRequest());
            }

            item.ObjectState = ObjectState.Modified;
            _service.Update(item);

            try
            {
                await _unitOfWorkAsync.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ItemExists(SupplierTransactionID))
                {
                    return(NotFound());
                }
                throw;
            }

            return(Updated(item));
        }
示例#19
0
    private void FillListBoxes()
    {
        SupplierTransaction s        = new SupplierTransaction();
        DataTable           dtBrands = s.QueryBrandsByVendorId(connstring, ViewState["VendorId"].ToString().Trim());
        string vBrandIds             = "";

        for (int j = 0; j < dtBrands.Rows.Count; j++)
        {
            vBrandIds = (vBrandIds == "") ? dtBrands.Rows[j]["BrandId"].ToString().Trim() : vBrandIds + "," + dtBrands.Rows[j]["BrandId"].ToString().Trim();
        }
        hdnBrands.Text = vBrandIds.Trim();
        DataTable dtServices  = s.QueryServicesByVendorId(connstring, ViewState["VendorId"].ToString().Trim());
        string    vServiceIds = "";

        for (int j = 0; j < dtServices.Rows.Count; j++)
        {
            vServiceIds = (vServiceIds == "") ? dtServices.Rows[j]["ServiceId"].ToString().Trim() : vServiceIds + "," + dtServices.Rows[j]["ServiceId"].ToString().Trim();
        }
        hdnServices.Text = vServiceIds.Trim();
        DataTable dtLocation   = s.QueryLocationsByVendorId(connstring, ViewState["VendorId"].ToString().Trim());
        string    vLocationIds = "";

        for (int j = 0; j < dtLocation.Rows.Count; j++)
        {
            vLocationIds = (vLocationIds == "") ? dtLocation.Rows[j]["LocationId"].ToString().Trim() : vLocationIds + "," + dtLocation.Rows[j]["LocationId"].ToString().Trim();
        }
        hdnLocation.Text = vLocationIds.Trim();
        DataTable dtItem   = s.QueryItemsCarriedByVendorId(connstring, ViewState["VendorId"].ToString().Trim());
        string    vItemIds = "";

        for (int j = 0; j < dtItem.Rows.Count; j++)
        {
            vItemIds = (vItemIds == "") ? dtItem.Rows[j]["ProdItemNo"].ToString().Trim() : vItemIds + "," + dtItem.Rows[j]["ProdItemNo"].ToString().Trim();
        }
        hdnItems.Text = vItemIds.Trim();
        BrandsTransaction b = new BrandsTransaction();

        lstBrandsCarried.DataSource     = b.GetAllUnSelectedBrands(connstring, vBrandIds.Trim());
        lstBrandsCarried.DataValueField = "BrandId";
        lstBrandsCarried.DataTextField  = "BrandName";
        lstBrandsCarried.DataBind();

        lstSelectedBrandsCarried.DataSource     = b.GetAllSelectedBrands(vBrandIds.Trim());
        lstSelectedBrandsCarried.DataValueField = "BrandId";
        lstSelectedBrandsCarried.DataTextField  = "BrandName";
        lstSelectedBrandsCarried.DataBind();

        ItemsCarriedTransaction i = new ItemsCarriedTransaction();

        lstItemsCarried.DataSource     = i.GetAllUnSelectedItemsCarried(connstring, vItemIds.Trim());
        lstItemsCarried.DataValueField = "ItemNo";
        lstItemsCarried.DataTextField  = "ItemsCarried";
        lstItemsCarried.DataBind();

        lstSelectedItemsCarried.DataSource     = i.GetAllSelectedItemsCarried(vItemIds.Trim());
        lstSelectedItemsCarried.DataValueField = "ItemNo";
        lstSelectedItemsCarried.DataTextField  = "ItemsCarried";
        lstSelectedItemsCarried.DataBind();

        ServicesTransaction se = new ServicesTransaction();

        lstServicesOffered.DataSource     = se.GetAllUnSelectedServices(connstring, vServiceIds.Trim());
        lstServicesOffered.DataValueField = "ServiceId";
        lstServicesOffered.DataTextField  = "ServiceName";
        lstServicesOffered.DataBind();

        lstSelectedServicesOffered.DataSource     = se.GetAllSelectedServices(vServiceIds.Trim());
        lstSelectedServicesOffered.DataValueField = "ServiceId";
        lstSelectedServicesOffered.DataTextField  = "ServiceName";
        lstSelectedServicesOffered.DataBind();

        LocationsTransaction lo = new LocationsTransaction();

        lstLocation.DataSource     = lo.GetAllUnSelectedLocations(connstring, vLocationIds.Trim());
        lstLocation.DataValueField = "LocationId";
        lstLocation.DataTextField  = "LocationName";
        lstLocation.DataBind();

        lstSelectedLocation.DataSource     = lo.GetAllSelectedLocations(vLocationIds.Trim());
        lstSelectedLocation.DataValueField = "LocationId";
        lstSelectedLocation.DataTextField  = "LocationName";
        lstSelectedLocation.DataBind();
    }
示例#20
0
    private void FillCategoriesSubCategories()
    {
        SupplierTransaction st         = new SupplierTransaction();
        DataSet             ds         = st.QueryCategoryAndSubCategory(connstring, ViewState["VendorId"].ToString().Trim());
        string strcategory             = "";
        string strcategorynoapostrophe = ""; //for general purposes
        string strsubcategory          = "";

        if (ds.Tables.Count > 0)
        {
            if (ds.Tables[0] != null)
            {
                DataTable dtCategory = ds.Tables[0];
                if (dtCategory.Rows.Count > 0)
                {
                    for (int i = 0; i < dtCategory.Rows.Count; i++)
                    {
                        strcategory             = (strcategory == "" ? "'" + dtCategory.Rows[i]["CategoryId"].ToString() + "'" : strcategory + ",'" + dtCategory.Rows[i]["CategoryId"].ToString() + "'");
                        strcategorynoapostrophe = (strcategorynoapostrophe == "" ? dtCategory.Rows[i]["CategoryId"].ToString() : strcategorynoapostrophe + "," + dtCategory.Rows[i]["CategoryId"].ToString());
                    }
                }
            }
            if (ds.Tables[1] != null)
            {
                DataTable dtSubCategory = ds.Tables[1];
                if (dtSubCategory.Rows.Count > 0)
                {
                    for (int i = 0; i < dtSubCategory.Rows.Count; i++)
                    {
                        strsubcategory = (strsubcategory == "" ? dtSubCategory.Rows[i]["SubCategoryId"].ToString() : strsubcategory + "," + dtSubCategory.Rows[i]["SubCategoryId"].ToString());
                    }
                }
            }
        }
        //for general purposes
        hdnCategories.Text  = strcategorynoapostrophe.Trim();
        hdnSubCategory.Text = strsubcategory.Trim();


        SupplierTransaction su  = new SupplierTransaction();
        DataSet             ds1 = su.QuerySelectedAndUnselectedCategories(connstring, strcategory.Trim());

        if (strcategory != "")
        {
            if (ds1.Tables.Count > 0)
            {
                if (ds1.Tables[0] != null)
                {
                    DataTable selectedcategories = ds1.Tables[0];
                    lstSelectedCategories.DataSource     = selectedcategories;
                    lstSelectedCategories.DataTextField  = "CategoryName";
                    lstSelectedCategories.DataValueField = "CategoryId";
                    lstSelectedCategories.DataBind();
                }
                if (ds1.Tables.Count == 2)
                {
                    if (ds1.Tables[1] != null)
                    {
                        DataTable availcategories = ds1.Tables[1];
                        lstCategories.DataSource     = availcategories;
                        lstCategories.DataTextField  = "CategoryName";
                        lstCategories.DataValueField = "CategoryId";
                        lstCategories.DataBind();
                    }
                }
            }
        }
        else
        {
            if (ds1.Tables.Count > 0)
            {
                DataTable availcategories = ds1.Tables[0];
                lstCategories.DataSource     = availcategories;
                lstCategories.DataTextField  = "CategoryName";
                lstCategories.DataValueField = "CategoryId";
                lstCategories.DataBind();
            }
        }
        if (strsubcategory.Trim() != "")
        {
            //SupplierTransaction su = new SupplierTransaction();
            DataSet ds2 = su.QuerySelectedAndUnselectedSubCategories(connstring, strsubcategory.Trim(), strcategory.Trim());
            if (ds2.Tables.Count > 0)
            {
                if (ds2.Tables[0] != null)
                {
                    DataTable selectedsubcategories = ds2.Tables[0];
                    lstSelectedSubCategories.DataSource     = selectedsubcategories;
                    lstSelectedSubCategories.DataTextField  = "SubCategoryName";
                    lstSelectedSubCategories.DataValueField = "SubCategoryId";
                    lstSelectedSubCategories.DataBind();
                }
                if (ds2.Tables[1] != null)
                {
                    DataTable availsubcategories = ds2.Tables[1];
                    lstSubCategory.DataSource     = availsubcategories;
                    lstSubCategory.DataTextField  = "SubCategoryName";
                    lstSubCategory.DataValueField = "SubCategoryId";
                    lstSubCategory.DataBind();
                }
            }
        }
    }
示例#21
0
    private void DisplayOthers()
    {
        //string connstring = HttpContext.Current.Session["ConnectionString"].ToString();

        SupplierTransaction st = new SupplierTransaction();
        Supplier            s  = st.QuerySuppliers(connstring, ViewState[Constant.SESSION_USERID].ToString().Trim());

        SqlParameter[] sqlParams = new SqlParameter[1];
        sqlParams[0]       = new SqlParameter("@SupplierTypeId", SqlDbType.Int);
        sqlParams[0].Value = Int32.Parse(s.Accredited.Trim());

        lblSupplierType.Text = SqlHelper.ExecuteScalar(connstring, CommandType.StoredProcedure, "s3p_EBid_GetSupplierType", sqlParams).ToString().Trim();

        //to be updated when rfcCategory is finalized
        //  lblCategory.Text = s.VendorCategory.Trim();
        //  lblSubCategory.Text = s.VendorSubCategory.Trim();

        switch (s.PCABClass.Trim())
        {
        case "1":
            lblPCABClass.Text = "A";
            break;

        case "2":
            lblPCABClass.Text = "AA";
            break;

        case "3":
            lblPCABClass.Text = "AAA";
            break;

        case "4":
            lblPCABClass.Text = "B";
            break;

        case "5":
            lblPCABClass.Text = "C";
            break;

        case "6":
            lblPCABClass.Text = "D";
            break;
        }


        switch (s.ISOStandard.Trim())
        {
        case "01":
            lblISOStandard.Text = "ISO 9002";
            break;

        case "10":
            lblISOStandard.Text = "ISO 9001";
            break;

        case "11":
            lblISOStandard.Text = "ISO 9001<br />ISO 9002";
            break;
        }

        gvBrands.DataSource = st.QueryBrandsByVendorId(connstring, ViewState[Constant.SESSION_USERID].ToString().Trim());
        gvBrands.DataBind();

        gvItems.DataSource = st.QueryItemsCarriedByVendorId(connstring, ViewState[Constant.SESSION_USERID].ToString().Trim());
        gvItems.DataBind();

        gvLocations.DataSource = st.QueryLocationsByVendorId(connstring, ViewState[Constant.SESSION_USERID].ToString().Trim());
        gvLocations.DataBind();

        gvServices.DataSource = st.QueryServicesByVendorId(connstring, ViewState[Constant.SESSION_USERID].ToString().Trim());
        gvServices.DataBind();
    }
示例#22
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            FormsAuthenticationHelper.AuthenticateUserWithReturnUrl();
            connstring = Client.ConnectionString(HttpContext.Current.Session["clientid"].ToString());
            if (Int32.Parse(Session[Constant.SESSION_USERTYPE].ToString().Trim()) != (int)Constant.USERTYPE.BUYER)
            {
                Response.Redirect("../unauthorizedaccess.aspx");
            }


            if (!(Page.IsPostBack))
            {
                if (Session["BidRefNo"] != null)
                {
                    hdnBidRefNo.Value = Session["BidRefNo"].ToString().Trim();
                    BidItem                 bid      = BidItemTransaction.QueryBidItemInfo(connstring, hdnBidRefNo.Value.Trim());
                    BuyerTransaction        buyer    = new BuyerTransaction();
                    CategoryTransaction     category = new CategoryTransaction();
                    GroupDeptSecTransaction grp      = new GroupDeptSecTransaction();
                    CompanyTransaction      cmp      = new CompanyTransaction();
                    SupplierTransaction     vnd      = new SupplierTransaction();
                    IncotermTransaction     inc      = new IncotermTransaction();
                    OtherTransaction        dte      = new OtherTransaction();

                    lblCompany.Text               = cmp.GetCompanyName(connstring, bid.CompanyId.ToString().Trim());
                    lblRequestor.Text             = bid.Requestor.ToString().Trim();
                    lblPRNumber.Text              = bid.PRRefNo.ToString().Trim();
                    lblPRDate.Text                = bid.PRDate.ToString().Trim();
                    lblGroup.Text                 = grp.GetGroupDeptSecNameById(connstring, bid.GroupDeptSec.ToString().Trim());
                    lblBidReferenceNo.Text        = bid.BidRefNo.ToString().Trim();
                    lblSubCategory.Text           = category.GetCategoryNameById(connstring, bid.Category.ToString().Trim());
                    lblBidSubmissionDeadline.Text = bid.Deadline.ToString().Trim();
                    lblBidItemDescription.Text    = bid.ItemDescription.ToString().Trim();
                    lblDeliverTo.Text             = bid.DeliverTo.ToString().Trim();
                    lblIncoterm.Text              = inc.GetIncotermName(connstring, bid.Incoterm.ToString().Trim());
                    lblBidRefNo2.Text             = bid.BidRefNo.ToString().Trim();

                    FillBidItemDetails();
                    //no checking because when bids are submitted they have suppliers
                    gvSuppliers.DataSource = BidItemTransaction.GetSuppliers(connstring, hdnBidRefNo.Value.Trim());
                    gvSuppliers.DataBind();

                    //DataTable dtFileAttachment = new DataTable();
                    //DataColumn dcol1 = new DataColumn("FILES", typeof(System.String));
                    //dtFileAttachment.Columns.Add(dcol1);

                    //string Files = bid.FileAttachments;
                    //string[] Files1 = Files.Split(Convert.ToChar("|"));

                    //for (int i = 0; i < Files1.Length; i++)
                    //{
                    //    //Create a new row
                    //    DataRow drow = dtFileAttachment.NewRow();
                    //    drow["FILES"] = Files1[i];
                    //    dtFileAttachment.Rows.Add(drow);
                    //}

                    //gvFileAttachments.DataSource = dtFileAttachment;
                    //gvFileAttachments.DataBind();
                }
                else
                {
                    Response.Redirect("index.aspx");
                }
            }
        }
示例#23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        FormsAuthenticationHelper.AuthenticateUserWithReturnUrl();
        connstring = Client.ConnectionString(HttpContext.Current.Session["clientid"].ToString());
        if (Int32.Parse(Session[Constant.SESSION_USERTYPE].ToString().Trim()) != (int)Constant.USERTYPE.BUYER)
        {
            Response.Redirect("../unauthorizedaccess.aspx");
        }

        if (!(Page.IsPostBack))
        {
            if (Session["VendorId"] != null)
            {
                ViewState["VendorId"] = Session["VendorId"].ToString().Trim();
                SupplierTransaction st = new SupplierTransaction();
                Supplier            s  = st.QuerySuppliers(connstring, ViewState["VendorId"].ToString().Trim());
                lblCompanyName.Text       = s.VendorName.Trim();
                lblAddressHeadOffice.Text = s.VendorAddress.Trim() + " " + s.VendorAddress1.Trim();
                lblTelephone.Text         = s.TelephoneNumber.Trim();
                lblFax.Text                        = s.Fax.Trim();
                lblExtension.Text                  = s.Extension.Trim();
                lblAddressBranch.Text              = s.VendorAddress2.Trim() + " " + s.VendorAddress3.Trim();
                lblTelephone1.Text                 = s.BranchTelephoneNo.Trim();
                lblFax1.Text                       = s.BranchFax.Trim();
                lblExtension1.Text                 = s.BranchExtension.Trim();
                lblVatRegNo.Text                   = s.VatRegNo.Trim();
                lblTin.Text                        = s.TIN.Trim();
                lblPOBox.Text                      = s.POBOX.Trim();
                lblPostalCode.Text                 = s.PostalCode.Trim();
                lblEmail.Text                      = s.VendorEmail.Trim();
                lblStandardTerms.Text              = s.TermsOfPayment.Trim();
                lblSpecialTerms.Text               = s.SpecialTerms.Trim();
                lblMinimumOrderValue.Text          = s.MinOrderValue.Trim();
                lblSalesPerson.Text                = s.ContactPerson.Trim();
                lblTelephone2.Text                 = s.SalesPersonTelNo.Trim();
                lblTypeOfBusinessOrganization.Text = s.OrgTypeId;
                lblFilipino.Text                   = s.OwnershipFilipino.Trim();
                lblOtherNationality.Text           = s.OwnershipOther.Trim();
                lblCompanyClassification.Text      = "";
                lblSoleSupplier.Text               = s.SoleSupplier1.Trim() + " " + s.SoleSupplier2.Trim();
                lblSpecialization.Text             = s.Specialization.Trim();

                SupplierType sut = new SupplierType();
                lblSupplierType.Text = sut.GetSupplierType(connstring, s.Accredited.Trim());
                PCABClassTransaction pcab = new PCABClassTransaction();
                lblPCABClass.Text = pcab.GetPCABClasName(connstring, s.PCABClass.Trim());
                switch (s.ISOStandard.Trim())
                {
                case "01":
                    lblISOStandard.Text = "ISO 9002";
                    break;

                case "10":
                    lblISOStandard.Text = "ISO 9001";
                    break;

                case "11":
                    lblISOStandard.Text = "ISO 9001<br />ISO 9002";
                    break;
                }

                DataSet ds             = st.QueryCategoryAndSubCategory(connstring, ViewState["VendorId"].ToString().Trim());
                string  strcategory    = "";
                string  strsubcategory = "";

                if (ds.Tables.Count > 0)
                {
                    if (ds.Tables[0] != null)
                    {
                        DataTable dtCategory = ds.Tables[0];
                        if (dtCategory.Rows.Count > 0)
                        {
                            for (int i = 0; i < dtCategory.Rows.Count; i++)
                            {
                                strcategory = (strcategory == "" ? dtCategory.Rows[i]["CategoryName"].ToString() : strcategory + "<br />" + dtCategory.Rows[i]["CategoryName"].ToString());
                            }
                        }
                    }
                    if (ds.Tables[1] != null)
                    {
                        DataTable dtSubCategory = ds.Tables[1];
                        if (dtSubCategory.Rows.Count > 0)
                        {
                            for (int i = 0; i < dtSubCategory.Rows.Count; i++)
                            {
                                strsubcategory = (strsubcategory == "" ? dtSubCategory.Rows[i]["CompleteName"].ToString() : strsubcategory + "<br />" + dtSubCategory.Rows[i]["CompleteName"].ToString());
                            }
                        }
                    }
                }
                lblCategory.Text    = strcategory;
                lblSubCategory.Text = strsubcategory;



                gvKeyPersonnel.DataSource = CreateKeyPersonell(s.KeyPersonnel.Trim(), s.KeyPosition.Trim());
                gvKeyPersonnel.DataBind();

                gvPresentServices.DataSource = st.QueryPresentServices(connstring, ViewState["VendorId"].ToString().Trim());
                gvPresentServices.DataBind();

                DataTable dt = st.QueryMajorCustomers(connstring, ViewState["VendorId"].ToString().Trim());
                if (dt.Rows.Count == 0)
                {
                    dt = CreateEmptyMajorCustomers();
                }
                gvMajorCustomers.DataSource = dt;
                gvMajorCustomers.DataBind();

                dt = st.QueryBanks(connstring, ViewState["VendorId"].ToString().Trim());
                if (dt.Rows.Count == 0)
                {
                    dt = CreateEmptyBanks();
                }
                gvBanks.DataSource = dt;
                gvBanks.DataBind();


                dt = st.QueryAffiliatedCompanies(connstring, ViewState["VendorId"].ToString().Trim());
                if (dt.Rows.Count == 0)
                {
                    dt = CreateEmptyAffiliatedCompanies();
                }
                gvAffiliatedCompanies.DataSource = dt;
                gvAffiliatedCompanies.DataBind();

                dt = st.QueryExternalAuditors(connstring, ViewState["VendorId"].ToString().Trim());
                if (dt.Rows.Count == 0)
                {
                    dt = CreateEmptyExternalAuditor();
                }
                gvExternalAuditors.DataSource = dt;
                gvExternalAuditors.DataBind();

                dt = st.QueryEquipment(connstring, ViewState["VendorId"].ToString().Trim());
                if (dt.Rows.Count == 0)
                {
                    dt = CreateEmptyEquipment();
                }
                gvEquipment.DataSource = dt;
                gvEquipment.DataBind();

                dt = st.QueryRelatives(connstring, ViewState["VendorId"].ToString().Trim());
                if (dt.Rows.Count == 0)
                {
                    dt = CreateEmptyRelativesTable();
                }
                gvRelatives.DataSource = dt;
                gvRelatives.DataBind();

                DataTable dtBrands = st.QueryBrandsByVendorId(connstring, Session["VendorId"].ToString().Trim());
                gvBrands.DataSource = dtBrands;
                gvBrands.DataBind();

                DataTable dtItems = st.QueryItemsCarriedByVendorId(connstring, Session["VendorId"].ToString().Trim());
                gvItems.DataSource = dtItems;
                gvItems.DataBind();

                DataTable dtLocations = st.QueryLocationsByVendorId(connstring, Session["VendorId"].ToString().Trim());
                gvLocations.DataSource = dtLocations;
                gvLocations.DataBind();

                DataTable dtServices = st.QueryServicesByVendorId(connstring, Session["VendorId"].ToString().Trim());
                gvServices.DataSource = dtServices;
                gvServices.DataBind();
            }
            else
            {
                Response.Redirect("suppliers.aspx");
            }
        }
    }
示例#24
0
        private void DisplayAvailableAndSelectedSuppliers()
        {
            if (hdnCategoryId.Value.Trim() != "")
            {
                CategoryTransaction cat = new CategoryTransaction();
                lblSupplierCategory.Text = cat.GetCategoryNameById(connstring, hdnCategoryId.Value.Trim());

                string allSelectedVendors = "";
                if (hdnSuppliers.Value.Trim() == "")
                {
                    if (hdnOTS.Value.Trim() == "")
                    {
                        allSelectedVendors = "";
                    }
                    else
                    {
                        allSelectedVendors = hdnOTS.Value.Trim();
                    }
                }
                else
                if (hdnOTS.Value.Trim() == "")
                {
                    allSelectedVendors = hdnSuppliers.Value.Trim();
                }
                else
                {
                    allSelectedVendors = hdnSuppliers.Value.Trim() + "," + hdnOTS.Value.Trim();
                }

                SupplierTransaction sup         = new SupplierTransaction();
                DataSet             ds          = sup.GetSuppliersByCategoryId_FilteredList(connstring, hdnCategoryId.Value.Trim(), "", allSelectedVendors);
                DataTable           dtAvailable = new DataTable();
                DataTable           dtSelected  = new DataTable();
                if (ds.Tables.Count > 0)
                {
                    try
                    {
                        if (ds.Tables[0] != null)
                        {
                            dtAvailable = ds.Tables[0];
                        }
                        if (ds.Tables.Count > 1)
                        {
                            if (ds.Tables[1] != null)
                            {
                                dtSelected = ds.Tables[1];
                            }
                        }
                    }
                    catch
                    {
                    }
                }
                lstSupplierA.DataSource     = dtAvailable;
                lstSupplierA.DataTextField  = "VendorName";
                lstSupplierA.DataValueField = "VendorId";
                lstSupplierA.DataBind();

                lstSupplierB.DataSource     = dtSelected;
                lstSupplierB.DataTextField  = "VendorName";
                lstSupplierB.DataValueField = "VendorId";
                lstSupplierB.DataBind();
            }
        }
示例#25
0
    private void SaveSupplierData()
    {
        string vSuppliertype = "", vCategory = "", vSubcategory = "", vCompanyname = "", vHeadaddress1 = "",
               vHeadaddress2 = "", vHeadtel = "", vHeadtelext = "", vHeadfax = "", vBranchaddress1 = "", vBranchaddress2 = "",
               vBranchtel = "", vBranchtelext = "", vBranchfax = "", vVatregno = "", vTin = "", vPobox = "", vPostalcode = "", vEmail = "",
               vStandardtermsofpayment = "", vSpecialterms = "", vMinimumordervalue = "", vSalesperson = "", vSalespersontelephone = "",
               vTypeofbusinessorganization = "", vOwnershipFilipino = "", vOwnershipOther = "", vCompanyclassification = "", vSolesupplierline1 = "", vSolesupplierline2 = "",
               vSpecialization = "", vKeyPersonnel = "", vKeyPosition = "";

        DataTable dtPresentServices     = new DataTable();
        DataTable dtMajorCustomers      = new DataTable();
        DataTable dtAffiliatedCompanies = new DataTable();
        DataTable dtBanks               = new DataTable();
        DataTable dtExternalAuditors    = new DataTable();
        DataTable dtRelatives           = new DataTable();
        DataTable dtEquipment           = new DataTable();


        ReadFromXMLFile(ref vSuppliertype, ref vCategory, ref vSubcategory, ref vCompanyname, ref vHeadaddress1,
                        ref vHeadaddress2, ref vHeadtel, ref vHeadtelext, ref vHeadfax, ref vBranchaddress1, ref vBranchaddress2,
                        ref vBranchtel, ref vBranchtelext, ref vBranchfax, ref vVatregno, ref vTin, ref vPobox, ref vPostalcode, ref vEmail,
                        ref vStandardtermsofpayment, ref vSpecialterms, ref vMinimumordervalue, ref vSalesperson, ref vSalespersontelephone,
                        ref vTypeofbusinessorganization, ref vOwnershipFilipino, ref vOwnershipOther, ref vCompanyclassification, ref vSolesupplierline1, ref vSolesupplierline2,
                        ref vSpecialization, ref vKeyPersonnel, ref vKeyPosition, ref dtPresentServices, ref dtMajorCustomers, ref dtAffiliatedCompanies,
                        ref dtBanks, ref dtExternalAuditors, ref dtEquipment, ref dtRelatives);

        SupplierTransaction s = new SupplierTransaction();

        if (!s.VendorExists(connstring, vCompanyname.Trim()))
        {
            OtherTransaction oth       = new OtherTransaction();
            string           vUserName = vCompanyname.Replace(" ", "");
            if (vUserName.Length > 8)
            {
                vUserName = vUserName.Substring(0, 8).ToUpper();
            }
            else
            {
                vUserName = vUserName.ToUpper();
            }

            bool IsValidUserName = s.CheckUser(connstring, vUserName.Trim());

            while (!IsValidUserName)
            {
                int ctr = 0;
                vUserName       = vUserName + ctr.ToString().Trim();
                IsValidUserName = s.CheckUser(connstring, vUserName.Trim());
            }
            if (IsValidUserName)
            {
                Session["VendorId"] = s.InsertUser(connstring, vUserName, EncryptionHelper.Encrypt(vUserName), ((int)Constant.USERTYPE.VENDOR).ToString().Trim());
            }
            if (Session["VendorId"].ToString().Trim() != "-1")
            {
                s.RegisterSupplier(connstring, Session["VendorId"].ToString().Trim(), vCompanyname, vSuppliertype, vEmail, vHeadaddress1, vHeadaddress2, vBranchaddress1,
                                   vBranchaddress2, vSalesperson, vSalespersontelephone, "",
                                   vHeadtel, vHeadfax, vHeadtelext, vBranchtel, vBranchfax, vBranchtelext, vVatregno,
                                   vTin, vPobox, vStandardtermsofpayment, vSpecialterms, vMinimumordervalue, vPostalcode,
                                   vOwnershipFilipino, vOwnershipOther, vTypeofbusinessorganization, vSpecialization, vSolesupplierline1,
                                   vSolesupplierline2, vKeyPersonnel, vKeyPosition, GetISOStandard(),
                                   ddlPCABClass.SelectedItem.Value.Trim());

                string[] VendorSubCategory = vSubcategory.Split(Convert.ToChar(","));
                s.InsertSubCategory(connstring, Session["VendorId"].ToString().Trim(), VendorSubCategory);
                string[] VendorCategory = vCategory.Split(Convert.ToChar(","));
                s.InsertCategory(connstring, Session["VendorId"].ToString().Trim(), VendorCategory);
                string[] VendorClassifiction = vCompanyclassification.Split(Convert.ToChar(","));
                s.InsertVendorClassification(connstring, Session["VendorId"].ToString().Trim(), VendorClassifiction);
                s.InsertPresentServices(connstring, Session["VendorId"].ToString().Trim(), dtPresentServices);
                s.InsertMajorCustomers(connstring, Session["VendorId"].ToString().Trim(), dtMajorCustomers);
                s.InsertBanks(connstring, Session["VendorId"].ToString().Trim(), dtBanks);
                s.InsertAffiliatedCompanies(connstring, Session["VendorId"].ToString().Trim(), dtAffiliatedCompanies);
                s.InsertExternalAuditors(Session["VendorId"].ToString().Trim(), dtExternalAuditors);

                s.InsertEquipment(connstring, Session["VendorId"].ToString().Trim(), dtEquipment);
                s.InsertRelative(connstring, Session["VendorId"].ToString().Trim(), dtRelatives);

                s.InsertBrandsMain(connstring, Session["VendorId"].ToString().Trim(), hdnBrands.Text.Trim());
                s.InsertItemsCarriedMain(connstring, Session["VendorId"].ToString().Trim(), hdnItems.Text.Trim());
                s.InsertServicesOfferedMain(connstring, Session["VendorId"].ToString().Trim(), hdnServices.Text.Trim());
                s.InsertLocationMain(connstring, Session["VendorId"].ToString().Trim(), hdnLocation.Text.Trim());
                Session["XMLFile"] = null;
                Response.Redirect("supplierdetails.aspx");
            }
            else
            {
                lblMessage.Text = "Error in inserting user.";
            }
        }
        else
        {
            lblMessage.Text = "Supplier already exists.";
        }
    }
示例#26
0
        /// <summary>
        /// Get a list of QueryFilter that represent changed fields.
        /// </summary>
        /// <param name="original">Original Entity. The unchanged entity.</param>
        /// <param name="changed">Changed Entity. The entity holding the changed fields.</param>
        /// <returns>QueryFilters of SupplierTransactionProperty</returns>
        public static QueryFilters <SupplierTransactionProperty> GetChanges(SupplierTransaction original, SupplierTransaction changed)
        {
            // this method returns a list of changes.
            var changes = new QueryFilters <SupplierTransactionProperty>(15);

            #region Detect Changes
            if (original.SupplierTransactionID != changed.SupplierTransactionID)
            {
                changes.Add(QueryFilter.New(SupplierTransactionProperty.SupplierTransactionID, FilterConditions.Equals, changed.SupplierTransactionID));
            }
            if (original.SupplierID != changed.SupplierID)
            {
                changes.Add(QueryFilter.New(SupplierTransactionProperty.SupplierID, FilterConditions.Equals, changed.SupplierID));
            }
            if (original.TransactionTypeID != changed.TransactionTypeID)
            {
                changes.Add(QueryFilter.New(SupplierTransactionProperty.TransactionTypeID, FilterConditions.Equals, changed.TransactionTypeID));
            }
            if (original.PurchaseOrderID != changed.PurchaseOrderID)
            {
                changes.Add(QueryFilter.New(SupplierTransactionProperty.PurchaseOrderID, FilterConditions.Equals, changed.PurchaseOrderID));
            }
            if (original.PaymentMethodID != changed.PaymentMethodID)
            {
                changes.Add(QueryFilter.New(SupplierTransactionProperty.PaymentMethodID, FilterConditions.Equals, changed.PaymentMethodID));
            }
            if (string.CompareOrdinal(original.SupplierInvoiceNumber, changed.SupplierInvoiceNumber) != 0)
            {
                changes.Add(QueryFilter.New(SupplierTransactionProperty.SupplierInvoiceNumber, FilterConditions.Equals, changed.SupplierInvoiceNumber));
            }
            if (original.TransactionDate != changed.TransactionDate)
            {
                changes.Add(QueryFilter.New(SupplierTransactionProperty.TransactionDate, FilterConditions.Equals, changed.TransactionDate));
            }
            if (original.AmountExcludingTax != changed.AmountExcludingTax)
            {
                changes.Add(QueryFilter.New(SupplierTransactionProperty.AmountExcludingTax, FilterConditions.Equals, changed.AmountExcludingTax));
            }
            if (original.TaxAmount != changed.TaxAmount)
            {
                changes.Add(QueryFilter.New(SupplierTransactionProperty.TaxAmount, FilterConditions.Equals, changed.TaxAmount));
            }
            if (original.TransactionAmount != changed.TransactionAmount)
            {
                changes.Add(QueryFilter.New(SupplierTransactionProperty.TransactionAmount, FilterConditions.Equals, changed.TransactionAmount));
            }
            if (original.OutstandingBalance != changed.OutstandingBalance)
            {
                changes.Add(QueryFilter.New(SupplierTransactionProperty.OutstandingBalance, FilterConditions.Equals, changed.OutstandingBalance));
            }
            if (original.FinalizationDate != changed.FinalizationDate)
            {
                changes.Add(QueryFilter.New(SupplierTransactionProperty.FinalizationDate, FilterConditions.Equals, changed.FinalizationDate));
            }
            if (original.IsFinalized != changed.IsFinalized)
            {
                changes.Add(QueryFilter.New(SupplierTransactionProperty.IsFinalized, FilterConditions.Equals, changed.IsFinalized));
            }
            if (original.LastEditedBy != changed.LastEditedBy)
            {
                changes.Add(QueryFilter.New(SupplierTransactionProperty.LastEditedBy, FilterConditions.Equals, changed.LastEditedBy));
            }
            if (original.LastEditedWhen != changed.LastEditedWhen)
            {
                changes.Add(QueryFilter.New(SupplierTransactionProperty.LastEditedWhen, FilterConditions.Equals, changed.LastEditedWhen));
            }
            #endregion
            return(changes.Count > 0 ? changes : null);
        }