private void GetSalesManager() { DataTable ds = new DataTable(); try { ds = ClsSalesManagerChecking.Get_PurchaseOrder(Convert.ToDateTime(Txt_FromDate.Text.Trim()), Convert.ToDateTime(Txt_ToDate.Text.Trim())); if (ds.Rows.Count > 0) { GvwSalesRegister.Visible = true; GvwSalesRegister.DataSource = ds; GvwSalesRegister.DataBind(); ViewState["Data"] = ds; ds.Dispose(); if (ViewState["PageINdex"] != null) { GvwSalesRegister.PageIndex = Convert.ToInt32(ViewState["PageINdex"].ToString()); } } else { lblmsg.Text = "NO Data Found..."; GvwSalesRegister.Visible = false; //ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('NO Data Found...');</script>", false); } } catch (Exception ex) { } }
private void BindMainGrid() { DataTable DT = new DataTable(); try { DT = ClsSalesManagerChecking.Get_InvoiceDispatchSearch(Convert.ToDateTime(Txt_FromDate.Text.Trim()), Convert.ToDateTime(Txt_ToDate.Text.Trim())); GvwMatDispatch.DataSource = DT; GvwMatDispatch.DataBind(); if (DT.Rows.Count > 0) { lblmessage.Text = ""; } else { lblmessage.Text = "No Records Found..."; //ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('No Records Found...');</script>", false); } ViewState["Data"] = DT; DT.Dispose(); if (ViewState["PageINdex"] != null) { GvwMatDispatch.PageIndex = Convert.ToInt32(ViewState["PageINdex"].ToString()); } } catch (Exception ex) { } }
protected void BtnAppRejSave_Click(object sender, EventArgs e) { if (TxtPoDate.Text.Trim() != string.Empty) { if (DrpAppRej.SelectedValue != "1") { if (!string.IsNullOrEmpty(hidDetails_ID.Value)) { string asd = hidDetails_ID.Value; bool result = ClsSalesManagerChecking.Update_PO_AppReject(Convert.ToInt32(asd), Convert.ToInt64(DrpAppRej.SelectedValue.Trim()), Txt_AppRejReason.Text.Trim(), Convert.ToInt32(Session["Id"])); if (result) { Panel2.Visible = true; Panel1.Visible = false; tbldate.Visible = true; GetSalesManager(); ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('Saved Successfully...');</script>", false); //Response.Redirect("PurchaseManagerChecking.aspx",false); } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('Failed contact IT Team...');</script>", false); } } } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('Please select the status(Approved/Reject)...');</script>", false); ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('Not Selected...');</script>", false); } } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('Not Selected...');</script>", false); } }
private void GetSalesManager() { DataTable ds = new DataTable(); try { ds = ClsSalesManagerChecking.Get_SalesOrder(Convert.ToDateTime(Txt_FromDate.Text.Trim()), Convert.ToDateTime(Txt_ToDate.Text.Trim())); GvwSalesManagerChecking.DataSource = ds; GvwSalesManagerChecking.DataBind(); if (ds.Rows.Count > 0) { lblmessage.Text = ""; } else { lblmessage.Text = "No Records Found..."; } ViewState["Data"] = ds; ds.Dispose(); if (ViewState["PageINdex"] != null) { GvwSalesManagerChecking.PageIndex = Convert.ToInt32(ViewState["PageINdex"].ToString()); } } catch (Exception ex) { } }
private void SoDetails(Int64 id) { DataTable ds = new DataTable(); ds = ClsSalesManagerChecking.Get_SoDetailsFor_MaterialDispatch(id); GvwSaleseOrderDetails.DataSource = ds; GvwSaleseOrderDetails.DataBind(); }
protected void BtnSave_Click(object sender, EventArgs e) { int Int_transporter; if (ddlTransporter.Text != "") { Int_transporter = Convert.ToInt32(ddlTransporter.SelectedValue); } else { Int_transporter = 0; } DateTime?DateOfDelivery; if (Txt_DateOfDelivery.Text.Trim() == string.Empty) { DateOfDelivery = null; } else { DateOfDelivery = Convert.ToDateTime(Txt_DateOfDelivery.Text.Trim()); } DateTime?DateofInst; if (txtdateofinst.Text.Trim() == string.Empty) { DateofInst = null; } else { DateofInst = Convert.ToDateTime(txtdateofinst.Text.Trim()); } bool result = ClsSalesManagerChecking.InsertINVDispatchDetails(Convert.ToInt32(ddlDispatchDetails.SelectedValue), Convert.ToDateTime(Txt_Dispatch_Date.Text.Trim()), txtAWBNo.Text.Trim(), DateOfDelivery, DateofInst, Int_transporter, Convert.ToInt32(Session["Id"]), Convert.ToInt32(txtSOID.Text), Convert.ToInt32(Session["DCID"])); if (result) { Clear(); BindMainGrid(); Panel2.Visible = true; Panel1.Visible = false; ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('Saved Successfully...');</script>", false); } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('Failed...');</script>", false); } }
private void SoDetails(Int64 id) { DataTable ds = new DataTable(); ds = ClsSalesManagerChecking.Get_SalesOrderforApproval(id); GvwSaleseOrderDetails.DataSource = ds; GvwSaleseOrderDetails.DataBind(); for (int i = 0; i < ds.Rows.Count; i++) { if (ds.Rows.Count > 0) { GvwSaleseOrderDetails.Rows[i].Cells[3].BackColor = System.Drawing.Color.Yellow; } } }
private void LoadddlTransporter() { try { DataTable DTTr = ClsSalesManagerChecking.Get_Transporterdetails(); ddlTransporter.DataSource = DTTr; ddlTransporter.DataTextField = "Transporter"; ddlTransporter.DataValueField = "TID"; ddlTransporter.DataBind(); ddlTransporter.Items.Insert(0, new ListItem("--Select Transporter Details--", "0")); } catch (Exception ex) { throw ex; } }
private void LoadddlDispatch() { try { DataTable DTDispatch = ClsSalesManagerChecking.Get_DispatchDEtails(); ddlDispatchDetails.DataSource = DTDispatch; ddlDispatchDetails.DataTextField = "Dispatch_Type_Name"; ddlDispatchDetails.DataValueField = "Dispatch_TypeID"; ddlDispatchDetails.DataBind(); ddlDispatchDetails.Items.Insert(0, new ListItem("--Select Dispatch Details--", "0")); } catch (Exception ex) { throw ex; } }
protected void BtnAppRejSave_Click(object sender, EventArgs e) { ClsSalesOrder clsSalses = new ClsSalesOrder(); if (!string.IsNullOrEmpty(hidDetails_ID.Value)) { //For Mails DataTable dtPODetMail = new DataTable(); dtPODetMail.Columns.Add("CatagoryName", typeof(string)); dtPODetMail.Columns.Add("ProductName", typeof(string)); dtPODetMail.Columns.Add("Current_Stock", typeof(int)); dtPODetMail.Columns.Add("Quantity", typeof(int)); foreach (GridViewRow gvRow in GvwSaleseOrderDetails.Rows) { if (((Label)gvRow.FindControl("lblCatagory")).Text != "") { int PendingQuantity = Convert.ToInt16(((Label)gvRow.FindControl("LblPendingQuantity")).Text); int Current_Stock = Convert.ToInt16(((Label)gvRow.FindControl("LblCurrentStock")).Text); if (Current_Stock < PendingQuantity) { DataRow drDetMail = dtPODetMail.NewRow(); drDetMail["CatagoryName"] = ((Label)gvRow.FindControl("lblCatagory")).Text; drDetMail["ProductName"] = ((Label)gvRow.FindControl("LblProduct")).Text; drDetMail["Current_Stock"] = Convert.ToInt16(((Label)gvRow.FindControl("LblCurrentStock")).Text); drDetMail["Quantity"] = Convert.ToInt16(((Label)gvRow.FindControl("LblPendingQuantity")).Text); dtPODetMail.Rows.Add(drDetMail); } } } DataRow[] drModel = dtPODetMail.Select("Current_Stock=0"); DataTable dtNew = new DataTable(); dtNew = dtPODetMail.Clone(); if (drModel.Length > 0) { foreach (DataRow dr in drModel) { dtNew.ImportRow(dr); } dtNew.AcceptChanges(); } if (dtNew.Rows.Count == GvwSaleseOrderDetails.Rows.Count) { if (txttype.Text != "Service" && txttype.Text != "Support" && txttype.Text != "Rental" && txttype.Text != "Any other services") { int SentMailResult = clsSalses.Send_Mail_ZeroStock_So_ProductDetails(dtPODetMail, txtState.Text.Trim(), TxtLocation.Text.Trim()); ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('Stock is not available...');</script>", false); Txt_AppRejReason.Text = ""; DrpAppRej.SelectedIndex = 0; GetSalesManager(); Panel2.Visible = true; Panel1.Visible = false; } else { string asd = hidDetails_ID.Value; bool result = ClsSalesManagerChecking.Update_SO_AppReject(Convert.ToInt32(asd), Convert.ToInt32(DrpAppRej.SelectedValue.Trim()), Txt_AppRejReason.Text.Trim(), Convert.ToInt32(Session["Id"])); if (result) { ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('Saved Successfully...');</script>", false); Txt_AppRejReason.Text = ""; DrpAppRej.SelectedIndex = 0; GetSalesManager(); Panel2.Visible = true; Panel1.Visible = false; } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('Failed...');</script>", false); } } } else { string asd = hidDetails_ID.Value; bool result = ClsSalesManagerChecking.Update_SO_AppReject(Convert.ToInt32(asd), Convert.ToInt32(DrpAppRej.SelectedValue.Trim()), Txt_AppRejReason.Text.Trim(), Convert.ToInt32(Session["Id"])); if (txttype.Text != "Service" && txttype.Text != "Support" && txttype.Text != "Rental" && txttype.Text != "Any other services") { if (dtPODetMail.Rows.Count > 0) { int SentMailResult = clsSalses.Send_Mail_ZeroStock_So_ProductDetails(dtPODetMail, txtState.Text.Trim(), TxtLocation.Text.Trim()); } } if (result) { ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('Saved Successfully...');</script>", false); Txt_AppRejReason.Text = ""; DrpAppRej.SelectedIndex = 0; GetSalesManager(); Panel2.Visible = true; Panel1.Visible = false; } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('Failed...');</script>", false); } } } }
protected void GvwSalesManagerChecking_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "Edit1") { Panel1.Visible = true; Panel2.Visible = false; int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = GvwSalesManagerChecking.Rows[index]; Label lbl = (Label)row.FindControl("hidennID"); // hidDetails_ID.Value = e.CommandArgument.ToString(); string ID = lbl.Text.Trim(); hidDetails_ID.Value = ID; DataTable dtItem = (DataTable)ViewState["Data"]; DataRow[] drModel = dtItem.Select("SO_ID='" + ID + "'"); DataTable dtNew = new DataTable(); dtNew = dtItem.Clone(); if (drModel.Length > 0) { foreach (DataRow dr in drModel) { dtNew.ImportRow(dr); } dtNew.AcceptChanges(); TxtVertical.Text = dtNew.Rows[0]["Vertical"].ToString(); TxtPoDate.Text = dtNew.Rows[0]["SoDate"].ToString(); TxtSoLocation.Text = dtNew.Rows[0]["Location"].ToString(); TxtSoSupplier.Text = dtNew.Rows[0]["Supplier"].ToString(); TxtPoNo.Text = dtNew.Rows[0]["SO_Number"].ToString(); TxtTotalAmount.Text = dtNew.Rows[0]["SO_NetAmount"].ToString(); Txt_SubTotal.Text = dtNew.Rows[0]["SO_NetAmount"].ToString(); TxtInTotalAmount.Text = dtNew.Rows[0]["SO_NetAmount"].ToString(); TxtCustomerOrderDate.Text = dtNew.Rows[0]["CusutomerOrderdate"].ToString(); TxtCustomerOrderNo.Text = dtNew.Rows[0]["CusutomerOrderNO"].ToString(); TxtBillingAdress.Text = dtNew.Rows[0]["biling"].ToString(); } SoDetails(Convert.ToInt64(ID)); GetSalesManager(); DataTable dt = ClsSalesManagerChecking.get_address_ID(Convert.ToInt64(ID)); if (dt.Rows.Count > 0) { string conString = null; //foreach(DataRow r in dt.Rows) //{ // address = Items["AddressID"].ToString(); // .ToString(); //} for (int i = 0; i < dt.Rows.Count; i++) { string address = dt.Rows[i]["Addr"].ToString(); if (conString != null) { conString += "," + address; } else { conString = address; } } TxtshippingAdress.Text = conString; } ViewState["PageINdex"] = GvwSalesManagerChecking.PageIndex; } } catch (Exception ex) { } }