Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     ProcessLogFileName = @"Excel\" + Session["UserName"].ToString() + "ProcessLog.txt";
     if (!Page.IsPostBack)
     {
         //RunByLabel.Text = Session["UserName"].ToString();
         CatBegTextBox.Focus();
         btnAccept.Visible        = false;
         ProcessPanel.Visible     = false;
         ActionPanel.Visible      = false;
         ActionSubmitButt.Visible = false;
         PrintButt.Visible        = false;
         SKUPanel.Visible         = false;
         FactorPrompt.Visible     = false;
         CPRFactor.Text           = "1";
         Session["PageOp"]        = "";
         string FullFilePath = Server.MapPath(ProcessLogFileName);
         using (StreamWriter sw = new StreamWriter(FullFilePath))
         {
             sw.WriteLine("Branch Stocking Analysis started at " + DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString());
         }
         LoadBranches();
     }
     else
     {
         SKUPanel.Height    = int.Parse(yh.Text.ToString()) - 90;
         ActionPanel.Height = int.Parse(yh.Text.ToString()) - 90;
         ResultsUpdatePanel.Update();
     }
     ScriptManager1.AsyncPostBackTimeout = 1200;
     //ScriptManager1.SetFocus(CatBegTextBox);
     ScriptManager1.RegisterAsyncPostBackControl(BranchListButt);
     //lblErrorMessage.Text = Session["PageOp"];
 }
Exemplo n.º 2
0
 protected void ItemSearchButt_Click(object sender, ImageClickEventArgs e)
 {
     BindSKUGrid();
     ResultsUpdatePanel.Update();
     CatBegTextBox.Focus();
     FactorPrompt.Visible = false;
     //FindUpdatePanel.Update();
 }
Exemplo n.º 3
0
 public void ClearBranches(Object sender, EventArgs e)
 {
     if (Session["BranchTable"] != null)
     {
         try
         {
             dt = (DataTable)Session["BranchTable"];
             dt.Rows.Clear();
             BranchGrid.DataSource = dt;
             BranchGrid.DataBind();
             Session["BranchTable"] = dt;
         }
         catch { };
     }
     CatBegTextBox.Focus();
 }
Exemplo n.º 4
0
 protected void BranchCommand(object source, GridViewCommandEventArgs e)
 {
     ClearPageMessages();
     CatBegTextBox.Focus();
     dt = (DataTable)Session["BranchTable"];
     if (e.CommandName == "Del")
     {
         int    index          = Convert.ToInt32(e.CommandArgument);
         string BranchToRemove = BranchGrid.Rows[index].Cells[0].Text;
         dt.Rows.RemoveAt(index);
         BranchGrid.DataSource = dt;
         BranchGrid.DataBind();
         Session["BranchTable"] = dt;
     }
     if (e.CommandName == "Hub")
     {
         int     index = Convert.ToInt32(e.CommandArgument);
         DataRow drow  = dt.Rows[index];
         drow["IsHub"]         = !(Boolean)drow["IsHub"];
         BranchGrid.DataSource = dt;
         BranchGrid.DataBind();
         Session["BranchTable"] = dt;
     }
     if (e.CommandName == "MoveUp")
     {
         int index = Convert.ToInt32(e.CommandArgument);
         if (index > 0)
         {
             DataRow drow1  = dt.Rows[index];
             int     oldKey = (int)drow1["SortKey"];
             DataRow drow2  = dt.Rows[index - 1];
             drow1["SortKey"] = drow2["SortKey"];
             drow2["SortKey"] = oldKey;
             DataView dv = new DataView(dt, "", "SortKey", DataViewRowState.CurrentRows);
             dt = dv.ToTable();
         }
         BranchGrid.DataSource = dt;
         BranchGrid.DataBind();
         Session["BranchTable"] = dt;
     }
     if (e.CommandName == "MoveDown")
     {
         int index = Convert.ToInt32(e.CommandArgument);
         if (index < dt.Rows.Count - 1)
         {
             DataRow drow1  = dt.Rows[index];
             int     oldKey = (int)drow1["SortKey"];
             DataRow drow2  = dt.Rows[index + 1];
             drow1["SortKey"] = drow2["SortKey"];
             drow2["SortKey"] = oldKey;
             DataView dv = new DataView(dt, "", "SortKey", DataViewRowState.CurrentRows);
             dt = dv.ToTable();
         }
         BranchGrid.DataSource = dt;
         BranchGrid.DataBind();
         Session["BranchTable"] = dt;
     }
     if (e.CommandName == "AddToList")
     {
         int     index   = Convert.ToInt32(e.CommandArgument);
         DataRow workRow = dt.NewRow();
         workRow["Code"] = LoaderGrid.Rows[index].Cells[0].Text;
         workRow["Name"] = LoaderGrid.Rows[index].Cells[1].Text;
         if (dt.Select("Code = '" + workRow["Code"] + "'").Length == 0)
         {
             if (LoaderGrid.Rows[index].Cells[2].Text == "True")
             {
                 workRow["Hub"]   = 1;
                 workRow["IsHub"] = true;
             }
             else
             {
                 workRow["Hub"]   = 0;
                 workRow["IsHub"] = false;
             }
             if (dt.Rows.Count == 0)
             {
                 workRow["SortKey"] = 10000;
             }
             else
             {
                 workRow["SortKey"] = (int)dt.Rows[dt.Rows.Count - 1]["SortKey"] * 10000;
             }
             dt.Rows.Add(workRow);
             BranchGrid.DataSource = dt;
             BranchGrid.DataBind();
             Session["BranchTable"] = dt;
         }
         else
         {
             lblErrorMessage.Text = "Branch " + workRow["Code"].ToString() + " is already in the list";
         }
     }
 }
Exemplo n.º 5
0
 public void AddAllBranches(Object sender, EventArgs e)
 {
     ResetBranches("Branches");
     CatBegTextBox.Focus();
 }
Exemplo n.º 6
0
    protected void UpdateItems()
    {
        string processLog = "Update results at " + DateTime.Now.ToLongTimeString() + "\n";

        btnAccept.Visible        = false;
        ActionSubmitButt.Visible = false;
        PrintButt.Visible        = false;
        string ProcessItem  = "";
        string ProcessLoc   = "";
        string ProcessState = "";
        string ProcessROP   = "";

        char[] delimiterChars = { '_' };
        int    loop1, loop2, processCtr;

        System.Collections.Specialized.NameValueCollection coll;
        processCtr = 0;
        // Scan for checked boxes.
        coll = Request.Form;
        // Put the names of all keys into a string array.
        String[] arr1 = coll.AllKeys;
        for (loop1 = 0; loop1 < arr1.Length; loop1++)
        {
            if (arr1[loop1].StartsWith("ACTSK"))
            {
                ProcessItem  = arr1[loop1].Split(delimiterChars)[1];
                ProcessLoc   = arr1[loop1].Split(delimiterChars)[2];
                ProcessState = arr1[loop1].Split(delimiterChars)[3];
                processLog  += ProcessItem + " Loc:" + ProcessLoc + " ";
                switch (ProcessState)
                {
                case "A":
                    processLog += "SVC=K, Stocked=On.";
                    break;

                case "B":
                    processLog += "SVC=N, Stocked=Off.";
                    break;

                case "C":
                    processLog += "SKU added, SVC=K, Stocked=On.";
                    break;
                }
                ProcessROP = coll[loop1 + 1];
                if (ProcessROP != "")
                {
                    processLog += " ROP = " + ProcessROP;
                }
                int result = SqlHelper.ExecuteNonQuery(connectionString, "[pSKUAnalysisUpd]",
                                                       new SqlParameter("@Item", ProcessItem),
                                                       new SqlParameter("@Loc", ProcessLoc),
                                                       new SqlParameter("@Action", ProcessState),
                                                       new SqlParameter("@NewROP", ProcessROP));
                processLog += "\n";
                processCtr++;
            }
        }
        processLog            += processCtr.ToString() + " processed.";
        ProcessLogTextBox.Text = processLog;
        // Add to Process log
        string FullFilePath = Server.MapPath(ProcessLogFileName);

        using (StreamWriter sw = new StreamWriter(FullFilePath, true))
        {
            sw.WriteLine(processLog);
        }
        SKUPanel.Visible     = false;
        ProcessPanel.Visible = true;
        //BranchPanel.Visible = true;
        ActionPanel.Visible      = false;
        ActionSubmitButt.Visible = false;
        Session["PageOp"]        = "";
        CatBegTextBox.Focus();
        if (processCtr == 0)
        {
            lblErrorMessage.Text = "You did not select any items for updating.";
        }
        //FindUpdatePanel.Update();
        //}
        //catch (Exception ex) { }
    }