protected void radgvEvents_ItemCommand(object sender, GridCommandEventArgs e) { Int64 RSN; if (e.CommandName == "UpdateRow") { RSN = Convert.ToInt64(e.CommandArgument.ToString()); Session["RSN"] = RSN.ToString(); SqlCommand cmd = new SqlCommand("Proc_Events", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@i", 5); cmd.Parameters.AddWithValue("@RSN", RSN); if (con.State.Equals(ConnectionState.Open)) { con.Close(); } con.Open(); SqlDataReader drselect = cmd.ExecuteReader(); if (drselect.HasRows) { while (drselect.Read()) { string strchkdate = "1900-01-01"; if (Convert.ToDateTime(drselect["FromDate"]) > Convert.ToDateTime(strchkdate)) { FromDate.SelectedDate = Convert.ToDateTime(drselect["FromDate"]); //FromDate.SelectedDate = Convert.ToDateTime(drselect["TillDate"]); } txtEventName.Text = drselect["EventName"].ToString(); txtdesc.Text = drselect["Description"].ToString(); TxtImge.Text = drselect["Image"].ToString(); string stvalue = drselect["Status"].ToString(); ddlupstatus.SelectedValue = drselect["Status"].ToString(); btnUpdate.Visible = true; btnAddEvent.Visible = false; lblcstatus.Visible = true; ddlupstatus.Visible = true; } } drselect.Close(); con.Close(); } else { LoadGrid(); } }
protected void LnkEditItemMaster_Click1(object sender, EventArgs e) { try { LinkButton lnkEdititemBtn = (LinkButton)sender; GridDataItem row = (GridDataItem)lnkEdititemBtn.NamingContainer; string RSN; RSN = row.Cells[2].Text; ViewState["ItemRSN"] = RSN.ToString(); SqlProcsNew proc = new SqlProcsNew(); DataSet dsIT = null; dsIT = proc.ExecuteSP("SP_GetItem", new SqlParameter() { ParameterName = "@RSN", SqlDbType = SqlDbType.Int, Value = RSN }); if (dsIT.Tables[0].Rows.Count > 0) { ItemCode.Text = dsIT.Tables[0].Rows[0]["ItemCode"].ToString(); ItemName.Text = dsIT.Tables[0].Rows[0]["ItemName"].ToString(); ddlUOM.Text = dsIT.Tables[0].Rows[0]["UOM"].ToString(); ddlitmCategory.SelectedValue = dsIT.Tables[0].Rows[0]["Category"].ToString(); string strserveqty = dsIT.Tables[0].Rows[0]["Session"].ToString(); if (strserveqty != "") { ddlMISession.SelectedValue = dsIT.Tables[0].Rows[0]["Session"].ToString(); } txtMIServeQty.Text = dsIT.Tables[0].Rows[0]["ServeQty"].ToString(); ddlitmType.SelectedValue = dsIT.Tables[0].Rows[0]["Type"].ToString(); txtQtyAlert.Text = dsIT.Tables[0].Rows[0]["QtyAlert"].ToString(); txtLeadTime.Text = dsIT.Tables[0].Rows[0]["LeadTime"].ToString(); txtRate.Text = dsIT.Tables[0].Rows[0]["Rate"].ToString(); txtRemarks.Text = dsIT.Tables[0].Rows[0]["Remarks"].ToString(); btnUpteItm.Visible = true; btnSaveItm.Visible = false; pnlMenuItem.Visible = true; } dsIT.Dispose(); } catch (Exception ex) { WebMsgBox.Show(ex.Message); } }
protected void LnkEditItem_Click(object sender, EventArgs e) { try { txtRMCode.Enabled = false; btnSave.Visible = false; //btnDelete.Visible = true; btnUpdate.Visible = true; btnUpdate.Visible = true; btnSave.Visible = false; LinkButton lnkEdititemBtn = (LinkButton)sender; GridDataItem row = (GridDataItem)lnkEdititemBtn.NamingContainer; string RSN; RSN = row.Cells[3].Text; hdnRSN.Value = RSN.ToString(); SqlProcsNew proc = new SqlProcsNew(); //DataSet dsDT = null; DataSet dsDT = sqlobj.ExecuteSP("Proc_RawMaterial", new SqlParameter() { ParameterName = "@i", SqlDbType = SqlDbType.Int, Value = 6 }, new SqlParameter() { ParameterName = "@RSN", SqlDbType = SqlDbType.Decimal, Value = RSN }); txtRMCode.Text = dsDT.Tables[0].Rows[0]["RMCode"].ToString(); txtRMName.Text = dsDT.Tables[0].Rows[0]["RMName"].ToString(); ddlIUOM.SelectedValue = dsDT.Tables[0].Rows[0]["ReceiptUOM"].ToString(); ddlIUOM.SelectedValue = dsDT.Tables[0].Rows[0]["IssueUOM"].ToString(); //txtOpeningStock.Text = dsDT.Tables[0].Rows[0]["OpeningStock"].ToString(); //dtpOpeningStk.SelectedDate = Convert.ToDateTime(dsDT.Tables[0].Rows[0]["OSDate"].ToString()); txtClosingStock.Text = dsDT.Tables[0].Rows[0]["ClosingStock"].ToString(); dtpClosingStk.SelectedDate = Convert.ToDateTime(dsDT.Tables[0].Rows[0]["CSDate"].ToString()); txtSupp.Text = dsDT.Tables[0].Rows[0]["Supplier"].ToString(); txtRemarks.Text = dsDT.Tables[0].Rows[0]["Remarks"].ToString(); ddlGroup.SelectedValue = dsDT.Tables[0].Rows[0]["StockGroup"].ToString(); ddlCategory.SelectedValue = dsDT.Tables[0].Rows[0]["Category"].ToString().Trim(); txtReorderlevel.Text = dsDT.Tables[0].Rows[0]["ReOrderLevel"].ToString(); txtminstock.Text = dsDT.Tables[0].Rows[0]["MinStock"].ToString(); txtRate.Text = dsDT.Tables[0].Rows[0]["AvgRate"].ToString(); } catch (Exception ex) { WebMsgBox.Show(ex.Message); } }
protected void radgvEvents_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { Int64 RSN; if (e.CommandName == "UpdateRow") { RSN = Convert.ToInt64(e.CommandArgument.ToString()); SqlCommand cmd = new SqlCommand("Proc_Events", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@i", 5); cmd.Parameters.AddWithValue("@RSN", RSN); if (con.State.Equals(ConnectionState.Open)) { con.Close(); } con.Open(); SqlDataReader drselect = cmd.ExecuteReader(); if (drselect.HasRows) { while (drselect.Read()) { lblfromdate.MinDate = Convert.ToDateTime(drselect["FromDate"]); lbltodate.MinDate = Convert.ToDateTime(drselect["FromDate"]); hbtnRSN.Value = RSN.ToString(); string strchkdate = "1900-01-01"; if (Convert.ToDateTime(drselect["FromDate"]) > Convert.ToDateTime(strchkdate)) { lblfromdate.SelectedDate = Convert.ToDateTime(drselect["FromDate"]); lbltodate.SelectedDate = Convert.ToDateTime(drselect["TillDate"]); } lblevent.Text = drselect["EventName"].ToString(); lblevedesc.Text = drselect["Description"].ToString(); string stvalue = drselect["Status"].ToString(); ddlupstatus.SelectedValue = drselect["Status"].ToString(); } } drselect.Close(); con.Close(); this.ModalPopupExtender1.Show(); } else if (strLastEvent == "OnComing") { LoadGrid(); } else { lbtnAll_Click(sender, null); } }
protected void lnkView_Click(object sender, EventArgs e) { try { btnSave.Visible = false; LinkButton lnkEdititemBtn = (LinkButton)sender; GridDataItem row = (GridDataItem)lnkEdititemBtn.NamingContainer; string RSN; RSN = row.Cells[3].Text; hdnRSN.Value = RSN.ToString(); SqlProcsNew proc = new SqlProcsNew(); DataSet dsSTR = sqlobj.ExecuteSP("SP_FetchStockTransaction", new SqlParameter() { ParameterName = "@iMode", SqlDbType = SqlDbType.Int, Value = 1 }, new SqlParameter() { ParameterName = "@RSN", SqlDbType = SqlDbType.Int, Value = RSN }); ddlItemCode.SelectedValue = dsSTR.Tables[0].Rows[0]["ItemCode"].ToString(); txtIUOM.Text = dsSTR.Tables[0].Rows[0]["IssueUOM"].ToString(); txtClosingStk.Text = dsSTR.Tables[0].Rows[0]["ClosingStock"].ToString(); hdnItem.Value = ddlItemCode.SelectedValue; LoadTransType(); ddlTransactionType.SelectedValue = dsSTR.Tables[0].Rows[0]["TransactionCode"].ToString(); txtQty.Text = dsSTR.Tables[0].Rows[0]["Qty"].ToString(); txtRemarks.Text = dsSTR.Tables[0].Rows[0]["Reference"].ToString(); txtSupplierName.Text = dsSTR.Tables[0].Rows[0]["SupplierName"].ToString(); txtInvoiceNo.Text = dsSTR.Tables[0].Rows[0]["InvoiceNo"].ToString(); dtpInoviceDt.SelectedDate = Convert.ToDateTime(dsSTR.Tables[0].Rows[0]["InvoiceDt"].ToString()); } catch (Exception ex) { WebMsgBox.Show(ex.Message); } }
protected void LnkEditItem_Click(object sender, EventArgs e) { try { btnUpdate.Visible = true; btnSave.Visible = false; LinkButton lnkEdititemBtn = (LinkButton)sender; GridDataItem row = (GridDataItem)lnkEdititemBtn.NamingContainer; string RSN; RSN = row.Cells[3].Text; //ViewState["MenuRSN"] = RSN.ToString(); hdnRSN.Value = RSN.ToString(); SqlProcsNew proc = new SqlProcsNew(); //DataSet dsDT = null; DataSet dsDT = sqlobj.ExecuteSP("SP_FetchBillingDays", new SqlParameter() { ParameterName = "@iMode", SqlDbType = SqlDbType.Int, Value = 2 }, new SqlParameter() { ParameterName = "@RSN", SqlDbType = SqlDbType.Decimal, Value = RSN }); ddlResident.SelectedValue = dsDT.Tables[0].Rows[0]["RTRSN"].ToString(); dtpFromDate.SelectedDate = Convert.ToDateTime(dsDT.Tables[0].Rows[0]["FromDt"].ToString()); dtpTillDate.SelectedDate = Convert.ToDateTime(dsDT.Tables[0].Rows[0]["TillDt"].ToString()); ddlBillingMonth.SelectedValue = dsDT.Tables[0].Rows[0]["BillingMonth"].ToString(); txtNoDaysDinned.Text = dsDT.Tables[0].Rows[0]["DNNoDays"].ToString(); txtRemarks.Text = dsDT.Tables[0].Rows[0]["Remarks"].ToString(); } catch (Exception ex) { WebMsgBox.Show(ex.Message); } }
protected void radgvEvents_ItemCommand(object sender, GridCommandEventArgs e) { Int64 RSN; if (e.CommandName == "UpdateRow") { RSN = Convert.ToInt64(e.CommandArgument.ToString()); Session["RSN"] = RSN.ToString(); DataSet dsEventConfirmation = sqlobj.ExecuteSP("Proc_Events", new SqlParameter() { ParameterName = "@i", SqlDbType = SqlDbType.Int, Value = 5 }, new SqlParameter() { ParameterName = "@RSN", SqlDbType = SqlDbType.BigInt, Value = RSN }); if (dsEventConfirmation.Tables[0].Rows.Count > 0) { string strchkdate = "1900-01-01"; if (Convert.ToDateTime(dsEventConfirmation.Tables[0].Rows[0]["FromDate"].ToString()) > Convert.ToDateTime(strchkdate)) { FromDate.SelectedDate = Convert.ToDateTime(dsEventConfirmation.Tables[0].Rows[0]["FromDate"].ToString()); TillDate.SelectedDate = Convert.ToDateTime(dsEventConfirmation.Tables[0].Rows[0]["TillDate"].ToString()); } if (dsEventConfirmation.Tables[0].Rows[0]["Time"].ToString() == "" || dsEventConfirmation.Tables[0].Rows[0]["Time"].ToString() == null) { dtpFromTime.SelectedDate = null; } else { dtpFromTime.SelectedDate = DateTime.Parse(dsEventConfirmation.Tables[0].Rows[0]["Time"].ToString()); } txtEventName.Text = dsEventConfirmation.Tables[0].Rows[0]["EventName"].ToString(); txtdesc.Text = dsEventConfirmation.Tables[0].Rows[0]["Description"].ToString(); TxtImge.Text = dsEventConfirmation.Tables[0].Rows[0]["Image"].ToString(); string stvalue = dsEventConfirmation.Tables[0].Rows[0]["Status"].ToString(); ddlupstatus.SelectedValue = dsEventConfirmation.Tables[0].Rows[0]["Status"].ToString(); btnUpdate.Visible = true; btnAddEvent.Visible = false; lblcstatus.Visible = true; ddlupstatus.Visible = true; } dsEventConfirmation.Dispose(); } else if (e.CommandName == "Events") { RSN = Convert.ToInt64(e.CommandArgument.ToString()); Session["RSN"] = RSN.ToString(); DataSet dsEventConfirmation = sqlobj.ExecuteSP("Proc_Events", new SqlParameter() { ParameterName = "@i", SqlDbType = SqlDbType.Int, Value = 5 }, new SqlParameter() { ParameterName = "@RSN", SqlDbType = SqlDbType.BigInt, Value = RSN }); if (dsEventConfirmation.Tables[0].Rows.Count > 0) { lblEventName.Text = dsEventConfirmation.Tables[0].Rows[0]["EventName"].ToString(); lblEventDate.Text = dsEventConfirmation.Tables[0].Rows[0]["FromDate"].ToString(); } if (dsEventConfirmation.Tables[1].Rows.Count > 0) { lblTotalResident.Text = "(" + dsEventConfirmation.Tables[1].Rows[0]["NoofResidnts"].ToString() + ")"; } if (dsEventConfirmation.Tables[2].Rows.Count > 0) { lblTotalAttending.Text = "(" + dsEventConfirmation.Tables[2].Rows[0]["Attending"].ToString() + ")"; } if (dsEventConfirmation.Tables[3].Rows.Count > 0) { lblTotalAttended.Text = "(" + dsEventConfirmation.Tables[3].Rows[0]["Attended"].ToString() + ")"; } dsEventConfirmation.Dispose(); rwEventRating.Visible = true; } else if (e.CommandName == "Image") { //string jsFunc = "OpenModelPopup(" + e.CommandArgument.ToString() + ")"; //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "myJsFn", jsFunc, true); string imagename = "280616090653_city.jpg"; ScriptManager.RegisterStartupScript(this, this.Page.GetType(), "updatePanel1Script", "javascript:OpenModelPopup(" + imagename.ToString() + ")", true); } else { LoadGrid(); } }
protected void LnkEditItem_Click(object sender, EventArgs e) { try { DataSet dsDT2 = null; dsDT2 = sqlobj.ExecuteSP("GetServerDateTime"); DateTime now = Convert.ToDateTime(dsDT2.Tables[0].Rows[0][0]); btnUpdate.Visible = true; btnSave.Visible = false; LinkButton lnkEdititemBtn = (LinkButton)sender; GridDataItem row = (GridDataItem)lnkEdititemBtn.NamingContainer; string RSN; RSN = row.Cells[3].Text; hdnRSN.Value = RSN.ToString(); SqlProcsNew proc = new SqlProcsNew(); DataSet dsDT = sqlobj.ExecuteSP("Proc_CheckinandoutAll", new SqlParameter() { ParameterName = "@i", SqlDbType = SqlDbType.Int, Value = 8 }, new SqlParameter() { ParameterName = "@RSN", SqlDbType = SqlDbType.Decimal, Value = RSN }); cmbResident.SelectedValue = dsDT.Tables[0].Rows[0]["RTRSN"].ToString(); txtDoorNo.Text = dsDT.Tables[0].Rows[0]["DoorNo"].ToString(); txtMobileNo.Text = dsDT.Tables[0].Rows[0]["MobileNo"].ToString(); dtpFromDate.SelectedDate = Convert.ToDateTime(dsDT.Tables[0].Rows[0]["CheckOutDate"].ToString()); dtpFromTime.SelectedDate = Convert.ToDateTime(dsDT.Tables[0].Rows[0]["CheckOutTime"].ToString()); txtRemarks.Text = dsDT.Tables[0].Rows[0]["Remarks"].ToString(); //dtpTillDate.MinDate = Convert.ToDateTime(dtpFromDate.SelectedDate); //dtpTillDate.MaxDate = now; DateTime d1 = Convert.ToDateTime(dtpFromDate.SelectedDate); DateTime d2 = Convert.ToDateTime(now); TimeSpan t = d2 - d1; double NrOfDays = t.TotalDays; if (NrOfDays < 0) { dtpTillDate.MinDate = Convert.ToDateTime(dtpFromDate.SelectedDate); dtpTillDate.MaxDate = Convert.ToDateTime(dtpFromDate.SelectedDate); dtpTillDate.SelectedDate = Convert.ToDateTime(dtpFromDate.SelectedDate); } else { dtpTillDate.MinDate = Convert.ToDateTime(dtpFromDate.SelectedDate); dtpTillDate.MaxDate = now; dtpTillDate.SelectedDate = now; } trCheckIn.Visible = true; cmbResident.Enabled = false; dtpFromDate.Enabled = false; dtpFromTime.Enabled = false; } catch (Exception ex) { WebMsgBox.Show(ex.Message); } }