/// <summary> /// Event to fill the details in the label /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lstDetails_SelectedIndexChanged(object sender, EventArgs e) { try { string detailFlag = hidCurrentControl.Value.Split('_')[1].Replace("lnk", ""); DataTable dtDetail = new DataTable(); if (detailFlag == "BillTo" || detailFlag == "ShipTo") { dtDetail = (DataTable)Session[((detailFlag == "BillTo") ? "CustomerDetail" : "ShipDetails")]; dtDetail.DefaultView.RowFilter = "Name='" + lstDetails.SelectedItem.Text + "' and " + ((detailFlag == "BillTo") ? "No_" : "Code") + "='" + lstDetails.SelectedValue + "'"; dtDetail = dtDetail.DefaultView.ToTable(); } switch (detailFlag.Replace("lnk", "").Trim()) { case "BillTo": // Code to fill the address or ship to details FillCustomerAddress(dtDetail); // Code to update the detail in the table custDet.UpdateHeader("SOE_Header", getAddress, "SalesOrderID=" + SOrderNumber); break; case "ShipTo": FillShipTo(dtDetail); // Code to update the detail in the table custDet.UpdateHeader("SOE_Header", getShipTO, "SalesOrderID=" + SOrderNumber); break; case "Usage": lblUsageLoc.Text = lstDetails.SelectedValue; // Code to update the detail in the table custDet.UpdateHeader("SOE_Header", "[UsageLocation]='" + lblUsageLoc.Text + "'", "SalesOrderID=" + SOrderNumber); break; } // Code to update the customer panel UpdatePanel pnlCustomer = Page.FindControl("pnlCustomer") as UpdatePanel; pnlCustomer.Update(); } catch (Exception ex) { } ScriptManager.RegisterClientScriptBlock(lstDetails, typeof(ListBox), "", "Hide('divTool');", true); }
protected void btnUpdate_Click(object sender, EventArgs e) { try { if (Convert.ToDateTime(DateTime.Now.ToShortDateString()) <= Convert.ToDateTime(textBox.Text)) { string strTableName = (Session["OrderTableName"] == null) ? "SOHeader" : Session["OrderTableName"].ToString(); if (Name.Trim() == "CustReqDt") { string strSchDt = customerDetail.GetValues(strTableName, "SchShipDt", HeaderIDColumn + "=" + SOOrderID); if (Convert.ToDateTime(strSchDt) <= Convert.ToDateTime(textBox.Text)) { string ColumnValue = "[" + Name + "]='" + textBox.Text + "'"; customerDetail.UpdateHeader(strTableName, ColumnValue + ",ChangeID='" + Session["UserName"].ToString() + "',ChangeDt='" + DateTime.Now.ToShortDateString() + "'", HeaderIDColumn + "=" + SOOrderID); } else { ScriptManager.RegisterClientScriptBlock(btnUpdate, typeof(Button), "Invalid", "alert('Customer req Date should not be less than Sch Ship Date.');document.getElementById('" + textBox.ClientID + "').value=' ';document.getElementById('" + textBox.ClientID + "').focus();document.getElementById('" + textBox.ClientID + "').select();", true); } } else { string ColumnValue = "[" + Name + "]='" + textBox.Text + "'"; customerDetail.UpdateHeader(strTableName, ColumnValue + ",ChangeID='" + Session["UserName"].ToString() + "',ChangeDt='" + DateTime.Now.ToShortDateString() + "'", HeaderIDColumn + "=" + SOOrderID); // Update the sch ship value in sodetail reqshipdt field if (Name.Trim() == "SchShipDt") { hidPreviousvalue.Value = textBox.Text; customerDetail.UpdateHeader(Session["DetailTableName"].ToString(), "RqstdShipDt='" + textBox.Text + "',ChangeID='" + Session["UserName"].ToString() + "',ChangeDate='" + DateTime.Now.ToShortDateString() + "'", HeaderIDColumn + "=" + SOOrderID); OnBubbleClick(e); } } ScriptManager.RegisterClientScriptBlock(btnUpdate, typeof(Button), "nextCtl", "document.getElementById('" + Image1.ClientID + "').focus();document.getElementById('" + Image1.ClientID + "').select();", true); } else { ScriptManager.RegisterClientScriptBlock(btnUpdate, typeof(Button), "Invalid", "alert('Invalid Date');document.getElementById('" + textBox.ClientID + "').focus();document.getElementById('" + textBox.ClientID + "').select();", true); } } catch (Exception ex) { } }
protected void ddlOrderType_SelectedIndexChanged(object sender, EventArgs e) { try { soID = (Session["OrderHeaderID"] == null) ? "" : Session["OrderHeaderID"].ToString(); if (soID != "") { if (Session["OrderType"].ToString() == "TO" && ddlOrderType.SelectedValue.Split('-')[0] != "PTO") // For TO orders type { ScriptManager.RegisterClientScriptBlock(ddlOrderType, typeof(DropDownList), "", "alert('Only you can convert this order into Pending Transfer Order.');", true); return; } else { if (ddlOrderType.SelectedValue.Split('-')[0] == "PTO" && Session["OrderType"].ToString() != "TO") { ScriptManager.RegisterClientScriptBlock(ddlOrderType, typeof(DropDownList), "", "alert('You can not convert this order into Pending Transfer Order.');", true); return; } else { string[] values = ddlOrderType.SelectedValue.Split('-'); string updateColumn = "[OrderType]='" + values[0].Trim() + "',SubType='99',OrderTypeDsc='" + values[1] + "',"; customerDetail.UpdateHeader(SOHeaderTable, updateColumn + "ChangeID='" + Session["UserName"].ToString() + "',ChangeDt='" + DateTime.Now.ToShortDateString() + "'", HeaderIDColumn + "=" + soID); if (Request.QueryString["FormClose"] == null) { orderEntry.ReleaseLock(); } ddlOrderType.Enabled = false; } } } ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Load", "window.opener.location.href=window.opener.location.href;window.close();", true); } catch (Exception ex) { throw; } }