Ejemplo n.º 1
0
 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");
     }
 }
Ejemplo n.º 2
0
    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();
        }
    }
Ejemplo n.º 3
0
    protected void btnYes_Click(object sender, EventArgs e)
    {
        if (ViewState["action"].ToString() == "Alter")
        {
            txtcheckindate.Text = objcls.yearmonthdate(txtcheckindate.Text);
            txtcheckout.Text    = objcls.yearmonthdate(txtcheckout.Text);
            chkinsave           = DateTime.Parse(txtcheckindate.Text + " " + txtcheckintime.Text);
            chkoutsave          = DateTime.Parse(txtcheckout.Text + " " + txtcheckouttime.Text);
            string chkinsave1  = chkinsave.ToString("yyyy-MM-dd HH:mm:ss");
            string chkoutsave1 = chkoutsave.ToString("yyyy-MM-dd HH:mm:ss");

            OdbcTransaction trans = null;
            OdbcConnection  con   = objcls.NewConnection();
            try
            {
                trans = con.BeginTransaction();

                string      up  = @"update t_roomreservation set reservedate='" + chkinsave1 + "' , expvacdate='" + chkoutsave1 + "',room_id=" + cmbRooms.SelectedValue + " where reserve_no='" + txtReserveNo.Text + "'";
                OdbcCommand cmd = new OdbcCommand(up, con);
                cmd.Transaction = trans;
                int i = cmd.ExecuteNonQuery();
                if (i == 1)
                {
                    //string up1 = @"update t_roomreservation_generaltdbtemp set reservedate='" + chkinsave1 + "', expvacdate='" + chkoutsave1 + "',room_rent="+decimal.Parse(txtroomrent.Text)+",security_deposit="+decimal.Parse(txtsecuritydeposit.Text)+",other_charge="+decimal.Parse(txtothercharge.Text)+",advance="+decimal.Parse(txtadvance.Text)+",total_charge="+decimal.Parse(txttotalamount.Text)+",balance_amount="+decimal.Parse(txtnetpayable.Text)+" where reserve_no='" + txtReserveNo.Text + "'";
                    string      up1  = @"update t_roomreservation_generaltdbtemp set reservedate='" + chkinsave1 + "', expvacdate='" + chkoutsave1 + "',total_days=" + txthours.Text + ",room_rent=" + txtroomrent.Text + ",security_deposit=" + txtsecuritydeposit.Text + ",other_charge=" + txtothercharge.Text + ",advance=" + txtadvance.Text + ",total_charge=" + txttotalamount.Text + ",balance_amount=" + txtnetpayable.Text + " where reserve_no='" + txtReserveNo.Text + "'";
                    OdbcCommand cmd1 = new OdbcCommand(up1, con);
                    cmd1.Transaction = trans;
                    int i1 = cmd1.ExecuteNonQuery();

                    string      format = @"select DATE_FORMAT(STR_TO_DATE('" + Session["chkin"].ToString() + "','%d/%m/%Y %l:%i %p'),'%Y-%m-%d %T'),DATE_FORMAT(STR_TO_DATE('" + Session["chkout"].ToString() + "','%d/%m/%Y %l:%i %p'),'%Y-%m-%d %T')";
                    OdbcCommand cmd2   = new OdbcCommand(format, con);
                    cmd2.Transaction = trans;
                    OdbcDataAdapter da     = new OdbcDataAdapter(cmd2);
                    DataTable       dt_for = new DataTable();
                    da.Fill(dt_for);


                    string      insert = @"INSERT INTO t_reservealteration(reserve_no,pre_chkin,pre_chkout,alt_date) VALUES('" + txtReserveNo.Text + "','" + dt_for.Rows[0][0].ToString() + "','" + dt_for.Rows[0][1].ToString() + "',now())";
                    OdbcCommand cmd3   = new OdbcCommand(insert, con);
                    cmd3.Transaction = trans;
                    int i2 = cmd3.ExecuteNonQuery();
                    if ((i1 * i2) == 1)
                    {
                        trans.Commit();
                        con.Close();
                        ViewState["action"] = "NILL";
                        clear();
                        okmessage("Tsunami ARMS - Warning", "Reservation altered");
                        this.ScriptManager1.SetFocus(btnOk);
                        return;
                    }
                }
            }
            catch
            {
                trans.Rollback();
                con.Close();
            }
        }
    }
Ejemplo n.º 4
0
 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);
     //}
 }
Ejemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            clsCommon obj = new clsCommon();
            strConnection       = obj.ConnectionString();
            ViewState["option"] = "NIL";
            ViewState["action"] = "NIL";
            Title = " Tsunami ARMS - User Privilege Settings ";
            check();
            con = obje.NewConnection();
            OdbcCommand cmd = new OdbcCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("tblname", "m_sub_form");
            cmd.Parameters.AddWithValue("attribute", "distinct form_id,formname,displayname");
            cmd.Parameters.AddWithValue("conditionv", "status<>'2' order by displayname asc");
            OdbcDataAdapter dacnt3 = new OdbcDataAdapter(cmd);
            DataTable       dtt3   = new DataTable();
            dtt3 = obje.SpDtTbl("CALL selectcond(?,?,?)", cmd);
            for (int ii = 0; ii < dtt3.Rows.Count; ii++)
            {
                lstSelectform.Items.Add(dtt3.Rows[ii][2].ToString());
                lstSelectform.Items[ii].Text  = dtt3.Rows[ii][2].ToString();
                lstSelectform.Items[ii].Value = dtt3.Rows[ii][0].ToString();
            }
            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='******' and rowstatus<>'2'");
                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.Close();
            dguserlevel();
        }

        this.ScriptManager1.SetFocus(txtUserlevel);
    }
Ejemplo n.º 6
0
    protected void btnYes_Click(object sender, EventArgs e)
    {
        int    j  = Convert.ToInt16(ViewState["id"].ToString());
        string id = gvDeposit.Rows[j].Cells[0].Text;

        OdbcCommand cmdDetails = new OdbcCommand();

        cmdDetails.Parameters.AddWithValue("tblname", "t_fund_transfer");
        cmdDetails.Parameters.AddWithValue("attribute", "id,frm_counter AS 'Transfer from',to_counter AS 'Transfer to',amount AS 'Amount',issue_date AS 'Date'");
        cmdDetails.Parameters.AddWithValue("conditionv", "fund_status=0 AND id=" + id + "");
        DataTable dt_details = new DataTable();

        dt_details = objcls.SpDtTbl("CALL selectcond(?,?,?)", cmdDetails);

        string co_from = dt_details.Rows[0][1].ToString();
        string co_to   = dt_details.Rows[0][2].ToString();
        string amount  = dt_details.Rows[0][3].ToString();
        string date    = dt_details.Rows[0][4].ToString();

        if (ViewState["action"].ToString() == "Accept")
        {
            OdbcTransaction trans = null;
            OdbcConnection  con   = objcls.NewConnection();
            try
            {
                trans = con.BeginTransaction();

                string      frm_bal = @"SELECT balance FROM t_security_deposit WHERE counter1=" + co_from + " ORDER BY deposit_id DESC LIMIT 1";
                OdbcCommand cmd1a   = new OdbcCommand(frm_bal, con);
                cmd1a.Transaction = trans;
                OdbcDataAdapter da1a       = new OdbcDataAdapter(cmd1a);
                DataTable       dt_frm_bal = new DataTable();
                da1a.Fill(dt_frm_bal);

                string      to_bal = @"SELECT balance FROM t_security_deposit WHERE counter1=" + co_to + " ORDER BY deposit_id DESC LIMIT 1";
                OdbcCommand cmd1   = new OdbcCommand(to_bal, con);
                cmd1.Transaction = trans;
                OdbcDataAdapter da1       = new OdbcDataAdapter(cmd1);
                DataTable       dt_to_bal = new DataTable();
                da1.Fill(dt_to_bal);

                // DataTable dt_to_bal = objcls.DtTbl(to_bal);

                double bal1 = Convert.ToDouble(dt_frm_bal.Rows[0][0].ToString()) - Convert.ToDouble(amount);
                double bal2 = Convert.ToDouble(dt_to_bal.Rows[0][0].ToString()) + Convert.ToDouble(amount);

                string      year   = @"select mal_year_id,mal_year_id from t_settings where curdate() between start_eng_date and end_eng_date and is_current=" + 1 + "";
                OdbcCommand cmdSet = new OdbcCommand(year, con);
                cmdSet.Transaction = trans;
                OdbcDataAdapter da2   = new OdbcDataAdapter(cmdSet);
                DataTable       dtSet = new DataTable();
                da2.Fill(dtSet);

                string      season = @"select season_id,season_sub_id from m_season where curdate() between  startdate and enddate and is_current=" + 1 + " and rowstatus<>" + 2 + "";
                OdbcCommand cmdS   = new OdbcCommand(season, con);
                cmdS.Transaction = trans;
                OdbcDataAdapter da3 = new OdbcDataAdapter(cmdS);
                DataTable       dtS = new DataTable();
                da3.Fill(dtS);

                string      insert1 = @"INSERT INTO t_security_deposit(counter1,counter2,USER,season,mal_year,trandate,trans_type,trans_no,amount,balance) VALUES(" + co_from + "," + co_to + ",'" + Session["userid"].ToString() + "','" + dtS.Rows[0][0].ToString() + "','" + dtSet.Rows[0][0].ToString() + "',now(),3,'" + id + "','-" + amount + "','" + bal1 + "')";
                OdbcCommand cmd11   = new OdbcCommand(insert1, con);
                cmd11.Transaction = trans;
                cmd11.ExecuteNonQuery();

                string      insert2 = @"INSERT INTO t_security_deposit(counter1,counter2,USER,season,mal_year,trandate,trans_type,trans_no,amount,balance) VALUES(" + co_to + "," + co_from + ",'" + Session["userid"].ToString() + "','" + dtS.Rows[0][0].ToString() + "','" + dtSet.Rows[0][0].ToString() + "',now(),4,'" + id + "'," + amount + "," + bal2 + ")";
                OdbcCommand cmd12   = new OdbcCommand(insert2, con);
                cmd12.Transaction = trans;
                cmd12.ExecuteNonQuery();

                string      update = @"UPDATE t_fund_transfer SET fund_status=1 WHERE id=" + id;
                OdbcCommand cmd14  = new OdbcCommand(update, con);
                cmd14.Transaction = trans;
                cmd14.ExecuteNonQuery();

                trans.Commit();
                okmessage("Tsunami ARMS - Warning", "Amount Transfered successfully");
                this.ScriptManager1.SetFocus(btnOk);
                con.Close();
                load();
            }
            catch
            {
                trans.Rollback();
                con.Close();
                load();
            }
        }
        else //Reject
        {
            OdbcTransaction trans = null;
            OdbcConnection  con   = objcls.NewConnection();
            try
            {
                trans = con.BeginTransaction();

                string      update = @"UPDATE t_fund_transfer SET fund_status=2 WHERE id=" + id;
                OdbcCommand cmd14  = new OdbcCommand(update, con);
                cmd14.Transaction = trans;
                cmd14.ExecuteNonQuery();

                trans.Commit();
                okmessage("Tsunami ARMS - Warning", "Fund transfer rejected");
                this.ScriptManager1.SetFocus(btnOk);
                con.Close();
                load();
            }
            catch
            {
                trans.Rollback();
                con.Close();
                load();
            }
        }
    }
Ejemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            clsCommon obj = new clsCommon();
            strConnection         = obj.ConnectionString();
            conn.ConnectionString = strConnection;

            Title = "Tsunami ARMS - Material Return Note";
            ViewState["option"] = "NIL";
            ViewState["action"] = "NIL";
            check();
            conn = obje.NewConnection();

            try
            {
                string username = Session["username"].ToString();
                txtReturningOfficer.Text = 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;
            }
            DateTime date = DateTime.Now;
            string   dt   = date.ToString("dd-MM-yyyy");
            txtDate.Text = dt.ToString();

            IssueStore();
            conn = obje.NewConnection();
            OdbcCommand Malayalam = new OdbcCommand("select season_id from m_season s,m_sub_season d where curdate()=enddate and s.rowstatus<>'2' and "
                                                    + "s.season_sub_id=d.season_sub_id and d.rowstatus<>'2' and s.is_current='1'", conn);
            OdbcDataReader Malr = Malayalam.ExecuteReader();
            if (Malr.Read())
            {
                ReceiveDetails();
            }
            else
            {
                ViewState["action"] = "Season";
                lblOk.Text          = "This form will be activated only at end date of this Season";
                lblHead.Text        = "Tsunami ARMS - Warning";
                pnlOk.Visible       = true;
                pnlYesNo.Visible    = false;
                ModalPopupExtender2.Show();
                return;
            }


            string   strRetNo;
            DateTime yee  = DateTime.Now;
            string   year = yee.ToString("yyyy");
            Session["year"] = year;
            conn            = obje.NewConnection();
            OdbcCommand RecNo = new OdbcCommand("SELECT max(retno) from t_material_retrun", conn);
            if (Convert.IsDBNull(RecNo.ExecuteScalar()) == true)
            {
                strRetNo       = "RetNo/" + year + "/" + "0001";
                txtRetrun.Text = strRetNo.ToString();
            }
            else
            {
                string o1 = RecNo.ExecuteScalar().ToString();

                string ab1 = o1.Substring(11, 4);
                a4 = Convert.ToInt32(ab1);
                a4 = a4 + 1;
                if (a4 >= 1000)
                {
                    strRetNo       = "RetNo/" + year + "/" + a4;
                    txtRetrun.Text = strRetNo.ToString();
                }
                else if (a4 >= 100)
                {
                    strRetNo       = "RetNo/" + year + "/0" + a4;
                    txtRetrun.Text = strRetNo.ToString();
                }
                else if (a4 >= 10)
                {
                    strRetNo       = "RetNo/" + year + "/00" + a4;
                    txtRetrun.Text = strRetNo.ToString();
                }
                else if (a4 < 10)
                {
                    strRetNo       = "RetNo/" + year + "/000" + a4;
                    txtRetrun.Text = strRetNo.ToString();
                }
            }

            conn.Close();
        }
    }
Ejemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            clsCommon obj = new clsCommon();
            strConnection         = obj.ConnectionString();
            conn.ConnectionString = strConnection;
            ViewState["option"]   = "NIL";
            ViewState["action"]   = "NIL";
            Title = " Tsunami ARMS - Room Resource Register ";
            check();
            dtitem            = additem();
            Session["dtItem"] = dtitem;

            conn = obje.NewConnection();

            OdbcCommand Store1 = new OdbcCommand();
            Store1.CommandType = CommandType.StoredProcedure;
            Store1.Parameters.AddWithValue("tblname", "m_sub_building");
            Store1.Parameters.AddWithValue("attribute", "build_id,buildingname ");
            Store1.Parameters.AddWithValue("conditionv", "rowstatus<>'2'");
            OdbcDataAdapter Store16 = new OdbcDataAdapter(Store1);
            DataTable       ds1     = new DataTable();
            ds1 = obje.SpDtTbl("CALL selectcond(?,?,?)", Store1);
            DataRow row = ds1.NewRow();
            ds1.Rows.InsertAt(row, 0);
            row["build_id"]        = "-1";
            row["buildingname"]    = "--Select--";
            cmbBuilding.DataSource = ds1;
            cmbBuilding.DataBind();
            dtitem            = additem();
            Session["dtItem"] = dtitem;

            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;
            }

            itemcat();

            if (Session["submaster"] == "yes")
            {
                cmbBuilding.SelectedValue         = Session["building"].ToString();
                cmbRoomNo.SelectedValue           = Session["room"].ToString();
                cmbName.SelectedValue             = Session["name"].ToString();
                txtIcode.Text                     = Session["code"].ToString();
                cmbItemCategory.SelectedItem.Text = Session["category"].ToString();
                txtClass.Text                     = Session["class"].ToString();
                txtModel.Text                     = Session["model"].ToString();
                txtItemMaker.Text                 = Session["maker"].ToString();
                if (Session["item"] == "resource")
                {
                    this.ScriptManager1.SetFocus(cmbfloor);
                }
                else if (Session["item"] == "floornew")
                {
                    this.ScriptManager1.SetFocus(cmbRoomNo);
                }
                Session["submaster"] = "no";
            }
        }

        pnlinv.Visible         = true;
        pnlroomdetails.Visible = false;
        pnlinvdetails.Visible  = false;
        RoomInventory();
        conn.Close();
    }