コード例 #1
0
 protected void dgvGridView_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
 {
     if (!string.IsNullOrEmpty(e.CommandArgument.ToString()))
     {
         if (e.CommandName == "addDocketNo")
         {
             GridViewRow gvRow       = (GridViewRow)((Control)e.CommandSource).NamingContainer;
             Int32       rowind      = gvRow.RowIndex;
             TextBox     txtDocketNo = (TextBox)gvRow.FindControl("txtDocketNo");
             if (txtDocketNo != null && txtDocketNo.Text != "")
             {
                 if (dgvGridView.DataKeys[gvRow.RowIndex].Values[1].ToString() != "" && dgvGridView.DataKeys[gvRow.RowIndex].Values[3].ToString() != "")
                 {
                     objSubOrder = new tblSubOrder();
                     objSubOrder.SetDocketNumber(Convert.ToInt32(Enums.Enums_OrderStatus.Confirmed), dgvGridView.DataKeys[gvRow.RowIndex].Values[0].ToString(), dgvGridView.DataKeys[gvRow.RowIndex].Values[1].ToString(), txtDocketNo.Text, true);
                     objSubOrder = null;
                     SendShippingMail(e.CommandArgument.ToString());
                     LoadDataGrid(true, false);
                 }
             }
             else
             {
                 DInfo.ShowMessage("Enter Docket Number", Enums.MessageType.Error);
             }
         }
         if (e.CommandName == "SaveCourierCompany")
         {
             GridViewRow  gvRow                   = (GridViewRow)((Control)e.CommandSource).NamingContainer;
             DropDownList ddlCourierCompany       = (DropDownList)gvRow.FindControl("ddlCourierCompany");
             TextBox      txtCourierCompanyDocket = (TextBox)gvRow.FindControl("txtCourierCompanyDocket");
             if (txtCourierCompanyDocket.Text != "")
             {
                 objSubOrder = new tblSubOrder();
                 objSubOrder.SetDocketNumberAndCourierCompanyIDOnOrderId(Convert.ToInt32(Enums.Enums_OrderStatus.Shipped), e.CommandArgument.ToString(), ddlCourierCompany.SelectedValue, txtCourierCompanyDocket.Text, true);
                 objSubOrder = null;
                 SendShippingMail(e.CommandArgument.ToString());
             }
             else
             {
                 txtCourierCompanyDocket.Style.Add("border", "1px solid #D2322D");
             }
             objSubOrder = null;
             LoadDataGrid(true, false);
         }
     }
 }