예제 #1
0
 protected void gvItems_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName.Equals("Edit"))
     {
         int         inx = int.Parse((string)e.CommandArgument);
         GridViewRow row = gvItems.Rows[inx];
         gvItems.EditIndex = inx;
         DropDownList ddl = (DropDownList)row.FindControl("ddlAct");
         if (ddl != null)
         {
             ddl.DataSource = _actions;
             string sv = ddl.SelectedValue;
             if (_itemHashTable == null)
             {
                 _itemHashTable = new Hashtable();
             }
             if (_itemHashTable.ContainsKey(inx))
             {
                 _itemHashTable.Remove(inx);
             }
             _ReturnAction act = new _ReturnAction();
             act.actionCode  = sv;
             act.actionDescr = ddl.SelectedItem.Text;
             _itemHashTable.Add(inx, act);
             ViewState["itemsprocessed"] = _itemHashTable;
         }
         gvItems.EditIndex     = -1;
         _focusindex           = -1;
         tbPackageBarcode.Text = "";
         BindGrid();
     }
 }
예제 #2
0
        protected void btnAccept_Click(object sender, EventArgs e)
        {
            ReturnsDAO dao = new ReturnsDAO();

            _focusindex = -1;

            DataTable dt = (DataTable)ViewState["dt"];

            if (dt != null)
            {
                for (int inx = 0; inx < dt.Rows.Count; inx++)
                {
                    if (_itemHashTable.Contains(inx))
                    {
                        DataRow       dr = dt.Rows[inx];
                        _ReturnAction ra = (_ReturnAction)_itemHashTable[inx];

                        int    itemnumber  = int.Parse(dr.ItemArray[0].ToString());
                        int    ordernumber = int.Parse(lblOrdernumber.Text);
                        string actioncode  = ra.actionCode;
                        string taskdescr   = ra.taskDescription;
                        string customerurn = lblCustomerUrn.Text;
                        string sku         = (string)dr.ItemArray[2];
                        string loginname   = User.Identity.Name;

                        dao.ReturnItem("F", itemnumber, ordernumber, actioncode, taskdescr, customerurn, sku, loginname, System.Net.Dns.GetHostEntry(Request.ServerVariables["remote_addr"]).HostName);
                    }
                }
            }

            _ordernumber    = null;
            _itemHashTable  = null;
            ViewState["dt"] = null;
            BindGrid();
        }
예제 #3
0
        //Process all returns
        protected void btnAccept_Click(object sender, EventArgs e)
        {
            ReturnsDAO dao = new ReturnsDAO();

            _focusindex = -1;

            DataTable dt = (DataTable)ViewState["dt"];

            if (dt != null)
            {
                for (int inx = 0; inx < dt.Rows.Count; inx++)
                {
                    if (_itemHashTable.Contains(inx))
                    {
                        DataRow       dr = dt.Rows[inx];
                        _ReturnAction ra = (_ReturnAction)_itemHashTable[inx];

                        string parcelScannedInd = ViewState["parcelscannedind"] == null || ViewState["parcelscannedind"].ToString() == "F" ? "F" : "T";
                        int    itemnumber       = int.Parse(dr.ItemArray[0].ToString());
                        int    ordernumber      = int.Parse(lblOrdernumber.Text);
                        string actioncode       = ra.actionCode;
                        string taskdescr        = ra.taskDescription;
                        string customerurn      = lblCustomerUrn.Text;
                        string sku       = (string)dr.ItemArray[2];
                        string loginname = User.Identity.Name;

                        if (_storeUser == "N")
                        {
                            dao.ReturnItem(parcelScannedInd, itemnumber, ordernumber, actioncode, taskdescr, customerurn, sku,
                                           loginname, System.Net.Dns.GetHostEntry(Request.ServerVariables["remote_addr"]).HostName);
                        }
                        else
                        {
                            dao.RefundItem(parcelScannedInd, itemnumber, ordernumber, actioncode, taskdescr, customerurn, sku,
                                           _userID, _storeID, _tillID);
                        }
                    }
                }
            }

            ViewState["dt"] = null;
            if (_itemHashTable != null && _itemHashTable.Count > 0)
            {
                lblItemsReturned.Visible = true;
                lblItemsReturned.Text    = _itemHashTable.Count.ToString() + " items returned";
            }
            _ordernumber   = null;
            _itemHashTable = null;
            BindGrid();
        }
예제 #4
0
        //Click on saving customer service action
        protected void btnFinish_Click(object sender, EventArgs e)
        {
            int inx = -1;

            foreach (GridViewRow row in gvItems.Rows)
            {
                Control ctrl = (Control)row.Cells[ACTIONREASONCELL].Controls[1];
                inx++;
                if (ctrl is DropDownList)
                {
                    break;
                }
            }

            if (inx >= 0)
            {
                GridViewRow row = gvItems.Rows[inx];
                //row.BackColor = System.Drawing.Color.White;
                gvItems.EditIndex = inx;
                DropDownList ddl = (DropDownList)row.FindControl("ddlAct");
                TextBox      tb  = (TextBox)row.FindControl("tbTaskDesc");
                if (ddl != null)
                {
                    string sv = ddl.SelectedValue;
                    if (_itemHashTable == null)
                    {
                        _itemHashTable = new Hashtable();
                    }
                    if (_itemHashTable.ContainsKey(inx))
                    {
                        _itemHashTable.Remove(inx);
                    }
                    _ReturnAction act = new _ReturnAction();
                    act.actionCode      = sv;
                    act.actionDescr     = ddl.SelectedItem.Text;
                    act.taskDescription = tb.Text;
                    _itemHashTable.Add(inx, act);
                    ViewState["itemsprocessed"] = _itemHashTable;
                }
                gvItems.EditIndex     = -1;
                _focusindex           = -1;
                tbPackageBarcode.Text = "";
                BindGrid();
            }
        }
예제 #5
0
        protected void ddlAct_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList ddl    = (DropDownList)sender;
            int          rowinx = -1;

            string sv = ddl.SelectedValue;

            _actions = (DataTable)ViewState["itemactions"];

            if (_actions != null)
            {
                foreach (DataRow dr in _actions.Rows)
                {
                    if (dr["actioncode"].ToString() == sv)
                    {
                        TextBox tb  = (TextBox)ddl.NamingContainer.FindControl("tbTaskDesc");
                        Button  btn = (Button)ddl.NamingContainer.FindControl("btnFinish");
                        if (tb != null)
                        {
                            if (dr["createtask"].ToString() == "1")
                            {
                                tb.Visible  = true;
                                btn.Visible = true;
                            }
                            else
                            {
                                tb.Visible  = false;
                                btn.Visible = false;

                                if (ddl.SelectedValue != "-1")
                                {
                                    //Find which row this is
                                    foreach (GridViewRow row in gvItems.Rows)
                                    {
                                        Control ctrl = (Control)row.Cells[ACTIONREASONCELL].Controls[1];
                                        rowinx++;
                                        if (ctrl is DropDownList)
                                        {
                                            if (_itemHashTable == null)
                                            {
                                                _itemHashTable = new Hashtable();
                                            }
                                            if (_itemHashTable.ContainsKey(rowinx))
                                            {
                                                _itemHashTable.Remove(rowinx);
                                            }
                                            gvItems.EditIndex     = -1;
                                            _focusindex           = -1;
                                            tbPackageBarcode.Text = "";
                                            _ReturnAction act = new _ReturnAction();
                                            act.actionCode      = sv;
                                            act.actionDescr     = ddl.SelectedItem.Text;
                                            act.taskDescription = "";
                                            _itemHashTable.Add(rowinx, act);
                                            ViewState["itemsprocessed"] = _itemHashTable;
                                            BindGrid();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #6
0
        protected void gvItems_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                // Set row colour
                if (gvItems.EditIndex == e.Row.DataItemIndex)
                {   // Row being edited
                    e.Row.BackColor = System.Drawing.Color.Azure;
                }
                else if (_itemHashTable != null && _itemHashTable.Contains(e.Row.RowIndex))
                {  //Row with action
                    e.Row.BackColor = System.Drawing.Color.Beige;
                }
                else
                {
                    e.Row.BackColor = System.Drawing.Color.Bisque;
                }

                if (e.Row.RowState == DataControlRowState.Edit)
                {
                    e.Row.BackColor = System.Drawing.Color.Azure;
                }
                CheckBox cb  = (CheckBox)e.Row.Cells[EDITCHECKBOXCELL].FindControl("cbEdited");
                CheckBox cb2 = (CheckBox)e.Row.Cells[EDITCHECKBOXCELL].FindControl("cbEditing");
                e.Row.Cells[EDITICONCELL].Controls[EDITCHECKBOXCELL].Visible = false;

                DataRowView drv        = (DataRowView)e.Row.DataItem;
                string      actioncode = drv.Row.ItemArray[4].ToString();
                if (_itemHashTable != null && _itemHashTable.Contains(e.Row.RowIndex))
                {
                    if (gvItems.EditIndex != e.Row.DataItemIndex)
                    {
                        e.Row.Cells[EDITICONCELL].Controls[0].Visible = true;
                    }
                    if (cb != null)
                    {
                        cb.Checked = true;
                    }
                }
                else
                {
                    if (cb != null)
                    {
                        cb.Checked = false;
                    }

                    // If we are being called from the DC (_storeUser == "N")
                    // and this row has action code 100 (refunded return)
                    // then allow the row to be edited so that DC user
                    // can move the status on to saleable/mispick/damaged.
                    if (actioncode == REFUNDEDRETURN && _storeUser == "N")
                    {
                        if (cb != null)
                        {
                            cb.Enabled = true;
                        }
                        e.Row.BackColor = System.Drawing.Color.Yellow;
                    }
                    // Not refunded retarun and/or not in DC
                    // so disable the row if action code previouslyy selected.
                    else if (actioncode != string.Empty)
                    {
                        _alreadyCancelled++;
                        if (cb != null)
                        {
                            cb.Enabled = false;
                        }
                        e.Row.BackColor = System.Drawing.Color.Chocolate;
                    }
                }

                Label lbl = (Label)e.Row.FindControl("lbAction");
                if (lbl != null)
                {
                    if (_itemHashTable != null && _itemHashTable.Contains(e.Row.DataItemIndex))
                    {
                        string        ss  = _itemHashTable[e.Row.DataItemIndex].ToString();
                        _ReturnAction act = (_ReturnAction)_itemHashTable[e.Row.DataItemIndex];

                        lbl.Text = act.actionDescr;
                    }
                    else
                    {
                        DataRowView dr = (DataRowView)e.Row.DataItem;
                        string      actioncodedescr = dr.Row.ItemArray[6].ToString();
                        lbl.Text = actioncodedescr;
                    }
                }
                Control ctrl = e.Row.FindControl("ddlAct");
                if (ctrl != null)
                {
                    DropDownList ddl = (DropDownList)ctrl;
                    if (actioncode == REFUNDEDRETURN && _storeUser == "N")
                    {
                        ddl.DataSource = _actionsCBR;
                    }
                    else
                    {
                        ddl.DataSource = _actions;
                    }

                    ddl.DataTextField  = "description";
                    ddl.DataValueField = "actioncode";
                    ddl.DataBind();
                    ddl.Items.Add(new ListItem("Select Reason", "-1"));
                    if (_itemHashTable != null && _itemHashTable.Contains(e.Row.RowIndex))
                    {
                        ddl.SelectedValue = ((_ReturnAction)(_itemHashTable[e.Row.RowIndex])).actionCode;
                        if (ddl.SelectedValue == "70")
                        {
                            ((TextBox)e.Row.FindControl("tbTaskDesc")).Text    = ((_ReturnAction)(_itemHashTable[e.Row.RowIndex])).taskDescription;
                            ((TextBox)e.Row.FindControl("tbTaskDesc")).Visible = true;
                            ((Button)e.Row.FindControl("btnFinish")).Visible   = true;
                        }
                    }
                    else
                    {
                        ddl.SelectedValue = "-1";
                    }
                }
                if (cb2 != null)
                {
                    if (gvItems.EditIndex == e.Row.DataItemIndex)
                    {
                        cb2.Checked = true;
                    }
                }
            }
        }
예제 #7
0
        protected void gvItems_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                // Set row colour
                if (gvItems.EditIndex == e.Row.DataItemIndex)
                {   // Row being edited
                    e.Row.BackColor = System.Drawing.Color.Azure;
                }
                else if (_itemHashTable != null && _itemHashTable.Contains(e.Row.RowIndex))
                {  //Row with action
                    e.Row.BackColor = System.Drawing.Color.Beige;
                }
                else
                {
                    e.Row.BackColor = System.Drawing.Color.Bisque;
                }

                if (e.Row.RowState == DataControlRowState.Edit)
                {
                    e.Row.BackColor = System.Drawing.Color.Azure;
                }
                CheckBox cb  = (CheckBox)e.Row.Cells[0].FindControl("cbEdited");
                CheckBox cb2 = (CheckBox)e.Row.Cells[0].FindControl("cbEditing");
                e.Row.Cells[2].Controls[0].Visible = false;

                if (_itemHashTable != null && _itemHashTable.Contains(e.Row.RowIndex))
                {
                    if (gvItems.EditIndex != e.Row.DataItemIndex)
                    {
                        e.Row.Cells[2].Controls[0].Visible = true;
                    }
                    if (cb != null)
                    {
                        cb.Checked = true;
                    }
                }
                else
                {
                    if (cb != null)
                    {
                        cb.Checked = false;
                    }

                    DataRowView dr         = (DataRowView)e.Row.DataItem;
                    string      actioncode = dr.Row.ItemArray[4].ToString();
                    if (actioncode != string.Empty)
                    {
                        _alreadyCancelled++;
                        if (cb != null)
                        {
                            cb.Enabled = false;
                        }
                        e.Row.BackColor = System.Drawing.Color.Chocolate;
                    }
                }

                Label lbl = (Label)e.Row.FindControl("lbAction");
                if (lbl != null)
                {
                    if (_itemHashTable != null && _itemHashTable.Contains(e.Row.DataItemIndex))
                    {
                        string        ss  = _itemHashTable[e.Row.DataItemIndex].ToString();
                        _ReturnAction act = (_ReturnAction)_itemHashTable[e.Row.DataItemIndex];

                        lbl.Text = act.actionDescr;
                    }
                    else
                    {
                        lbl.Text = "";
                    }
                }
                Control ctrl = e.Row.FindControl("ddlAct");
                if (ctrl != null)
                {
                    DropDownList ddl = (DropDownList)ctrl;
                    ddl.DataSource     = _actions;
                    ddl.DataTextField  = "description";
                    ddl.DataValueField = "actioncode";
                    ddl.DataBind();
                    ddl.Items.Add(new ListItem("Select Action", "-1"));
                    if (_itemHashTable != null && _itemHashTable.Contains(e.Row.RowIndex))
                    {
                        ddl.SelectedValue = ((_ReturnAction)(_itemHashTable[e.Row.RowIndex])).actionCode;
                        if (ddl.SelectedValue == "70")
                        {
                            ((TextBox)e.Row.FindControl("tbTaskDesc")).Text    = ((_ReturnAction)(_itemHashTable[e.Row.RowIndex])).taskDescription;
                            ((TextBox)e.Row.FindControl("tbTaskDesc")).Visible = true;
                            ((Button)e.Row.FindControl("btnFinish")).Visible   = true;
                        }
                    }
                    else
                    {
                        ddl.SelectedValue = "-1";
                    }
                }
                if (cb2 != null)
                {
                    if (gvItems.EditIndex == e.Row.DataItemIndex)
                    {
                        cb2.Checked = true;
                    }
                }
            }
        }