protected void btnDD_Click(object sender, EventArgs e) { if (gvDetails.SelectedIndex != -1 && txtAmount2.Text != "") { string resno = gvDetails.SelectedRow.Cells[1].Text; string update = @"UPDATE t_roomreservation_generaltdbtemp SET payment_status=3 WHERE reserve_no='" + resno + "'"; int i = objcls.exeNonQuery(update); if (i == 1) { okmessage("Tsunami ARMS - Warning", "Updated successfully"); load(); pdf_chellan(); clear(); } else { okmessage("Tsunami ARMS - Warning", "Error in updation"); } } else { if (gvDetails.SelectedIndex == -1) { okmessage("Tsunami ARMS - Warning", "Select the value from grid"); } else { okmessage("Tsunami ARMS - Warning", "Enter the amount received"); } } }
protected void btnsave_Click(object sender, EventArgs e) { if (txtdate.Text != "" || txtinmates.Text != "" || txtaddinmates.Text != "" || cmbtype.SelectedValue != "" || cmbcategory.SelectedValue != "") { int pk = 0; pk = objcls.PK_exeSaclarInt("inmates_id", "t_policy_numberofinmates"); pk = pk + 1; //double amount = Convert.ToDouble(txtamount.Text); //double inmates=Convert.ToDouble(txtinmates.Text); //double maxinmates=Convert.ToDouble(txtaddinmates.Text); //string totalamount = @"SELECT rent FROM m_rent WHERE id=(select max(id) from m_rent where room_category=" + cmbcategory.SelectedValue + ")"; //DataTable dt_totalamount = objcls.DtTbl(totalamount); //if (dt_totalamount.Rows[0][0].ToString() != "") //{ // amountdt = Convert.ToDouble(dt_totalamount.Rows[0][0].ToString()); // fi_amount = (inmates + maxinmates) / maxinmates * amountdt; //} string gh = @"insert into t_policy_numberofinmates(inmates_id,room_category,num_of_inmates,max_num_of_add_inmates,policy_type,fromdate,todate,createdby,createdon,updatedby,updatedon,rowstatus)values('" + pk + "','" + cmbcategory.SelectedValue + "','" + txtinmates.Text + "','" + txtaddinmates.Text + "','" + cmbtype.SelectedValue + "','" + objcls.yearmonthdate(txtdate.Text) + "','9999-12-30','" + userid + "',curdate(),'" + userid + "',curdate(),0)"; objcls.exeNonQuery(gh); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); int pknew; pknew = pk - 1; objcls.exeNonQuery("update t_policy_numberofinmates set todate='" + objcls.yearmonthdate(txtdate.Text) + "' where inmates_id=" + pknew); gridbind(); } else { ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowRequired();", true); } }
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);; } }
protected void btnedit_Click(object sender, EventArgs e) { int k = gv_details.SelectedIndex; if (k == -1) { ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowNoData();", true); } else { string ds = @"update t_policy_housekeep set level=" + cmbUrgency.SelectedValue + ",fromdate='" + objcls.yearmonthdate(txtdate.Text) + "',time='" + txtperiod.Text + "',policy=" + cmbPolicy.SelectedValue + " where id=" + gv_details.SelectedRow.Cells[0].Text; objcls.exeNonQuery(ds); gridbind(); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowUpdated();", true); } }
protected void btnsave_Click(object sender, EventArgs e) { if (txtstartdate.Text == "" || txtstartchkdate.Text == "" || txtmaxreserve.Text == "" || txtendchkdate.Text == "" || txtclosed.Text == "" || cmbtype.SelectedValue == "" || cmbseason.SelectedValue == "" || cmbcancel.SelectedValue == "" || cmbalter.SelectedValue == "") { ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowRequired();", true); } else { int pk = 0; pk = objcls.PK_exeSaclarInt("id", "p_genpublic_seasons"); pk = pk + 1; string fh = @"select m_season.season_id from m_season where '" + objcls.yearmonthdate(txtstartchkdate.Text) + "' between startdate and enddate"; DataTable dt_select = objcls.DtTbl(fh); string dh = @"insert into p_genpublic_seasons(id,season_id,season_sub_id,r_startdate,in_startdate,in_enddate,alter_status,type_id,max_reserv,day_close,cancel_status,updated_on,updated_by,row_status)values(" + pk + ",'" + dt_select.Rows[0][0].ToString() + "'," + cmbseason.SelectedValue + ",'" + objcls.yearmonthdate(txtstartdate.Text) + "','" + objcls.yearmonthdate(txtstartchkdate.Text) + "','" + objcls.yearmonthdate(txtendchkdate.Text) + "'," + cmbalter.SelectedValue + "," + cmbtype.SelectedValue + "," + txtmaxreserve.Text + "," + txtclosed.Text + ",'" + cmbcancel.SelectedValue + "',curdate(),'" + userid + "',0)"; objcls.exeNonQuery(dh); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); gridbind(); } }
protected void btnsave_Click(object sender, EventArgs e) { if (txtdate.Text == "" || cmbtype.SelectedValue == "") { ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowRequired();", true); } else { int pk = 0; pk = objcls.PK_exeSaclarInt("id", "p_clubbing"); pk = pk + 1; string fh = @"select m_season.season_id from m_season where '" + objcls.yearmonthdate(txtdate.Text) + "' between startdate and enddate"; DataTable dt_select = objcls.DtTbl(fh); string dh = @"insert into p_clubbing(id,season_id,from_date,to_date,reserve_types,clubbing_status,created_on,created_by,updated_on,updated_by,row_status)values(" + pk + "," + dt_select.Rows[0][0].ToString() + ",'" + objcls.yearmonthdate(txtdate.Text) + "','" + objcls.yearmonthdate(txttodate.Text) + "'," + cmbtype.SelectedValue + ",'" + cmbclubbing.SelectedValue + "',curdate(),'" + userid + "', curdate(),'" + userid + "',0)"; objcls.exeNonQuery(dh); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); gridbind(); } }
protected void btnsave_Click(object sender, EventArgs e) { if (txtalter.Text == "" || cmbroom.SelectedValue == "" || cmbseason.SelectedValue == "" || cmbtype.SelectedValue == "") { ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowRequired();", true); } else { int pk = 0; pk = objcls.PK_exeSaclarInt("id", "p_rentdetails"); pk = pk + 1; string season = Session["policyseason"].ToString(); //string fh = @"select distinct season_id from p_genpublic_seasons where season_sub_id=" + cmbseason.SelectedValue + " and type_id=" + cmbtype.SelectedValue + " and (season_id!=0 or season_id!=null)"; //DataTable dt_select = objcls.DtTbl(fh); string dh = @"insert into p_rentdetails(id,season_id,season_sub_id,room_category_id,alter_charges,type_id,updated_on,updated_by,rowstatus)values(" + pk + ",'" + season + "'," + cmbseason.SelectedValue + "," + cmbroom.SelectedValue + "," + txtalter.Text + "," + cmbtype.SelectedValue + ",curdate(),'" + userid + "',0)"; objcls.exeNonQuery(dh); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); gridbind(); } }
protected void btnsave_Click(object sender, EventArgs e) { if (txtdate.Text == "" || txtrate.Text == "" || cmbdamage.SelectedValue == "" || cmbroom.SelectedValue == "") { ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowRequired();", true); } else { int pk = 0; pk = objcls.PK_exeSaclarInt("id", "p_room_damage"); pk = pk + 1; string fh = @"select m_season.season_id from m_season where '" + objcls.yearmonthdate(txtdate.Text) + "' between startdate and enddate"; DataTable dt_select = objcls.DtTbl(fh); string dh = @"insert into p_room_damage(id,season_id,policy_applicable_from,to_date,room_category,damages,rate,updated_on,updated_by,row_status)values(" + pk + ",'" + dt_select.Rows[0][0].ToString() + "','" + objcls.yearmonthdate(txtdate.Text) + "','9999-12-30'," + cmbroom.SelectedValue + "," + cmbdamage.SelectedValue + "," + txtrate.Text + ",curdate(),'" + userid + "',0)"; objcls.exeNonQuery(dh); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); int pknew; pknew = pk - 1; objcls.exeNonQuery("update p_room_damage set to_date='" + objcls.yearmonthdate(txtdate.Text) + "' where id=" + pknew); gridbind(); } }
protected void btnsave_Click(object sender, EventArgs e) { if (txtcancel.Text == "" || txtdate.Text == "" || ddlcheck.SelectedValue == "" || ddlpayment.SelectedValue == "" || ddltype.SelectedValue == "") { ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowRequired();", true); } else { int pk = 0; pk = objcls.PK_exeSaclarInt("id", "p_checking"); pk = pk + 1; string fh = @"select m_season.season_id from m_season where '" + objcls.yearmonthdate(txtdate.Text) + "' between startdate and enddate"; DataTable dt_select = objcls.DtTbl(fh); string dh = @"insert into p_checking(id,season_id,from_date,to_date,reserve_type,proposed_check_in,payment,holding_period,created_on,created_by,updated_on,updated_by,row_status)values(" + pk + ",'" + dt_select.Rows[0][0].ToString() + "','" + objcls.yearmonthdate(txtdate.Text) + "','9999-12-30'," + ddltype.SelectedValue + "," + ddlcheck.SelectedValue + "," + ddlpayment.SelectedValue + "," + txtcancel.Text + ",curdate(),'" + userid + "',curdate(),'" + userid + "',0)"; objcls.exeNonQuery(dh); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); int pknew; pknew = pk - 1; objcls.exeNonQuery("update p_checking set to_date='" + objcls.yearmonthdate(txtdate.Text) + "' where id=" + pknew); gridbind(); } }
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 btnYes_Click(object sender, EventArgs e) { string fund_insert = @"INSERT INTO t_fund_transfer(frm_counter,to_counter,amount,issue_date) VALUES('" + ddlFrom.SelectedValue + "','" + ddlTO.SelectedValue + "','" + txtAmount.Text + "',now())"; int i = objcls.exeNonQuery(fund_insert); if (i == 1) { okmessage("Tsunami ARMS - Warning", "Fund Transfer issue note send successfully"); this.ScriptManager1.SetFocus(btnOk); load(); } else { okmessage("Tsunami ARMS - Warning", "Error in saving"); this.ScriptManager1.SetFocus(btnOk); } }
protected void btnremit_Click(object sender, EventArgs e) { try { if (txtremitamount.Text != "" && txtdate.Text != "") { string insert = @"INSERT INTO `armsapr9`.`t_unclaimedremittance` ( `Date`, `season_id`, `amount`) VALUES ( '" + objcls.yearmonthdate(txtdate.Text) + "','" + Session["seasonid"].ToString() + "', '" + txtremitamount.Text + "');"; objcls.exeNonQuery(insert); txtremitamount.Text = ""; clr(); obc.ShowAlertMessage(this, "Saved successfully"); } } catch { } }
protected void Button4_Click(object sender, EventArgs e) { try { string createddate = objcls.yearmonthdate(cmbReserve.SelectedItem.Text); string daa = createddate.Replace('/', '-'); string type = ""; if (ddltype.SelectedValue == "1") { type = "General"; } else { type = ddltype.SelectedItem.ToString(); } string ss = @"SELECT COUNT(room_category_id) FROM t_roomreservation_generaltdbtemp WHERE room_category_id ='" + ddlcat.SelectedItem.Value + "' AND allot_status = 0 AND NOW() <= reservedate AND NOW() < expvacdate"; DataTable dtcat = objcls.DtTbl(ss); int count = gdbind.Rows.Count; int mm = Convert.ToInt16(dtcat.Rows[0][0].ToString()); if (count > mm) { string da = @"SELECT * FROM t_roomreservation_generaltdbtemp WHERE NOW()<=reservedate AND NOW()<expvacdate AND allot_status = 0 AND room_category_id = '" + ddlcat.SelectedItem.Value + "'"; DataTable dtda = objcls.DtTbl(da); for (int i = 0; i < mm; i++) { CheckBox chk1 = (CheckBox)gdbind.Rows[i].FindControl("chkacc"); if (chk1.Checked == true) { if (dtda.Rows.Count > 0) { fromdate = dtda.Rows[i]["reservedate"].ToString(); todate = dtda.Rows[i]["expvacdate"].ToString(); totaldays = dtda.Rows[i]["total_days"].ToString(); place = dtda.Rows[i]["place"].ToString(); reserve_code = dtda.Rows[i]["reserve_no"].ToString(); name = dtda.Rows[i]["swaminame"].ToString(); } string room = gdbind.Rows[i].Cells[1].Text; string see = @"SELECT room_id FROM m_room WHERE roomno = '" + room + "' AND build_id ='" + ddlbuild.SelectedItem.Value + "' "; DataTable dtsa = objcls.DtTbl(see); DateTime dt5 = DateTime.Now; string date = dt5.ToString("yyyy-MM-dd HH:mm:ss"); fromdate = DateTime.Parse(fromdate).ToString("yyyy-MM-dd HH:mm:ss"); todate = DateTime.Parse(todate).ToString("yyyy-MM-dd HH:mm:ss"); int pk = objcls.PK_exeSaclarInt("reserve_id", "t_roomreservation"); pk = pk + 1; try { n = int.Parse(Session["userid"].ToString()); } catch { n = 1; Session["userid"] = n.ToString(); } string reserveroom = "INSERT INTO t_roomreservation(reserve_id,reserve_type,reserve_mode,swaminame,reservedate,expvacdate,total_days,status_reserve,passmode,createdby,cretaedon,updatedby,updateddate,place,room_id,reserve_no) VALUES ( " + pk + ",'Single','" + type + "','" + name + "','" + fromdate + "','" + todate + "'," + totaldays + ",0,0," + n + ",'" + date + "'," + n + ",'" + date + "','" + place + "'," + dtsa.Rows[0][0].ToString() + ",'" + reserve_code + "')"; int flag = objcls.exeNonQuery(reserveroom); if (flag == 1) { string updatetemp = "update t_roomreservation_generaltdbtemp set allot_status=" + 1 + " where reserve_no='" + reserve_code + "' AND NOW() <= reservedate AND NOW() < expvacdate"; objcls.exeNonQuery(updatetemp); } } } string query = @"SELECT DISTINCT room_id,roomno FROM m_room WHERE room_id NOT IN (SELECT DISTINCT room_id FROM t_roomreservation WHERE NOW() <= reservedate AND NOW() < expvacdate AND status_reserve='0') AND build_id='" + ddlbuild.SelectedValue.ToString() + "' AND rowstatus!='2' AND room_cat_id='" + ddlcat.SelectedValue.ToString() + "' AND roomstatus='1' ORDER BY roomno"; DataTable dtrry = objcls.DtTbl(query); gdbind.DataSource = dtrry; gdbind.DataBind(); } else { string da = @"SELECT * FROM t_roomreservation_generaltdbtemp WHERE NOW()<=reservedate AND NOW()<expvacdate AND allot_status = 0 AND room_category_id = '" + ddlcat.SelectedItem.Value + "'"; DataTable dtda = objcls.DtTbl(da); for (int i = 0; i < count; i++) { CheckBox chk1 = (CheckBox)gdbind.Rows[i].FindControl("chkacc"); if (chk1.Checked == true) { if (dtda.Rows.Count > 0) { fromdate = dtda.Rows[i]["reservedate"].ToString(); todate = dtda.Rows[i]["expvacdate"].ToString(); totaldays = dtda.Rows[i]["total_days"].ToString(); place = dtda.Rows[i]["place"].ToString(); reserve_code = dtda.Rows[i]["reserve_no"].ToString(); name = dtda.Rows[i]["swaminame"].ToString(); } string room = gdbind.Rows[i].Cells[1].Text; string see = @"SELECT room_id FROM m_room WHERE roomno = '" + room + "' AND build_id ='" + ddlbuild.SelectedItem.Value + "' "; DataTable dtsa = objcls.DtTbl(see); DateTime dt5 = DateTime.Now; string date = dt5.ToString("yyyy-MM-dd HH:mm:ss"); fromdate = DateTime.Parse(fromdate).ToString("yyyy-MM-dd HH:mm:ss"); todate = DateTime.Parse(todate).ToString("yyyy-MM-dd HH:mm:ss"); int pk = objcls.PK_exeSaclarInt("reserve_id", "t_roomreservation"); pk = pk + 1; try { n = int.Parse(Session["userid"].ToString()); } catch { n = 1; Session["userid"] = n.ToString(); } string reserveroom = "INSERT INTO t_roomreservation(reserve_id,reserve_type,reserve_mode,swaminame,reservedate,expvacdate,total_days,status_reserve,passmode,createdby,cretaedon,updatedby,updateddate,place,room_id,reserve_no) VALUES ( " + pk + ",'Single','" + type + "','" + name + "','" + fromdate + "','" + todate + "'," + totaldays + ",0,0," + n + ",'" + date + "'," + n + ",'" + date + "','" + place + "'," + dtsa.Rows[0][0].ToString() + ",'" + reserve_code + "')"; int flag = objcls.exeNonQuery(reserveroom); if (flag == 1) { string updatetemp = "update t_roomreservation_generaltdbtemp set allot_status=" + 1 + " where reserve_no='" + reserve_code + "' AND NOW() <= reservedate AND NOW() < expvacdate"; objcls.exeNonQuery(updatetemp); } } } string query = @"SELECT DISTINCT room_id,roomno FROM m_room WHERE room_id NOT IN (SELECT DISTINCT room_id FROM t_roomreservation WHERE NOW() <= reservedate AND NOW() < expvacdate AND status_reserve='0') AND build_id='" + ddlbuild.SelectedValue.ToString() + "' AND rowstatus!='2' AND room_cat_id='" + ddlcat.SelectedValue.ToString() + "' AND roomstatus='1' ORDER BY roomno"; DataTable dtrry = objcls.DtTbl(query); gdbind.DataSource = dtrry; gdbind.DataBind(); } ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Room Alloted Successfully')", true); string strr = @"SELECT COUNT(reserve_no)AS counts FROM t_roomreservation_generaltdbtemp WHERE room_category_id =" + int.Parse(ddlcat.SelectedValue.ToString()) + " AND reserve_mode='" + type + "' AND allot_status=" + 0 + " AND DATE_FORMAT(reservedate,'%Y-%m-%d %T')LIKE'" + daa + "%'"; DataTable dtt = objcls.DtTbl(strr); lblallot.Text = dtt.Rows[0]["counts"].ToString(); } catch { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Error')", true); } }