示例#1
0
 private void BindStore()
 {
     DropDownListStore.DataSource     = Store.GetStoreList();
     DropDownListStore.DataTextField  = "Description";
     DropDownListStore.DataValueField = "StoreId";
     DropDownListStore.DataBind();
     DropDownListStore.Items.Insert(0, new ListItem("Please select", "0"));
 }
示例#2
0
        private void BindStoreList()
        {
            DropDownListStore.DataSource     = Store.GetStoreList();
            DropDownListStore.DataTextField  = "FormattedDescriptionLocation";
            DropDownListStore.DataValueField = "StoreId";
            DropDownListStore.DataBind();

            DropDownListStore.Items.Insert(0, new ListItem("All", "0"));
        }
        private void BindStoreList()
        {
            Account account = Account.GetAccountByUserName(Page.User.Identity.Name.ToString());

            DropDownListStore.DataSource     = Store.GetStoreListByAccountId(account.AccountId);
            DropDownListStore.DataTextField  = "Description";
            DropDownListStore.DataValueField = "StoreId";
            DropDownListStore.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            this.claimSkuId = Common.GetEncryptedQueryStringValue("ClaimSkuId", 0);
            this.storeId    = Common.GetEncryptedQueryStringValue("StoreId", 0);
            this.accountId  = Common.GetEncryptedQueryStringValue("AccountId", 0);
            this.supplier   = Common.GetEncryptedQueryStringValue("Supplier", "");

            this.accountId = (this.accountId == 0) ? (Account.GetAccountByUserName(Page.User.Identity.Name.ToString()).AccountId) : this.accountId;

            LabelPageTitle.Text = (this.claimSkuId == 0) ? "New Claim by Sku" : "Edit Claim by Sku";
            PanelError.Visible  = false;

            Page.Form.DefaultFocus  = DropDownListStore.ClientID;
            Page.Form.DefaultButton = ButtonSaveList.UniqueID;

            if (!IsPostBack)
            {
                DropDownListStore.Focus();
                BindSupplier();
                BindStore();

                if (ViewState["ClaimSkuId"] != null)
                {
                    this.claimSkuId = Convert.ToInt32(ViewState["ClaimSkuId"].ToString());
                }

                if (ViewState["StoreId"] != null)
                {
                    this.storeId = Convert.ToInt32(ViewState["StoreId"].ToString());
                }

                if (ViewState["AccountId"] != null)
                {
                    this.accountId = Convert.ToInt32(ViewState["AccountId"].ToString());
                }

                if (this.claimSkuId != 0)
                {
                    BindClaimSku();
                    BindClaimSkuCategory();
                    //FormCategorySetup();
                    BindSkuCategory();
                    PanelCaptureDate.Visible = true;
                }
                else
                {
                    PanelCaptureDate.Visible = false;
                    PanelCategory.Visible    = false;
                    ButtonDelete.Visible     = false;
                    ButtonSaveList.Visible   = false;

                    this.accountId = Account.GetAccountByUserName(Page.User.Identity.Name.ToString()).AccountId;
                }
            }
        }
        //private void BindLocationList()
        //{
        //    DropDownListLocation.DataSource = Location.GetLocationListByAccountId(Account.GetAccountByUserName(Page.User.Identity.Name.ToString()).AccountId);
        //    DropDownListLocation.DataTextField = "Description";
        //    DropDownListLocation.DataValueField = "LocationId";
        //    DropDownListLocation.DataBind();

        //    if (DropDownListLocation.Items.Count > 1)
        //    {
        //        DropDownListLocation.Items.Insert(0, new ListItem("Please select", "0"));
        //    }
        //    else
        //    {
        //        BindStore();
        //    }
        //}

        //protected void DropDownListLocation_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //    BindStore();
        //}

        private void BindRepStore()
        {
            DropDownListStore.ClearSelection();
            DropDownListStore.DataSource     = Store.GetStoreListByUserName(Page.User.Identity.Name.ToString());
            DropDownListStore.DataTextField  = "Description";
            DropDownListStore.DataValueField = "StoreId";
            DropDownListStore.DataBind();

            if (DropDownListStore.Items.Count > 1)
            {
                DropDownListStore.Items.Insert(0, new ListItem("Please select", "0"));
            }
        }
        private void BindStore()
        {
            if (Roles.IsUserInRole("RepClaim"))
            {
                BindRepStore();
                return;
            }

            //DropDownListStore.DataSource = Store.GetStoreListByLocationId(Convert.ToInt32(DropDownListLocation.SelectedValue));
            DropDownListStore.DataSource     = Store.GetStoreListByAccountId(Account.GetAccountByUserName(Page.User.Identity.Name.ToString()).AccountId);
            DropDownListStore.DataTextField  = "Description";
            DropDownListStore.DataValueField = "StoreId";
            DropDownListStore.DataBind();
            DropDownListStore.Items.Insert(0, new ListItem("Please select", "0"));
        }
示例#7
0
        private void BindClaim()
        {
            try
            {
                StoreRep.Web.Code.Claim claim = StoreRep.Web.Code.Claim.GetClaimByClaimId(this.claimId);

                /*
                 * PayStore - 0 = No
                 * PayStore - 1 = Yes
                 * PayStore - 99 = Not indicated yet
                 */
                RadioButtonPayStoreNo.Checked  = claim.PayStore == 0;
                RadioButtonPayStoreYes.Checked = claim.PayStore == 1;

                /*
                 * SupplierClaimBack - 0 = No
                 * SupplierClaimBack - 1 = Yes
                 * SupplierClaimBack - 99 = Not indicated yet
                 */
                RadioButtonClaimSupplierNo.Checked  = claim.SupplierClaimBack == 0;
                RadioButtonClaimSupplierYes.Checked = claim.SupplierClaimBack == 1;

                DropDownListSupplier.ClearSelection();
                DropDownListSupplier.Items.FindByValue(claim.ClaimSupplierId.ToString()).Selected = true;

                //BindStore();
                DropDownListStore.ClearSelection();
                DropDownListStore.Items.FindByValue(claim.StoreId.ToString()).Selected = true;

                TextBoxClaimDate.Text   = claim.FormattedClaimDateEdit.ToString();
                TextBoxClaimNumber.Text = claim.ClaimNumber;

                DropDownListClaimType.ClearSelection();
                DropDownListClaimType.Items.FindByValue(claim.ClaimTypeId.ToString()).Selected = true;

                DropDownListClaimResponsible.ClearSelection();
                DropDownListClaimResponsible.Items.FindByValue(claim.ClaimResponsibleId.ToString()).Selected = true;

                DropDownListCategory.ClearSelection();
                DropDownListCategory.Items.FindByValue(claim.ClaimSkuCategoryId.ToString()).Selected = true;
                BindClaimSkuSubCategory();
                DropDownListSubCategory.ClearSelection();
                DropDownListSubCategory.Items.FindByValue(claim.ClaimSkuSubCategoryId.ToString()).Selected = true;

                TextBoxValue.Text = claim.Value.ToString();

                //PanelQuantity.Visible = Convert.ToInt32(DropDownListClaimType.SelectedValue) == 4; //Recall

                if (Convert.ToInt32(DropDownListClaimType.SelectedValue) == 4)//Recall
                {
                    PanelBatchNumber.Visible = true;
                    TextBoxBatchNumber.Text  = claim.BatchNumber;
                }
                else
                {
                    PanelBatchNumber.Visible = true;
                    TextBoxBatchNumber.Text  = "";
                }

                TextBoxQuantity.Text = claim.Quantity.ToString();

                TextBoxComment.Text        = claim.Comment;
                TextBoxClaimReference.Text = claim.ClaimReference;

                TextBoxCaptureDate.Text = String.Format("{0:d/M/yyyy HH:mm:ss}", claim.CreatedDate);
                TextBoxCapturedBy.Text  = claim.ModifiedUser;

                if (Convert.ToInt32(DropDownListSupplier.SelectedValue) == 2) //Monteagle Africa
                {
                    PanelKeyAccount.Visible = true;
                    DropDownListKeyAccount.ClearSelection();
                    DropDownListKeyAccount.Items.FindByValue(claim.KeyAccountId.ToString()).Selected = true;
                }
                else
                {
                    PanelKeyAccount.Visible = false;
                }

                BindClaimTypeSelection();
            }
            catch (System.Data.SqlClient.SqlException sqlEx)
            {
                for (int i = 0; i < sqlEx.Errors.Count; i++)
                {
                    LabelError.Text += (sqlEx.Errors[i].Message + "<br />");
                }
                PanelError.Visible = true;
            }
            catch (Exception exception)
            {
                LabelError.Text   += (exception.Message + "<br />");
                PanelError.Visible = true;
            }
        }