protected void Button3_Click(object sender, EventArgs e) { if (txtdate.Text == "" && txtperiod.Text == "" && cmbUrgency.SelectedValue == "-1" && cmbPolicy.SelectedValue == "-1") { ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowRequired();", true); } else { string date = datenew(); con = objcls.NewConnection(); int pk = 0; pk = objcls.PK_exeSaclarInt("id", "t_policy_housekeep"); pk = pk + 1; if (con.State == ConnectionState.Closed) { con.ConnectionString = strConnection; con.Open(); } OdbcCommand cmd = new OdbcCommand("insert into t_policy_housekeep(id,level,fromdate,todate,time,policy,createdby,createdon,updatedby,updatedon,rowstatus)values(" + pk + "," + cmbUrgency.SelectedValue + ",'" + objcls.yearmonthdate(txtdate.Text) + "','9999-12-30','" + txtperiod.Text + "'," + cmbPolicy.SelectedValue + ",'" + userid + "','" + date + "','" + userid + "','" + date + "',0)", con); int i = cmd.ExecuteNonQuery(); if (i == 1) { ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); } int pknew; pknew = pk - 1; OdbcCommand cmddate = new OdbcCommand("update t_policy_housekeep set todate='" + objcls.yearmonthdate(txtdate.Text) + "' where id=" + pknew, con); cmddate.ExecuteNonQuery(); gridbind(); } //else //{ // ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowValue();", true); //} }
protected void btnsave_Click(object sender, EventArgs e) { if (txtfrmdate.Text != "" && txtallocation.Text != "" && cmballocrequest.SelectedValue != "" && txtcriteria.Text != "") { string date = datenew(); con = objcls.NewConnection(); int pk = 0; pk = objcls.PK_exeSaclarInt("pastallocation_id", "t_policy_pastallocation"); pk = pk + 1; if (con.State == ConnectionState.Closed) { con.ConnectionString = strConnection; con.Open(); } OdbcCommand cmd = new OdbcCommand("insert into t_policy_pastallocation(pastallocation_id,allocation_request,fromdate,todate,max_roomallocate,checkingid,createdby,createdon,updatedby,updatedon,rowstatus)values(" + pk + ",'" + cmballocrequest.SelectedItem.ToString() + "','" + objcls.yearmonthdate(txtfrmdate.Text) + "','9999-12-30'," + txtallocation.Text + ",'" + txtcriteria.Text + "','" + userid + "','" + date + "','" + userid + "','" + date + "',0)", con); int i = cmd.ExecuteNonQuery(); if (i == 1) { System.Windows.Forms.MessageBox.Show("Saved Successfully"); } int pknew; pknew = pk - 1; OdbcCommand cmddate = new OdbcCommand("update t_policy_pastallocation set todate='" + objcls.yearmonthdate(txtfrmdate.Text) + "' where pastallocation_id=" + pknew, con); cmddate.ExecuteNonQuery(); gridbind(); } else { System.Windows.Forms.MessageBox.Show("Enter the Value"); } }
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 btnCorrect_Click(object sender, EventArgs e) { if ((cmbCounter.SelectedValue != "-1") && (cmbStatus.SelectedValue != "-1") && (txtReceiptno.Text != "")) { string q_dayend = "SELECT DISTINCT DATE_FORMAT(dayend,'%d-%m-%Y') FROM t_roomallocation WHERE adv_recieptno=" + txtReceiptno.Text + " AND counter_id=" + cmbCounter.SelectedValue + ""; string dayend = objcls.exeScalar(q_dayend); if (dayend != "") { string dayendnew = objcls.yearmonthdate(dayend); string q_dayendcheck = "SELECT DATE_FORMAT(closedate_start,'%d-%m-%Y') AS closedate_start FROM t_dayclosing WHERE daystatus='open' AND DATE_FORMAT(closedate_start,'%d-%m-%Y')='" + dayend + "'"; string dayendcheck = objcls.exeScalar(q_dayendcheck); if (dayendcheck != "") { int correctid = objcls.PK_exeSaclarInt("crct_id", "t_receiptcorrection"); correctid = correctid + 1; OdbcTransaction odbTrans = null; try { if (con.State == ConnectionState.Closed) { con.ConnectionString = strConnection; con.Open(); } odbTrans = con.BeginTransaction(); int receiptno = Convert.ToInt32(txtReceiptno.Text) + 1; string q_receiptstatus = @"INSERT INTO t_receiptcorrection(crct_id,counter_no,recipt_no,crct_status,crct_date,dayend) VALUES (" + correctid + "," + cmbCounter.SelectedValue + "," + txtReceiptno.Text + "," + cmbStatus.SelectedValue + ",now(),'" + dayendnew + "')"; OdbcCommand cmd1 = new OdbcCommand(q_receiptstatus, con); cmd1.Transaction = odbTrans; cmd1.ExecuteNonQuery(); string q_correct = @"UPDATE t_roomallocation SET adv_recieptno=adv_recieptno+1 WHERE adv_recieptno>=" + txtReceiptno.Text + " AND counter_id=" + cmbCounter.SelectedValue + ""; OdbcCommand cmd2 = new OdbcCommand(q_correct, con); cmd2.Transaction = odbTrans; cmd2.ExecuteNonQuery(); odbTrans.Commit(); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowUpdated();", true); clear(); } catch { odbTrans.Rollback(); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowError();", true); clear(); } } else { ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showdate();", true); } } else { ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowRequired();", 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 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); } }