Пример #1
0
        private void SaveThresholds()
        {
            HtmlInputCheckBox chkMatrixID              = null;
            HtmlInputCheckBox chkList                  = null;
            TextBox           txtBranchMinThreshold    = null;
            TextBox           txtBranchMaxThreshold    = null;
            TextBox           txtRIDBranch             = null;
            TextBox           txtRIDBranchMinThreshold = null;
            TextBox           txtRIDBranchMaxThreshold = null;
            int intBranchID = int.Parse(cboBranch.SelectedItem.Value);

            ProductInventories clsProductInventories = new ProductInventories();

            foreach (DataListItem item in lstItem.Items)
            {
                txtBranchMinThreshold    = (TextBox)item.FindControl("txtBranchMinThreshold");
                txtBranchMaxThreshold    = (TextBox)item.FindControl("txtBranchMaxThreshold");
                txtRIDBranch             = (TextBox)item.FindControl("txtRIDBranch");
                txtRIDBranchMinThreshold = (TextBox)item.FindControl("txtRIDBranchMinThreshold");
                txtRIDBranchMaxThreshold = (TextBox)item.FindControl("txtRIDBranchMaxThreshold");

                chkList     = (HtmlInputCheckBox)item.FindControl("chkList");
                chkMatrixID = (HtmlInputCheckBox)item.FindControl("chkMatrixID");
                try
                {
                    clsProductInventories.UpdateThresholds(Int32.Parse(cboBranch.SelectedItem.Value), Int64.Parse(chkList.Value), Int64.Parse(chkMatrixID.Value),
                                                           decimal.Parse(txtBranchMinThreshold.Text), decimal.Parse(txtBranchMaxThreshold.Text), Int32.Parse(txtRIDBranch.Text),
                                                           decimal.Parse(txtRIDBranchMinThreshold.Text), decimal.Parse(txtRIDBranchMaxThreshold.Text));

                    //decimal decActualQuantity = decimal.Parse(txtActualQuantity.Text);
                    //clsProductInventories.UpdateActualQuantity(intBranchID, long.Parse(chkList.Value), long.Parse(chkMatrixID.Value), decActualQuantity);
                    //txtActualQuantity.Text = Server.HtmlEncode(decActualQuantity.ToString("#,##0.#0"));
                }
                catch { }
            }
            clsProductInventories.CommitAndDispose();
            LoadList();
        }
Пример #2
0
        protected void lstItem_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e)
        {
            HtmlInputCheckBox chkList     = (HtmlInputCheckBox)e.Item.FindControl("chkList");
            HtmlInputCheckBox chkMatrixID = (HtmlInputCheckBox)e.Item.FindControl("chkMatrixID");
            string            stParam     = "?task=" + Common.Encrypt("list", Session.SessionID) +
                                            "&prodid=" + Common.Encrypt(chkList.Value, Session.SessionID);

            switch (e.CommandName)
            {
            case "imgProductTag":
            {
                ImageButton imgProductTag = (ImageButton)e.Item.FindControl("imgProductTag");
                Products    clsProduct    = new Products();

                if (imgProductTag.ToolTip == "Tag this product as INACTIVE.")
                {
                    clsProduct.TagInactive(long.Parse(chkList.Value));
                    imgProductTag.ImageUrl = Constants.ROOT_DIRECTORY + "/_layouts/images/prodtaginact.gif";
                    imgProductTag.ToolTip  = "Tag this product as ACTIVE.";
                }
                else
                {
                    clsProduct.TagActive(long.Parse(chkList.Value));
                    imgProductTag.ImageUrl = Constants.ROOT_DIRECTORY + "/_layouts/images/prodtagact.gif";
                    imgProductTag.ToolTip  = "Tag this product as INACTIVE.";
                }
                clsProduct.CommitAndDispose();
            }
            break;

            case "imgSaveThresholds":
            {
                TextBox txtBranchMinThreshold    = (TextBox)e.Item.FindControl("txtBranchMinThreshold");
                TextBox txtBranchMaxThreshold    = (TextBox)e.Item.FindControl("txtBranchMaxThreshold");
                TextBox txtRIDBranch             = (TextBox)e.Item.FindControl("txtRIDBranch");
                TextBox txtRIDBranchMinThreshold = (TextBox)e.Item.FindControl("txtRIDBranchMinThreshold");
                TextBox txtRIDBranchMaxThreshold = (TextBox)e.Item.FindControl("txtRIDBranchMaxThreshold");

                try { decimal.Parse(txtBranchMinThreshold.Text); }
                catch
                {
                    string stScript = "<Script>";
                    stScript += "window.alert('Please enter a VALID Mininum Threshold.')";
                    stScript += "</Script>";
                    Response.Write(stScript);
                    break;
                }
                try { decimal.Parse(txtBranchMaxThreshold.Text); }
                catch
                {
                    string stScript = "<Script>";
                    stScript += "window.alert('Please enter a VALID Maximum Threshold.')";
                    stScript += "</Script>";
                    Response.Write(stScript);
                    break;
                }
                try { Int32.Parse(txtRIDBranch.Text); }
                catch
                {
                    string stScript = "<Script>";
                    stScript += "window.alert('Please enter a VALID RID.')";
                    stScript += "</Script>";
                    Response.Write(stScript);
                    break;
                }
                ProductInventories clsProductInventories = new ProductInventories();
                clsProductInventories.UpdateThresholds(Int32.Parse(cboBranch.SelectedItem.Value), Int64.Parse(chkList.Value), Int64.Parse(chkMatrixID.Value),
                                                       decimal.Parse(txtBranchMinThreshold.Text), decimal.Parse(txtBranchMaxThreshold.Text), Int32.Parse(txtRIDBranch.Text),
                                                       decimal.Parse(txtRIDBranchMinThreshold.Text), decimal.Parse(txtRIDBranchMaxThreshold.Text));
                clsProductInventories.CommitAndDispose();
            }
            break;
            }
        }