protected void btnTransferRequest_Command(object sender, CommandEventArgs e) { DataTable dtTranReqHeader = ObjTransReq.GetRecordUsingTransIdByRequestLocation(strCompId.ToString(), StrBrandId.ToString(), StrLocId.ToString(), e.CommandArgument.ToString()); if (dtTranReqHeader.Rows.Count != 0) { ViewState["RequestId"] = e.CommandArgument.ToString(); pnlTrans.Visible = true; txtTransReqDate.Text = Convert.ToDateTime(dtTranReqHeader.Rows[0]["TDate"].ToString()).ToString(ObjSysParam.GetSysParameterByParamName("Date_Format").Rows[0]["Param_Value"].ToString()); txtTransNo.Text = dtTranReqHeader.Rows[0]["RequestNo"].ToString(); try { txtLocationName.ReadOnly = true; txtLocationName.Text = objLocation.GetLocationMasterById(strCompId, dtTranReqHeader.Rows[0]["Location_ID"].ToString()).Rows[0]["Location_Name"].ToString(); } catch { txtLocationName.Text = ""; } DataTable dtTrasDetail = ObjTransferReqDetail.GetTransferRequestDetailbyRequestId(strCompId.ToString(), StrBrandId.ToString(), dtTranReqHeader.Rows[0]["Location_ID"].ToString(), e.CommandArgument.ToString()); GvProduct.DataSource = dtTrasDetail; GvProduct.DataBind(); gvEditProduct.DataSource = null; gvEditProduct.DataBind(); btnNew_Click(null, null); } }
public void FillGridDetail(string InvoiceId) { DataTable dt = ObjPurchaseInvoiceDetail.GetPurchaseInvoiceDetailByInvoiceNo(StrCompId.ToString(), StrBrandId.ToString(), StrLocationId.ToString(), InvoiceId); if (dt.Rows.Count != 0) { GvProduct.DataSource = dt; GvProduct.DataBind(); } AllPageCode(); }
protected void Page_Load(object sender, EventArgs e) { con = new SqlConnection(ConfigurationManager.ConnectionStrings["DXC"].ConnectionString); cmd = new SqlCommand("select*from [Prod]", con); con.Open(); SqlDataReader rd = cmd.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(rd); // GvProduct.DataSource = dt; GvProduct.DataBind(); }
public void Reset() { txtVoucherNo.Text = ""; editid.Value = ""; txtTransferDate.Text = DateTime.Now.ToString(ObjSysParam.GetSysParameterByParamName("Date_Format").Rows[0]["Param_Value"].ToString()); txtTransNo.Text = ""; txtTransReqDate.Text = ""; txtLocationName.Text = ""; pnlTrans.Visible = false; txtDescription.Text = ""; GvProduct.DataSource = null; GvProduct.DataBind(); FillGrid(); editid.Value = ""; gvEditProduct.DataSource = null; gvEditProduct.DataBind(); btnNew.Text = Resources.Attendance.New; AllPageCode(); }
protected void btnSave_Click(object sender, EventArgs e) { if (txtTransferDate.Text == "") { DisplayMessage("Select Date"); txtTransferDate.Text = DateTime.Now.ToString(ObjSysParam.GetSysParameterByParamName("Date_Format").Rows[0]["Param_Value"].ToString()); txtTransferDate.Focus(); return; } if (txtVoucherNo.Text == "") { DisplayMessage("Enter Voucher No."); txtVoucherNo.Focus(); return; } string LocationId = string.Empty; DataTable Dtlocation = objLocation.GetLocationMasterByLocationName(strCompId, txtLocationName.Text); if (Dtlocation.Rows.Count != 0) { LocationId = Dtlocation.Rows[0]["Location_Id"].ToString(); } else { LocationId = "0"; } bool b = false; string StrReqId = ViewState["RequestId"].ToString(); if (editid.Value == "") { foreach (GridViewRow Row in GvProduct.Rows) { if (((TextBox)Row.FindControl("txtOutQty")).Text.Trim() != "") { if (((TextBox)Row.FindControl("txtOutQty")).Text.Trim() != "0") { b = true; } } } if (!b) { DisplayMessage("Enter Product Quantity"); GvProduct.Focus(); return; } ObjTransferHeader.InsertTransferHeader(strCompId, StrBrandId, StrLocId, txtTransferDate.Text.Trim(), StrReqId.Trim(), LocationId.Trim(), txtDescription.Text.Trim(), "N", DateTime.Now.ToString(), null, txtVoucherNo.Text.Trim(), "", "", "", "", "", true.ToString(), DateTime.Now.ToString(), true.ToString(), UserId.ToString(), DateTime.Now.ToString(), UserId.ToString(), DateTime.Now.ToString()); string TransId = ObjTransferHeader.getAutoId(); foreach (GridViewRow Row in GvProduct.Rows) { if (((TextBox)Row.FindControl("txtOutQty")).Text.Trim() != "") { if (((TextBox)Row.FindControl("txtOutQty")).Text.Trim() != "0") { ObjTransferDetail.InsertTransferDetail(strCompId, StrBrandId, StrLocId, TransId, ((Label)Row.FindControl("lblSerialNO")).Text.Trim(), ((Label)Row.FindControl("lblPId")).Text.Trim(), ((Label)Row.FindControl("lblunitcost")).Text.Trim(), ((Label)Row.FindControl("lblUnitId")).Text.Trim(), ((Label)Row.FindControl("lblReqQty")).Text.Trim(), ((TextBox)Row.FindControl("txtOutQty")).Text.Trim(), "0", "", "", "", "", "", true.ToString(), DateTime.Now.ToString(), true.ToString(), UserId.ToString(), DateTime.Now.ToString(), UserId.ToString(), DateTime.Now.ToString()); } } } DisplayMessage("Record Saved"); int insertintransReq = 0; insertintransReq = ObjTransReq.UpdateStatusInTransferRequestHeader(StrReqId, strCompId, StrBrandId, LocationId.Trim(), UserId.ToString(), DateTime.Now.ToString(), "2"); } else { foreach (GridViewRow Row in gvEditProduct.Rows) { if (((TextBox)Row.FindControl("txtOutQty")).Text.Trim() != "") { if (((TextBox)Row.FindControl("txtOutQty")).Text.Trim() != "0") { b = true; } } } if (!b) { DisplayMessage("Enter Product Quantity"); GvProduct.Focus(); return; } ObjTransferHeader.UpdateTransferHeader(editid.Value, strCompId, StrBrandId, StrLocId, txtTransferDate.Text.Trim(), StrReqId.Trim(), LocationId.Trim(), txtDescription.Text.Trim(), "N", DateTime.Now.ToString(), null, txtVoucherNo.Text.Trim(), "", "", "", "", "", true.ToString(), DateTime.Now.ToString(), true.ToString(), UserId.ToString(), DateTime.Now.ToString(), UserId.ToString(), DateTime.Now.ToString()); ObjTransferDetail.DeleteTransferDetailbyHeaderTransId(strCompId, StrBrandId, StrLocId, editid.Value); string TransId = editid.Value; foreach (GridViewRow Row in gvEditProduct.Rows) { if (((TextBox)Row.FindControl("txtOutQty")).Text.Trim() != "") { if (((TextBox)Row.FindControl("txtOutQty")).Text.Trim() != "0") { ObjTransferDetail.InsertTransferDetail(strCompId, StrBrandId, StrLocId, TransId, ((Label)Row.FindControl("lblSerialNO")).Text.Trim(), ((Label)Row.FindControl("lblPId")).Text.Trim(), ((Label)Row.FindControl("lblunitcost")).Text.Trim(), ((Label)Row.FindControl("lblUnitId")).Text.Trim(), ((Label)Row.FindControl("lblReqQty")).Text.Trim(), ((TextBox)Row.FindControl("txtOutQty")).Text.Trim(), "0", "", "", "", "", "", true.ToString(), DateTime.Now.ToString(), true.ToString(), UserId.ToString(), DateTime.Now.ToString(), UserId.ToString(), DateTime.Now.ToString()); } } } DisplayMessage("Record Update"); } Reset(); ViewState["RequestId"] = null; }