protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Title = "Tsunami ARMS - Room Allotment"; try { n = int.Parse(Session["userid"].ToString()); } catch { n = 1; Session["userid"] = n.ToString(); } string selectdate = "SELECT DISTINCT DATE_FORMAT(reservedate,'%d-%m-%Y') AS 'reservedate' FROM t_roomreservation_generaltdbtemp WHERE (DATE_FORMAT(reservedate,'%Y-%m-%d')) >= CURDATE()"; DataTable dtselect_date = objcls.DtTbl(selectdate); DataRow rowdate = dtselect_date.NewRow(); rowdate["reservedate"] = "-1"; rowdate["reservedate"] = "--Select--"; dtselect_date.Rows.InsertAt(rowdate, 0); cmbReserve.DataSource = dtselect_date; cmbReserve.DataBind(); string selecttype = "SELECT id,TYPE FROM p_type_of_user where status=0"; DataTable dtselect_type = objcls.DtTbl(selecttype); DataRow rowtype = dtselect_type.NewRow(); rowtype["id"] = "-1"; rowtype["TYPE"] = "--Select--"; dtselect_type.Rows.InsertAt(rowtype, 0); cmbreservetype.DataSource = dtselect_type; cmbreservetype.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string q_counter = "SELECT counter_id,counter_no FROM m_sub_counter ORDER BY counter_id ASC"; DataTable dt_counter = objcls.DtTbl(q_counter); DataRow dr = dt_counter.NewRow(); dr["counter_no"] = "--Select--"; dr["counter_id"] = "-1"; dt_counter.Rows.InsertAt(dr, 0); cmbCounter.DataSource = dt_counter; cmbCounter.DataBind(); cmbCounter.Enabled = false; string q_status = "SELECT id,receipt_status FROM m_receipt_status WHERE rowstatus=0"; DataTable dt_status = objcls.DtTbl(q_status); DataRow dr_status = dt_status.NewRow(); dr_status["receipt_status"] = "--Select--"; dr_status["id"] = "-1"; dt_status.Rows.InsertAt(dr_status, 0); cmbStatus.DataSource = dt_status; cmbStatus.DataBind(); strConnection = obj.ConnectionString(); } }
//private static string datenew() //{ // DateTime getYear = DateTime.Now; // int curYear = getYear.Year; // string date = getYear.ToString("yyyy-MM-dd") + ' ' + getYear.ToString("HH:mm:ss"); // return date; //} public void gridbind() { string gv = @"select inmates_id AS inmates_id,p_type_of_user.type AS policy_type,m_sub_room_category.room_cat_name AS room_category,date_format(fromdate,'%d-%m-%Y') AS fromdate,date_format(todate,'%d-%m-%Y') AS todate,num_of_inmates AS num_of_inmates,max_num_of_add_inmates AS max_num_of_add_inmates from t_policy_numberofinmates,p_type_of_user,m_sub_room_category where p_type_of_user.id=t_policy_numberofinmates.policy_type and m_sub_room_category.room_cat_id=t_policy_numberofinmates.room_category and t_policy_numberofinmates.rowstatus!=2"; DataTable dt_select = objcls.DtTbl(gv); //DataTable dt_select = objcls.DtTbl("select inmates_id AS p_id,room_category AS room_category,allocation_request AS allocation_request,num_of_inmates AS num_of_inmates,max_num_of_add_inmates AS max_num_of_add_inmates,policy_type AS policy_type,date_format(fromdate,'%d-%m-%Y') AS fromdate,date_format(todate,'%d-%m-%Y') AS todate from t_policy_numberofinmates where rowstatus=0"); gv_details.DataSource = dt_select; gv_details.DataBind(); }
protected void gv_details_SelectedIndexChanged(object sender, EventArgs e) { int i = gv_details.SelectedIndex; DataTable dt_type = objcls.DtTbl("select id from p_type_of_user where type='" + gv_details.Rows[i].Cells[3].Text + "'"); ddltype.SelectedValue = dt_type.Rows[0]["id"].ToString(); txtdate.Text = gv_details.Rows[i].Cells[1].Text; txtrelease.Text = gv_details.Rows[i].Cells[4].Text; txtcancel.Text = gv_details.Rows[i].Cells[5].Text; }
private void gridbind() { // DataTable dt_select = objcls.DtTbl("select housekeep_pid AS 'pid',level AS 'level',date_format(fromdate,'%d-%m-%Y') AS f_date,date_format(todate,'%d-%m-%Y')AS t_date,time As time,policy_id AS poltype,createdby AS cre_by,date_format(createdon,'%d-%m-%Y') AS cre_on,updatedby AS upd_by,date_format(updatedon,'%d-%m-%Y') AS upd_on,rowstatus AS row_status from t_policy_housekeep"); DataTable dt_select = objcls.DtTbl("select id AS 'id',m_sub_cmp_urgency.urgname AS 'level',date_format(fromdate,'%d-%m-%Y') AS f_date,date_format(todate,'%d-%m-%Y')AS t_date,time AS time,m_sub_cmp_policy.policy AS poltype from t_policy_housekeep,m_sub_cmp_policy,m_sub_cmp_urgency where t_policy_housekeep.rowstatus=0 and m_sub_cmp_urgency.urg_cmp_id=t_policy_housekeep.level and m_sub_cmp_policy.policy_id=t_policy_housekeep.policy"); if (dt_select.Rows.Count > 0) { gv_details.DataSource = dt_select; gv_details.DataBind(); con.Close(); } }
protected void gv_details_SelectedIndexChanged(object sender, EventArgs e) { int i = gv_details.SelectedIndex; txtdate.Text = gv_details.Rows[i].Cells[1].Text; txttodate.Text = gv_details.Rows[i].Cells[2].Text; DataTable dt_type = objcls.DtTbl("select id from p_type_of_user where type='" + gv_details.Rows[i].Cells[3].Text + "'"); cmbtype.SelectedValue = dt_type.Rows[0]["id"].ToString(); DataTable dt_clubbing = objcls.DtTbl("select id from p_clubbing_status where clubbing='" + gv_details.Rows[i].Cells[4].Text + "'"); cmbclubbing.SelectedValue = dt_clubbing.Rows[0]["id"].ToString(); }
protected void gv_details_SelectedIndexChanged(object sender, EventArgs e) { string id = gv_details.SelectedRow.Cells[0].Text; txtdate.Text = gv_details.SelectedRow.Cells[1].Text; txtrate.Text = gv_details.SelectedRow.Cells[4].Text; DataTable dt_category = objcls.DtTbl("select room_cat_id from m_sub_room_category where room_cat_name='" + gv_details.SelectedRow.Cells[2].Text + "'"); cmbroom.SelectedValue = dt_category.Rows[0]["room_cat_id"].ToString(); DataTable dt_damage = objcls.DtTbl("select id from m_damage where damages='" + gv_details.SelectedRow.Cells[3].Text + "'"); cmbdamage.SelectedValue = dt_damage.Rows[0]["id"].ToString(); }
protected void Page_Load(object sender, EventArgs e) { try { userid = Convert.ToInt32(Session["userid"]); } catch { } if (!Page.IsPostBack) { Title = "Tsunami ARMS - Reservation Date Policy Policy"; LoadPolicyTypes(); loadalterstatus(); loadcancel(); DataTable dtt1f = objcls.DtTbl("select season_sub_id,seasonname from m_sub_season"); DataRow row1 = dtt1f.NewRow(); row1["season_sub_id"] = "-1"; row1["seasonname"] = "--Select--"; dtt1f.Rows.InsertAt(row1, 0); cmbseason.DataSource = dtt1f; cmbseason.DataBind(); gridbind(); string fh = @"select season_sub_id from m_season where curdate() between startdate and enddate"; DataTable dt_select = objcls.DtTbl(fh); if (dt_select.Rows.Count > 0) { cmbseason.SelectedValue = dt_select.Rows[0][0].ToString(); } } }
public void gridbind() { string gv = @"select p_alter_room_allocation.id,date_format(from_date,'%d-%m-%Y') AS 'From date',date_format(to_date,'%d-%m-%Y') AS 'To date',p_type_of_user.type,p_extra_billing.billing from p_alter_room_allocation,p_extra_billing,p_type_of_user where p_type_of_user.id=p_alter_room_allocation.type_of_allocation and p_extra_billing.id=p_alter_room_allocation.extra_billing and p_alter_room_allocation.row_status!=2"; DataTable dt_select = objcls.DtTbl(gv); if (dt_select.Rows.Count > 0) { gv_details.DataSource = dt_select; gv_details.DataBind(); } else { ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowNoData();", true); } }
protected void gv_details_SelectedIndexChanged(object sender, EventArgs e) { int i = gv_details.SelectedIndex; string id = gv_details.Rows[i].Cells[0].Text; DataTable dt_check = objcls.DtTbl("select id from p_proposed_check_in where proposed_check_in='" + gv_details.Rows[i].Cells[4].Text + "'"); ddlcheck.SelectedValue = dt_check.Rows[0]["id"].ToString(); DataTable dt_payment = objcls.DtTbl("select id from p_payment where payment='" + gv_details.Rows[i].Cells[5].Text + "'"); ddlpayment.SelectedValue = dt_payment.Rows[0]["id"].ToString(); DataTable dt_type = objcls.DtTbl("select id from p_type_of_user where type='" + gv_details.SelectedRow.Cells[3].Text + "'"); ddltype.SelectedValue = dt_type.Rows[0]["id"].ToString(); txtcancel.Text = gv_details.Rows[i].Cells[6].Text; txtdate.Text = gv_details.Rows[i].Cells[1].Text; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { clsCommon obj = new clsCommon(); strConnection = obj.ConnectionString(); con.ConnectionString = strConnection; ViewState["option"] = "NIL"; ViewState["action"] = "NIL"; Title = "Tsunami ARMS - Inherit policy "; check(); con = obje.NewConnection(); try { string username = Session["username"].ToString(); OdbcCommand ccm = new OdbcCommand(); ccm.CommandType = CommandType.StoredProcedure; ccm.Parameters.AddWithValue("tblname", "m_user"); ccm.Parameters.AddWithValue("attribute", "user_id"); ccm.Parameters.AddWithValue("conditionv", "username='******'"); OdbcDataAdapter da3 = new OdbcDataAdapter(ccm); DataTable dtt = new DataTable(); dtt = obje.SpDtTbl("CALL selectcond(?,?,?)", ccm); id = int.Parse(dtt.Rows[0][0].ToString()); Session["userid"] = id; } catch { id = 0; Session["userid"] = id; } con = obje.NewConnection(); OdbcCommand cmd10 = new OdbcCommand("select distinct m_sub_season.seasonname from m_sub_season,m_season where m_sub_season.season_sub_id=m_season.season_sub_id " + " and m_season.rowstatus<>2 and m_season.is_current=1", con); OdbcDataReader rd5 = cmd10.ExecuteReader(); while (rd5.Read()) { lstSeasons.Items.Add(rd5[0].ToString()); } string inhseasons = @"SELECT m_season.season_id AS 'id',CONCAT(m_sub_season.seasonname,' ',DATE_FORMAT(m_season.startdate,'%Y')) AS 'season' FROM m_season INNER JOIN m_sub_season ON m_season.season_sub_id=m_sub_season.season_sub_id AND m_season.startdate < CURDATE() ORDER BY m_season.startdate DESC LIMIT 15"; DataTable dtinherit = obje.DtTbl(inhseasons); if (dtinherit.Rows.Count > 0) { DataRow drinherit = dtinherit.NewRow(); drinherit["id"] = "-1"; drinherit["season"] = "--select--"; dtinherit.Rows.InsertAt(drinherit, 0); ddlinhseasons.DataSource = dtinherit; ddlinhseasons.DataBind(); } else { } rd5.Close(); con.Close(); } }
public static DataTable nextchecktime(string outd, int room) { commonClass obcls = new commonClass(); string check = @"(SELECT CAST(allocdate AS CHAR(20)) AS allocdate FROM t_roomallocation WHERE room_id=" + room + " AND allocdate>STR_TO_DATE('" + outd + "','%d/%m/%Y %l:%i %p')) UNION (SELECT CAST(reservedate AS CHAR(20)) AS allocdate FROM t_roomreservation WHERE room_id=" + room + " AND reservedate>STR_TO_DATE('" + outd + "','%d/%m/%Y %l:%i %p')) UNION (SELECT CAST(CONCAT(fromdate,' ',fromtime) AS CHAR(20)) AS allocdate FROM t_manage_room WHERE room_id=" + room + " AND CONCAT(fromdate,'', fromtime)>STR_TO_DATE('" + outd + "','%d/%m/%Y %l:%i %p') AND rowstatus <> 2) ORDER BY allocdate"; DataTable dt_check = obcls.DtTbl(check); return(dt_check); }
public static DataTable previouschecktime(string ind, int room) { commonClass obcls = new commonClass(); string check = @"(SELECT CAST(exp_vecatedate AS CHAR(20)) AS exp_vecatedate FROM t_roomallocation WHERE room_id=" + room + " AND exp_vecatedate<STR_TO_DATE('" + ind + "','%d/%m/%Y %l:%i %p')) UNION (SELECT CAST(expvacdate AS CHAR(20)) AS exp_vecatedate FROM t_roomreservation WHERE room_id=" + room + " AND expvacdate<STR_TO_DATE('" + ind + "','%d/%m/%Y %l:%i %p')) UNION (SELECT CAST(CONCAT(todate,' ',totime) AS CHAR(20)) AS exp_vecatedate FROM t_manage_room WHERE room_id=" + room + " AND CONCAT(todate,'', totime)<STR_TO_DATE('" + ind + "','%d/%m/%Y %l:%i %p') AND rowstatus <> 2) ORDER BY exp_vecatedate desc"; DataTable dt_check = obcls.DtTbl(check); return(dt_check); }
protected void btnrelease_Click(object sender, EventArgs e) { int i = gv_details.SelectedIndex; if (i == -1) { ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowRequired();", true); } else { string id = Session["reserve_no"].ToString(); string tr = @"update t_roomreservation set status_reserve=3 where reserve_no='" + id + "'"; objcls.exeNonQuery(tr); string gs = @"update m_room set roomstatus=1 where room_id='" + gv_details.Rows[i].Cells[0].Text + "'"; objcls.exeNonQuery(gs); view(); //ds = Session["dataval"].ToString(); string ee = @"SELECT swaminame,inmates_email FROM t_roomreservation_generaltdbtemp WHERE reserve_no='" + id + "'"; DataTable dt_name = objcls.DtTbl(ee); string nn = dt_name.Rows[0][0].ToString(); string ff = dt_name.Rows[0][1].ToString(); //string nn = txtname.Text; string to = "*****@*****.**"; string pdfFilePath = Server.MapPath("."); //objcls.Email(to, "tsunami123", ee, "Your Registration is confirmed! ", "Sir " + nn + ", \n Please take the print of this confirmation letter for your future purpose"); //var smtp = new System.Net.Mail.SmtpClient(); MailMessage msg = new MailMessage(); msg.From = new MailAddress("*****@*****.**"); msg.To.Add(ff); msg.Subject = "Response for your registration!"; msg.Body = "Sir " + nn + ", \n \n \t\t" + "Due to reservation time gets end,your room is cancelled!.\n"; SmtpClient Sc = new SmtpClient("smtp.gmail.com"); SmtpClient Sp = new SmtpClient("smtp.yahoo.com"); SmtpClient Sh = new SmtpClient("smtp.hotmail.com"); SmtpClient Sr = new SmtpClient("smtp.rediff.com"); Sc.Port = 587; Sc.EnableSsl = true; Sc.UseDefaultCredentials = true; Sc.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network; Sc.Credentials = new NetworkCredential("*****@*****.**", "test2345"); Sp.Credentials = new NetworkCredential("*****@*****.**", "test2345"); Sh.Credentials = new NetworkCredential("*****@*****.**", "test2345"); Sr.Credentials = new NetworkCredential("*****@*****.**", "test2345"); Sc.Send(msg); view(); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowRelease();", true);; } }
private void gridbind() { //DataTable dt_select = objcls.DtTbl("select pastallocation_id AS 'alloc_id',allocation_request AS 'alloc_request',date_format(fromdate,'%d-%m-%Y') AS frm_date,date_format(todate,'%d-%m-%Y') AS to_date,max_roomallocate AS max_allocate,checkingid AS che_id,createdby AS cre_by,date_format(,'%d-%m-%Y') AS cre_on,updatedby AS upd_by,date_format(updatedon,'%d-%m-%Y') AS upd_on,rowstatus AS row_status from t_policy_pastallocation"); DataTable dt_select = objcls.DtTbl("select pastallocation_id AS 'alloc_id',allocation_request AS 'alloc_request',date_format(fromdate,'%d-%m-%Y') AS frm_date,date_format(todate,'%d-%m-%Y') AS to_date,max_roomallocate AS max_allocate,checkingid AS che_id from t_policy_pastallocation where rowstatus=0"); if (dt_select.Rows.Count > 0) { GridView1.DataSource = dt_select; GridView1.DataBind(); con.Close(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string payment = @"SELECT payment_id,payment_mode FROM payment_mode"; DataTable dt_payment = objcls.DtTbl(payment); if (dt_payment.Rows.Count > 0) { DataRow dr = dt_payment.NewRow(); dr["payment_id"] = "-1"; dr["payment_mode"] = "--Select--"; dt_payment.Rows.InsertAt(dr, 0); ddlMode.DataSource = dt_payment; ddlMode.DataBind(); } else { ddlMode.DataSource = null; ddlMode.DataBind(); okmessage("Tsunami ARMS - Warning", "Payment mode not defined"); } } }
private void Load() { OdbcCommand cmdS = new OdbcCommand(); cmdS.Parameters.AddWithValue("tblname", "m_season"); cmdS.Parameters.AddWithValue("attribute", "season_id,season_sub_id, DATE_FORMAT(CAST(startdate AS CHAR(12)),'%d/%m/%Y' ) AS 'startdate',DATE_FORMAT(CAST(enddate AS CHAR(12)),'%d/%m/%Y' ) AS 'enddate'"); cmdS.Parameters.AddWithValue("conditionv", "curdate() between startdate and enddate and is_current=" + 1 + " and rowstatus<>" + 2 + ""); DataTable dtS = new DataTable(); dtS = objcls.SpDtTbl("CALL selectcond(?,?,?)", cmdS); if (dtS.Rows.Count > 0) { int curseason1 = int.Parse(dtS.Rows[0]["season_id"].ToString()); Session["season"] = curseason1.ToString(); Session["seasonid"] = dtS.Rows[0]["season_id"].ToString(); Session["seasonsubid"] = dtS.Rows[0]["season_sub_id"].ToString(); txtfromdate.Text = dtS.Rows[0]["startdate"].ToString(); txttodate.Text = dtS.Rows[0]["enddate"].ToString(); DataTable dt_seas = objcls.DtTbl("SELECT season_sub_id,seasonname FROM m_sub_season WHERE season_sub_id = '" + dtS.Rows[0]["season_sub_id"].ToString() + "'"); if (dt_seas.Rows.Count > 0) { ddlseason.DataSource = dt_seas; ddlseason.DataBind(); } string unclaimed = @"SELECT IFNULL(SUM(amount),0) -IFNULL((SELECT IFNULL(SUM(amount),0) AS 'Deposit' FROM t_unclaimedremittance,m_season WHERE t_unclaimedremittance.DATE BETWEEN m_season.startdate AND m_season.enddate AND m_season.season_id='" + Session["seasonid"] + "' GROUP BY m_season.season_id),0) AS 'Unclaimed' FROM t_daily_transaction,m_season WHERE t_daily_transaction.ledger_id = '2' AND t_daily_transaction.DATE BETWEEN m_season.startdate AND m_season.enddate AND m_season.season_id='" + Session["seasonid"] + "' GROUP BY m_season.season_id"; DataTable dt_unclaimed = objcls.DtTbl(unclaimed); if (dt_unclaimed.Rows.Count > 0) { txtunclaimed.Text = dt_unclaimed.Rows[0][0].ToString(); } else { txtunclaimed.Text = "0"; } } else { obc.ShowAlertMessage(this, "Season not found"); } DataTable dt_nw = objcls.DtTbl("select date_format(now(),'%d/%m/%Y') as 'dt',date_format(now(),'%l:%i:%s %p') as 'time'"); txtdate.Text = dt_nw.Rows[0][0].ToString(); }
public static DataTable roomavailable(string chkin, string chkout, int cat, int build) { commonClass obcls = new commonClass(); string sel = @"(SELECT distinct cast(roomno AS CHAR(25)) AS 'roomno',t_roomreservation.room_id FROM t_roomreservation,m_room WHERE t_roomreservation.reservedate >= DATE_ADD('" + chkout + "' ,INTERVAL 2 HOUR)" + " AND t_roomreservation.room_id NOT IN (SELECT t_roomreservation.room_id FROM t_roomreservation WHERE reservedate between DATE_ADD('" + chkin + "',INTERVAL -2 HOUR) AND DATE_ADD('" + chkout + "',INTERVAL +2 HOUR) OR expvacdate BETWEEN DATE_ADD('" + chkin + "',INTERVAL -2 HOUR) AND DATE_ADD('" + chkout + "',INTERVAL +2 HOUR))" + " AND t_roomreservation.room_id=m_room.room_id" + " AND m_room.room_cat_id=" + cat + " AND m_room.build_id=" + build + "" + " ORDER BY t_roomreservation.reservedate)" + " UNION " + " (SELECT distinct CAST(m_room.roomno AS CHAR(25)) AS 'roomno',m_room.room_id FROM m_room" + " WHERE m_room.room_cat_id=" + cat + " AND m_room.build_id=" + build + " AND m_room.rowstatus <> 2 AND m_room.room_id NOT IN (SELECT t_roomreservation.room_id FROM t_roomreservation WHERE t_roomreservation.reservedate" + " BETWEEN DATE_ADD('" + chkin + "',INTERVAL -2 HOUR) AND DATE_ADD('" + chkout + "',INTERVAL +2 HOUR) OR t_roomreservation.expvacdate BETWEEN DATE_ADD('" + chkin + "',INTERVAL -2 HOUR) AND DATE_ADD('" + chkout + "',INTERVAL +2 HOUR))" + " AND m_room.room_id NOT IN (SELECT t_roomallocation.room_id FROM t_roomallocation WHERE t_roomallocation.allocdate" + " BETWEEN DATE_ADD('" + chkin + "',INTERVAL -2 HOUR) AND DATE_ADD('" + chkout + "',INTERVAL +2 HOUR) OR t_roomallocation.exp_vecatedate BETWEEN DATE_ADD('" + chkin + "',INTERVAL -2 HOUR) AND DATE_ADD('" + chkout + "',INTERVAL +2 HOUR))" + " AND m_room.room_id NOT IN " + " (SELECT room_id FROM t_manage_room WHERE DATE_FORMAT(CONCAT(fromdate,'" + " " + "',fromtime),'%Y/%m/%d %T') BETWEEN '" + chkin + "' AND '" + chkout + "' OR DATE_FORMAT(CONCAT(todate,'" + " " + "',totime),'%Y/%m/%d %T') BETWEEN '" + chkin + "' AND '" + chkout + "')" + " ORDER BY m_room.room_id ASC)"; DataTable dt_sel = obcls.DtTbl(sel); return(dt_sel); }
protected void btnsave_Click(object sender, EventArgs e) { int pk = 0; pk = objcls.PK_exeSaclarInt("id", "m_rent"); pk = pk + 1; string start = @"select ifnull(max(end_duration),0) from m_rent where room_category=" + cmbroom.SelectedValue + " and reservation_type=" + cmbreserve.SelectedValue + ""; DataTable dt_start = objcls.DtTbl(start); if (dt_start.Rows.Count > 0) { txtstartduration.Text = dt_start.Rows[0][0].ToString(); } else { txtstartduration.Text = "0"; } string gh = @"insert into m_rent(id,reservation_type,room_category,start_duration,end_duration,reserve_charge,rent,security_deposit,created_on,created_by,updated_on,updated_by,row_status,extended_penality)values('" + pk + "'," + cmbreserve.SelectedValue + "," + cmbroom.SelectedValue + "," + txtstartduration.Text + "," + txtendduration.Text + "," + txtcharge.Text + "," + txtrent.Text + "," + txtsecurity.Text + ",curdate(),'" + userid + "',curdate(),'" + userid + "',0," + txtpenality.Text + ")"; objcls.exeNonQuery(gh); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); gridbind1(); gridbind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { pnlr.Visible = false; lbl1.Visible = false; string selectdate = "SELECT DISTINCT DATE_FORMAT(reservedate,'%d-%m-%Y') AS 'reservedate' FROM t_roomreservation_generaltdbtemp WHERE (DATE_FORMAT(reservedate,'%Y-%m-%d')) >= CURDATE()"; DataTable dtselect_date = objcls.DtTbl(selectdate); DataRow rowdate = dtselect_date.NewRow(); rowdate["reservedate"] = "-1"; rowdate["reservedate"] = "--Select--"; dtselect_date.Rows.InsertAt(rowdate, 0); cmbReserve.DataSource = dtselect_date; cmbReserve.DataBind(); } }
private void bindmain() { string selectbuild = @" SELECT DISTINCT build_id,buildingname FROM m_sub_building WHERE rowstatus='0' AND build_id BETWEEN 1 AND 12"; dfg = objcls.DtTbl(selectbuild); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region login if (Session["logintime"] != null) { login = Session["logintime"].ToString(); //txtlogintime.Text = DateTime.Parse(login).ToShortTimeString(); } else { Response.Redirect("~/Login frame.aspx"); } #endregion #region counter Session["computerip"] = System.Web.HttpContext.Current.Request.UserHostAddress; string counterTest = Session["computerip"].ToString(); OdbcCommand cmdCounter = new OdbcCommand(); cmdCounter.Parameters.AddWithValue("tblname", "m_sub_counter"); cmdCounter.Parameters.AddWithValue("attribute", "counter_id"); cmdCounter.Parameters.AddWithValue("conditionv", "counter_ip='" + Session["computerip"].ToString() + "'"); DataTable dtCounter = new DataTable(); dtCounter = objcls.SpDtTbl("CALL selectcond(?,?,?)", cmdCounter); if (dtCounter.Rows.Count > 0) { Session["counter"] = dtCounter.Rows[0]["counter_id"].ToString(); counter = ""; } else { counter = "nil"; okmessage("Tsunami ARMS - Confirmation", "Counter not set for the machine"); this.ScriptManager1.SetFocus(btnOk); } #endregion Title = "Tsunami ARMS - Alterations"; #region state combo OdbcCommand cmdState = new OdbcCommand(); cmdState.Parameters.AddWithValue("tblname", "m_sub_state"); cmdState.Parameters.AddWithValue("attribute", "statename,state_id"); cmdState.Parameters.AddWithValue("conditionv", "rowstatus<>" + 2 + " order by statename asc"); DataTable dtState = new DataTable(); dtState = objcls.SpDtTbl("CALL selectcond(?,?,?)", cmdState); cmbState.DataSource = dtState; cmbState.DataBind(); #endregion #region IDproof combo DataTable dt_id = objcls.DtTbl("SELECT pid,idproof FROM m_idproof"); if (dt_id.Rows.Count > 0) { DataRow dr = dt_id.NewRow(); dr["pid"] = "-1"; dr["idproof"] = "--select--"; dt_id.Rows.InsertAt(dr, 0); cmbIDp.DataSource = dt_id; cmbIDp.DataBind(); } #endregion #region Building combo OdbcCommand cmdBuild = new OdbcCommand(); cmdBuild.Parameters.AddWithValue("tblname", "m_sub_building as build,m_room as room"); cmdBuild.Parameters.AddWithValue("attribute", "distinct build.buildingname,build.build_id"); cmdBuild.Parameters.AddWithValue("conditionv", "room.build_id=build.build_id and room.rowstatus<>" + 2 + " order by build.buildingname asc"); DataTable dtB = new DataTable(); dtB = objcls.SpDtTbl("CALL selectcond(?,?,?)", cmdBuild); DataRow row = dtB.NewRow(); row["build_id"] = "-1"; row["buildingname"] = "--Select--"; dtB.Rows.InsertAt(row, 0); cmbBuild.DataSource = dtB; cmbBuild.DataBind(); cmbaltbulilding.DataSource = dtB; cmbaltbulilding.DataBind(); #endregion #region Rooms combo OdbcCommand cmdRo = new OdbcCommand(); cmdRo.Parameters.AddWithValue("tblname", "m_room"); cmdRo.Parameters.AddWithValue("attribute", "distinct cast(roomno AS CHAR(25)) as roomno,room_id"); cmdRo.Parameters.AddWithValue("conditionv", " rowstatus<>" + 2 + ""); DataTable dtt = new DataTable(); dtt = objcls.SpDtTbl("CALL selectcond(?,?,?)", cmdRo); DataRow dtr = dtt.NewRow(); dtr["room_id"] = "-1"; dtr["roomno"] = "--select--"; dtt.Rows.InsertAt(dtr, 0); cmbRooms.DataSource = dtt; cmbRooms.DataBind(); #endregion #region Districts combo OdbcCommand cmdDi = new OdbcCommand(); cmdDi.Parameters.AddWithValue("tblname", "m_sub_district"); cmdDi.Parameters.AddWithValue("attribute", "districtname,district_id"); cmdDi.Parameters.AddWithValue("conditionv", " rowstatus<>" + 2 + " order by districtname asc"); DataTable dtDi = new DataTable(); dtDi = objcls.SpDtTbl("CALL selectcond(?,?,?)", cmdDi); DataRow row8 = dtDi.NewRow(); row8["district_id"] = "-1"; row8["districtname"] = "--Select--"; dtDi.Rows.InsertAt(row8, 0); cmbDists.DataSource = dtDi; cmbDists.DataBind(); #endregion OdbcCommand cmdRes = new OdbcCommand(); cmdRes.Parameters.AddWithValue("tblname", "m_sub_reason"); cmdRes.Parameters.AddWithValue("attribute", "distinct reason,reason_id"); cmdRes.Parameters.AddWithValue("conditionv", "form_id=" + 14 + " and rowstatus<>" + 2 + ""); DataTable dtRes = new DataTable(); dtRes = objcls.SpDtTbl("CALL selectcond(?,?,?)", cmdRes); DataRow row2 = dtRes.NewRow(); row2["reason_id"] = "-1"; row2["reason"] = "--Select--"; dtRes.Rows.InsertAt(row2, 0); cmbReason.DataSource = dtRes; cmbReason.DataBind(); } }
private void authenticate() { ViewState["check"] = (1).ToString(); Session["logintime"] = DateTime.Now; string s = Loginframe.UserName; string psswd = Loginframe.Password; string userid; try { OdbcCommand login = new OdbcCommand(); login.Parameters.AddWithValue("tblname", "m_user"); login.Parameters.AddWithValue("attribute", "username,password,level,user_id,staff_id,defaultform"); login.Parameters.AddWithValue("conditionv", "username='******' and rowstatus<>" + 2 + ""); OdbcDataReader rd1 = objDAL.SpGetReader("CALL selectcond(?,?,?)", login); string strHostName = System.Net.Dns.GetHostName(); // string clientIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString(); string clientIPAddress = System.Web.HttpContext.Current.Request.UserHostAddress; string ipaddress = System.Web.HttpContext.Current.Request.UserHostAddress; string counter = @"SELECT counter_no,counter_id FROM m_sub_counter WHERE counter_ip='" + ipaddress + "'"; DataTable dt_counter = objDAL.DtTbl(counter); if (dt_counter.Rows.Count > 0) { Session["counter"] = dt_counter.Rows[0][0].ToString(); Session["counter_id"] = dt_counter.Rows[0][1].ToString(); } if (rd1.Read()) { userid = rd1[3].ToString(); string user = rd1[0].ToString(); string pwd1 = rd1[1].ToString(); string pwd = base64Decode(pwd1); int level = int.Parse(rd1[2].ToString()); int staffid = int.Parse(rd1[4].ToString()); Session["staffid"] = staffid.ToString(); defaultform = int.Parse(rd1[5].ToString()); rd1.Close(); try { OdbcCommand cmdstaff = new OdbcCommand(); cmdstaff.Parameters.AddWithValue("tblname", "m_staff as st,m_sub_designation as desig,m_sub_office as office"); cmdstaff.Parameters.AddWithValue("attribute", "desig.designation,office.office"); cmdstaff.Parameters.AddWithValue("conditionv", "staff_id=" + staffid + " and desig.desig_id=st.desig_id and office.office_id=st.office_id"); OdbcDataReader rdstaff = objDAL.SpGetReader("CALL selectcond(?,?,?)", cmdstaff); if (rdstaff.Read()) { desgination = rdstaff[0].ToString(); office = rdstaff[1].ToString(); } } catch { } if (s.Equals(user)) { if (psswd.Equals(pwd)) { OdbcCommand cmddefaultform = new OdbcCommand(); cmddefaultform.Parameters.AddWithValue("tblname", "m_user as user,m_sub_form as form"); cmddefaultform.Parameters.AddWithValue("attribute", "form.formname"); cmddefaultform.Parameters.AddWithValue("conditionv", "form.form_id=" + defaultform + ""); OdbcDataReader rddefault = objDAL.SpGetReader("CALL selectcond(?,?,?)", cmddefaultform); if (rddefault.Read()) { defaultformname = rddefault[0].ToString(); } DateTime dt = DateTime.Now; string date = dt.ToString("yyyy/MM/dd") + ' ' + dt.ToString("HH:mm:ss"); OdbcCommand cmd11 = new OdbcCommand(); cmd11.Parameters.AddWithValue("tblname", "t_login"); cmd11.Parameters.AddWithValue("attribute", "max(sno)"); DataTable dtt11 = new DataTable(); dtt11 = objDAL.SpDtTbl("call selectdata(?,?)", cmd11); try { int ab = int.Parse(dtt11.Rows[0][0].ToString()); h = int.Parse(dtt11.Rows[0][0].ToString()); h = h + 1; } catch { h = 1; } Session["username"] = Loginframe.UserName; Session["password"] = Loginframe.Password; Session["level"] = level; Session["designation"] = desgination; Session["office"] = office; Session["userid"] = userid; Application["CheckFormLoad"] = 0; Session["CheckFormLoad"] = 0; Session["sno"] = h; OdbcCommand cmd3 = new OdbcCommand(); cmd3.Parameters.AddWithValue("tblname", "t_login"); cmd3.Parameters.AddWithValue("val", "" + h + ",'" + userid + "','" + date + "',null," + 0 + ",'" + strHostName + "','" + clientIPAddress + "'"); try { objDAL.Procedures_void("CALL savedata(?,?)", cmd3); } catch { } string hj = "~/" + defaultformname + ".aspx"; #region CHECK CURRENT DATE try { OdbcCommand cmd246 = new OdbcCommand(); cmd246.Parameters.AddWithValue("tblname", "t_settings"); cmd246.Parameters.AddWithValue("attribute", "count(*)"); cmd246.Parameters.AddWithValue("conditionv", "is_current=1 and curdate() between start_eng_date and end_eng_date "); OdbcDataReader dr = objDAL.SpGetReader("CALL selectcond(?,?,?)", cmd246); while (dr.Read()) { if (int.Parse(dr["count(*)"].ToString()) == 0) { MessageBox.Show("Current date not set", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2, MessageBoxOptions.DefaultDesktopOnly); hj = "settingmaster.aspx"; } } } catch (Exception ex) { } #endregion CHECK CURRENT DATE ViewState["page"] = hj; Loginframe.Visible = false; if (Session["counter"] != null) { lblCounter.Text = "Do you wish to continue in counter- " + Session["counter"].ToString(); } else { lblCounter.Text = "Counter not set, Please contact administrator..,"; } SetFocus(btnYes); this.ModalPopupExtender1.Show(); //Response.Redirect(hj, false); } else { Loginframe.FailureText = "Your login attempt was not successful. Please try again."; lblOk.Text = "Your login attempt was not successful. Please try again."; SetFocus(btnOk); this.ModalPopupExtender2.Show(); } } else { Loginframe.FailureText = "Your login attempt was not successful. Please try again."; lblOk.Text = "Your login attempt was not successful. Please try again."; SetFocus(btnOk); this.ModalPopupExtender2.Show(); } } else { Loginframe.FailureText = "Your login attempt was not successful. Please try again.".ToString(); lblOk.Text = "Your login attempt was not successful. Please try again."; SetFocus(btnOk); this.ModalPopupExtender2.Show(); } } catch { Response.Redirect("~Login frame.aspx"); } }