コード例 #1
0
    private void activateUser()
    {
        string userID = panActivate_drpUsers.SelectedValue;
        string sql;

        if (userID == "0")
        {
            return;
        }
        if (userID == common.strAdminName)
        {
            panActivate_lblActive.Text = "Error: Cannot deactive admin.";
            return;
        }

        sql = string.Format("update onlinebill.users set active = decode(active,0,1,0) where userid='{0}'", userID);

        try
        {
            OraDBConnection.ExecQry(sql);
            panActivate_lblActive.Text = "User activation status changed successfully";
        }
        catch (Exception ex)
        {
            panActivate_lblActive.Text = "Error: " + ex.Message;
        }
    }
コード例 #2
0
    private bool ResetRownos(long empid)
    {
        string sql;
        bool   res;

        sql = @"BEGIN
              DELETE FROM cadre.temp_setrowno WHERE empid = " + empid + @";
              INSERT INTO cadre.temp_setrowno
              SELECT empid,
                rowno,
                rownum
              FROM
                (SELECT rowno,empid FROM emphistory WHERE empid = " + empid + @" ORDER BY rowno
                );
              UPDATE emphistory eh
              SET eh.rowno =
                (SELECT tsr.newrowno
                FROM CADRE.temp_setrowno tsr
                WHERE tsr.empid  = eh.empid
                AND tsr.oldrowno = eh.rowno
                )
              WHERE eh.empid=" + empid + @";
            END;";
        res = OraDBConnection.ExecQry(sql);
        return(true);
    }
コード例 #3
0
    protected void btnCreate_Click(object sender, EventArgs e)
    {
        if (txtpropname.Text == "")
        {
            Utils.ShowMessageBox(this, "Enter Proposal Name");
            return;
        }

        //status: U-Unsaved, S-Saved
        //type: TP-Transfer/Promotion, RD-Redesignation
        string sql = "insert into cadre.proposals(pno,pname,pdate,status,type) values" +
                     "((select nvl(max(pno),0)+1 from cadre.proposals)," +
                     "'" + txtpropname.Text + "',sysdate,'U','" + PropType.Value + "')";

        bool ret = false;

        try
        {
            ret = OraDBConnection.ExecQry(sql);
            if (ret == false)
            {
                throw new Exception("Error in Creating Proposal");
            }
        }
        catch (Exception ex)
        {
            Utils.ShowMessageBox(this, ex.Message);
            return;
        }
        panNewProp.Visible = false;
        txtpropname.Text   = "";
        FillGrid();
    }
コード例 #4
0
    private void InsertIntoCadrMap(string empid, string rowno)
    {
        string sql;

        sql = string.Format("INSERT INTO cadre.cadrmap(empid,rowno) VALUES('{0}','{1}')", empid, rowno);
        OraDBConnection.ExecQry(sql);
    }
コード例 #5
0
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        string desg    = drpDesg.SelectedValue;
        string startdt = dt_start.Text;
        string enddt   = dt_end.Text;
        string sql     = String.Empty;

        //reset fromdate,todate and olddesg
        sql = "update cadre.rd_proposals set fromdate = null, todate = null, olddesg=null";
        OraDBConnection.ExecQry(sql);

        //delete earlier entered records (if any) for this proposal
        sql = "delete from cadre.prop_redesig where propno = " + propno;
        OraDBConnection.ExecQry(sql);

        //insert matched records in prop_redesig
        sql = String.Format("insert into CADRE.prop_redesig SELECT e.empid, e.firstname  || ' '  || e.middlename  || ' '  || e.lastname AS name, " +
                            "to_char(e.dob,'dd-Mon-YYYY') as DOB, m.locabb, to_char(h.fromdate,'dd-Mon-YYYY') AS Promoted_On, {3}, {0} FROM " +
                            "(SELECT empid, MIN(fromdate) AS fromdate FROM emphistory WHERE desgcode = {0} GROUP BY empid) h,  empperso e,  mast_loc m " +
                            "WHERE e.cdesgcode = {0} AND e.recstatus = 10 AND h.empid = e.empid AND m.loccode = e.cloccode " +
                            "AND h.fromdate BETWEEN  to_date('{1}','dd/mm/yyyy') AND to_date('{2}','dd/mm/yyyy')", desg, startdt, enddt, propno);
        OraDBConnection.ExecQry(sql);

        //enter fromdate, todate and old desg in rd_proposals
        sql = string.Format("update cadre.rd_proposals set fromdate =  to_date('{0}','dd/mm/yyyy')," +
                            "todate = to_date('{1}','dd/mm/yyyy'), olddesg={2} where pno={3}",
                            startdt, enddt, desg, propno);
        OraDBConnection.ExecQry(sql);

        FillGrid();
        Search_Visible(false);
        Controls_Vis(gv_redesig.Rows.Count > 0);
    }
コード例 #6
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (txtoonum.Text.Length < 1)
        {
            Utils.ShowMessageBox(this, "Enter O/o Number");
            return;
        }
        DateTime checkdate;

        if (DateTime.TryParse(txtoodate.Text, out checkdate) == false)
        {
            Utils.ShowMessageBox(this, "Enter a valid date");
            return;
        }

        //mark proposal as saved
        string sql = string.Format("update cadre.ret_proposals set status='S',oonum='{0}',oodate='{1}' where pno={2}",
                                   txtoonum.Text, txtoodate.Text, propno);

        if (OraDBConnection.ExecQry(sql) == false)
        {
            Utils.ShowMessageBox(this, "Error marking proposal as saved");
            return;
        }
        MakeReport(true);
    }
コード例 #7
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        string empid = txtEmpID.Text;
        string desg  = drpDesg.SelectedValue;
        string sql   = String.Empty;
        string res;

        panEmpHist.Visible = false;
        //show error if empid doesn't exist or desg doesn't match or recstatus != 10
        sql = string.Format("select count(*) from pshr.empperso where empid = '{0}' and cdesgcode = {1} and recstatus=10", empid, desg);
        res = OraDBConnection.GetScalar(sql);
        if (empid == "" || res != "1")
        {
            lblDesgMsg.Text = "Invalid EmpID";
            return;
        }

        sql = string.Format("select count(*) from cadre.prop_redesig where empid = {0} and propno = {1}", empid, propno);
        if (OraDBConnection.GetScalar(sql) != "0")
        {
            lblDesgMsg.Text = "EmpID Already Added";
            return;
        }
        sql = String.Format("insert into CADRE.prop_redesig SELECT e.empid, e.firstname  || ' '  || e.middlename  || ' '  || e.lastname AS name, " +
                            "to_char(e.dob,'dd-Mon-YYYY') as DOB, m.locabb, to_char(h.fromdate,'dd-Mon-YYYY') AS Promoted_On, {1}, {0} FROM " +
                            "(SELECT empid, MIN(fromdate) AS fromdate FROM emphistory WHERE desgcode = {0} GROUP BY empid) h,  empperso e,  mast_loc m " +
                            "WHERE e.cdesgcode = {0} AND h.empid = e.empid AND m.loccode = e.cloccode and e.empid={2}", desg, propno, empid);
        OraDBConnection.ExecQry(sql);
        lblDesgMsg.Text = "EmpID Added";
        FillGrid();
    }
コード例 #8
0
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        string sql;
        string role = Session["role"].ToString();
        //string date = drpMonth.SelectedValue;
        string date = "";

        sql = "BEGIN ";

        //delete earlier entered records (if any) for this proposal
        sql += " delete from cadre.ret_list where propno = " + propno + "; ";

        sql += "INSERT INTO cadre.ret_list " +
               "SELECT e.empid,last_day (add_months(e.dob - 1, md.retdage * 12)) as DOR, " + propno + ", cdesgcode,null " +
               "FROM pshr.empperso e, pshr.mast_desg md " +
               "WHERE last_day (add_months(e.dob - 1, md.retdage * 12)) = '" + date + "'" +
               "AND e.cdesgcode = md.desgcode " +
               "AND e.recstatus   = 10" +
               "AND e.cdesgcode in (SELECT desgcode from cadre.person_auth_desgs where role = '" + role + "'); ";

        sql += string.Format(" update cadre.ret_proposals set retdate = '{0}' where pno={1}; ", date, propno);
        sql += " END;";
        OraDBConnection.ExecQry(sql);
        Controls_Vis(true);
        FillGrid();
    }
コード例 #9
0
    private void SaveCC(bool template, bool saveas = false)
    {
        string name = saveas?txtSaveAsName.Text:CC_name.Text;
        string tags = CC_tags.Text.Replace("'", "''");
        string data = CC_data.Text.Replace("'", "''");
        string sql;
        string type = template ? "T" : "N";

        if (!saveas && hidSource.Text == "T")
        {
            lblmsg.Text = "Cannot change template.";
            return;
        }

        sql = string.Format("merge into cadre.bigcc B using " +
                            "(select '{0}' as n, '{1}' as t, '{2}' as d , 'N' as ty from dual) D " +
                            "on (B.name = D.n and B.type='N') " +
                            "when matched then update set B.tags = D.t, B.data = D.d " +
                            "when not matched then insert (name, tags, data, type, addedon) values (D.n, D.t, D.d, D.ty, sysdate)"
                            , name, tags, data);

        try
        {
            OraDBConnection.ExecQry(sql);
            lblmsg.Text = template?"Template Saved":"CC Saved";
        }
        catch (Exception ex)
        {
            lblmsg.Text = ex.Message;
        }
        DisableDataFields(true);
    }
コード例 #10
0
    protected void btnAddLoc_Click(object sender, EventArgs e)
    {
        string sql;

        if (btnAddnote.Text == "Add Note")
        {
            if (txtNewnote.Text.Length > 0)
            {
                sql = "insert into cadre.notes_person(sno,notes,ccnum) values(" + GetSNo() + ",'" + txtNewnote.Text + "',-1)";
                OraDBConnection.ExecQry(sql);
            }
            txtNewnote.Text = "";
        }



        if (btnAddnote.Text == "Update Note")
        {
            if (txtNewnote.Text.Length > 0)
            {
                sql = "update cadre.notes_person set notes = '" + txtNewnote.Text + "' where sno = " + lbllstsno.Text;
                OraDBConnection.ExecQry(sql);
            }
            txtNewnote.Text = "";
            lbllstsno.Text  = "";
            btnAddnote.Text = "Add Note";
        }
        FillListAll();
    }
コード例 #11
0
    protected void btnDel_Click(object sender, EventArgs e)
    {
        string aloc;

        if (drpLocs.SelectedValue == "")
        {
            Utils.ShowMessageBox(this, "No Location To Delete");
            return;
        }

        aloc = OraDBConnection.GetScalar("select aloc from pshr.mast_loc where loccode = " + drpLocs.SelectedValue);
        if (aloc != "2")
        {
            Utils.ShowMessageBox(this, "Not Permitted");
        }
        else if (aloc == "2")
        {
            if (OraDBConnection.ExecQry("delete from pshr.mast_loc where loccode = " + drpLocs.SelectedValue))
            {
                Utils.ShowMessageBox(this, "Location Deleted");
            }
            else
            {
                Utils.ShowMessageBox(this, "Error Deleting Location");
            }
        }
        FillLocations(drploctype.SelectedValue, chkShowAll.Checked, txtFilter.Text);
    }
コード例 #12
0
    private void resetPass()
    {
        string userID = panReset_drpUsers.SelectedValue;
        string pass1  = panReset_txtPass1.Value;
        string pass2  = panReset_txtPass2.Value;
        string sql    = string.Empty;

        if (userID == "0")
        {
            return;
        }
        if (pass1 != pass2)
        {
            panReset_lblMsg.Text = "Error: Passwords does not match.";
            return;
        }
        if (pass1.Length < 3 || pass1.Length > 64)
        {
            panReset_lblMsg.Text = "Error: Password length must be between 3 and 64.";
            return;
        }

        sql = string.Format("update onlinebill.users set pass='******' where userid='{1}'", pass1, userID);

        try
        {
            OraDBConnection.ExecQry(sql);
            panReset_lblMsg.Text = "Password changed successfully.";
        }
        catch (Exception ex)
        {
            panReset_lblMsg.Text = "Error: " + ex.Message;
            return;
        }
    }
コード例 #13
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        string name = CC_name.Text;
        string sql  = string.Format("delete from cadre.bigcc where name = '{0}'", name);

        OraDBConnection.ExecQry(sql);
        lblmsg.Text = "CC Deleted";
    }
コード例 #14
0
 private void VacantCadrMap(long empid, int eventcode)
 {
     if (eventcode >= 11 && eventcode <= 16)
     {
         string sql = "delete from cadre.cadrmap where empid=" + empid.ToString();
         OraDBConnection.ExecQry(sql);
     }
 }
コード例 #15
0
    private void addUser()
    {
        string       userName   = panAdd_txtUsername.Value;
        string       pass1      = panAdd_txtPass1.Value;
        string       pass2      = panAdd_txtPass2.Value;
        string       offcName   = panAdd_txtOffcName.Value;
        string       mobileNo   = panAdd_txtMobile.Value;
        string       issuedTo   = panAdd_txtIssuedTo.Value;
        const string officeType = "SubDivision";
        string       sql        = string.Empty;

        if (string.IsNullOrWhiteSpace(userName) ||
            string.IsNullOrWhiteSpace(pass1) ||
            string.IsNullOrWhiteSpace(pass2) ||
            string.IsNullOrWhiteSpace(offcName) ||
            string.IsNullOrWhiteSpace(mobileNo) ||
            string.IsNullOrWhiteSpace(issuedTo))
        {
            panAdd_lblMsg.Text = "Error: All the fields are necessary.";
            return;
        }
        if (pass1 != pass2)
        {
            panAdd_lblMsg.Text = "Error: Passwords does not match.";
            return;
        }
        if (userName.Length < 3 || userName.Length > 64)
        {
            panAdd_lblMsg.Text = "Error: Username length must be between 3 and 64.";
            return;
        }
        if (pass1.Length < 3 || pass1.Length > 64)
        {
            panAdd_lblMsg.Text = "Error: Password length must be between 3 and 64.";
            return;
        }
        sql = string.Format("insert into onlinebill.users(userid, pass, offcname, officetype, mobileno, issuedto, dated, active)" +
                            "values('{0}','{1}','{2}','{3}','{4}','{5}',sysdate,1)", userName.ToUpper(), pass1, offcName, officeType, mobileNo, issuedTo);
        try
        {
            OraDBConnection.ExecQry(sql);
            panAdd_lblMsg.Text = "User added successfully.";
            return;
        }
        catch (Exception ex)
        {
            if (ex.Message.Contains("ORA-00001"))
            {
                panAdd_lblMsg.Text = "Error: User already exists.";
                return;
            }
            else
            {
                panAdd_lblMsg.Text = "Error: " + ex.Message;
            }
            return;
        }
    }
コード例 #16
0
    protected void gv_redesig_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string empid = gv_redesig.Rows[e.RowIndex].Cells[1].Text.ToString();
        string sql   = string.Empty;

        sql = "delete from cadre.prop_redesig where empid=" + empid + " and propno=" + propno;
        OraDBConnection.ExecQry(sql);

        FillGrid();
    }
コード例 #17
0
    protected void lnkDelete_Click(object sender, EventArgs e)
    {
        string empid = gv_redesig.Rows[((GridViewRow)((LinkButton)sender).Parent.Parent).RowIndex].Cells[2].Text.ToString();
        string sql   = string.Empty;

        sql = "delete from cadre.ret_list where empid=" + empid + " and propno=" + propno;
        OraDBConnection.ExecQry(sql);

        FillGrid();
    }
コード例 #18
0
    protected void btnRemLoc_Click(object sender, EventArgs e)
    {
        string sql;

        if (lstAll.SelectedValue != "")
        {
            sql = "delete from cadre.notes_person where sno=" + lstAll.SelectedValue;
            OraDBConnection.ExecQry(sql);
            FillListAll();
        }
    }
コード例 #19
0
ファイル: Utils.cs プロジェクト: gurpreet007/person
    private static bool Generate_Grades(int cad_cd)
    {
        string  sql;
        DataSet ds_sel;

        sql = "DELETE FROM cadre.empgrdno";
        OraDBConnection.ExecQry(sql);

        sql = "SELECT s.empid, s.senno, s.sendate, d.cadrecode, d.hecode, e.revcategory, e.branchcode " +
              "FROM pshr.empsen s, pshr.mast_desg d, pshr.empperso e, pshr.mast_cadre x " +
              "WHERE s.empid=e.empid AND e.cdesgcode = d.desgcode AND s.senno BETWEEN '1' AND '999999' AND " +
              "d.cadrecode = (SELECT u.cadregrp FROM mast_cadre u WHERE u.cadrecode = " + cad_cd + ") " +
              "AND d.cadrecode = x.cadrecode " +
              "AND e.branchcode = (SELECT j.branchcode FROM mast_cadre j WHERE j.cadrecode = " + cad_cd + ") " +
              "AND e.recstatus = 10 ORDER BY senno";
        ds_sel = OraDBConnection.GetData(sql);

        if (ds_sel.Tables[0].Rows.Count == 0)
        {
            return(false);
        }

        int senno = 0;

        foreach (DataRow drow in ds_sel.Tables[0].Rows)
        {
            senno++;
            sql = string.Format("INSERT INTO cadre.empgrdno VALUES({0},      '0', {1},                                            {2},               {3},   {4},                 {5})",
                                drow["empID"], (drow["hecode"] == System.DBNull.Value) ? 99 : drow["hecode"], drow["cadrecode"], senno, drow["revcategory"], drow["branchcode"]);
            OraDBConnection.ExecQry(sql);
        }

        senno  = 0;
        sql    = " SELECT * FROM cadre.empgrdno ORDER BY hecode, senno";
        ds_sel = OraDBConnection.GetData(sql);
        int grp_cd = 9999;

        foreach (DataRow drow in ds_sel.Tables[0].Rows)
        {
            if (int.Parse(drow["hecode"].ToString()) != grp_cd)
            {
                senno  = 1;
                grp_cd = int.Parse(drow["hecode"].ToString());
            }
            else
            {
                senno++;
            }
            sql = "UPDATE cadre.empgrdno SET grdno = " + senno + " WHERE empid = " + drow["empid"];
            OraDBConnection.ExecQry(sql);
        }

        return(true);
    }
コード例 #20
0
    private void UpdateEmpperso(string empid, int eventid, string cloccode, string cdesgcode)
    {
        string sql;
        string recstatus = "10";

        if (eventid == (int)EVENTS.RETD.RSUP)
        {
            recstatus = "20";
        }
        sql = string.Format("UPDATE EMPPERSO SET cloccode = '{0}', cdesgcode = '{1}', recstatus = '{2}' WHERE empid = '{3}'", cloccode, cdesgcode, recstatus, empid);
        OraDBConnection.ExecQry(sql);
    }
コード例 #21
0
    protected void lnkDelete_Click(object sender, EventArgs e)
    {
        string prono = gvProposals.Rows[((GridViewRow)((LinkButton)sender).Parent.Parent).RowIndex].Cells[2].Text.ToString();
        string sql   = string.Empty;

        sql = "delete from cadre.prop_redesig where propno =" + prono;
        OraDBConnection.ExecQry(sql);

        sql = "delete from cadre.rd_proposals where pno =" + prono;
        OraDBConnection.ExecQry(sql);
        FillGrid();
    }
コード例 #22
0
ファイル: frmreports.aspx.cs プロジェクト: gurpreet007/person
    protected void btnRemCR_Click(object sender, EventArgs e)
    {
        string sql = string.Format("insert into cadre.DELETED_CHARGEREPORTS " +
                                   "select * from cadre.chargereport where empid in ({0}) and oonum = '{1}'",
                                   txtEmpIDRemCR.Text, txtOonumRemCR.Text);

        OraDBConnection.ExecQry(sql);
        sql = string.Format("delete from cadre.chargereport where empid in ({0}) and oonum = '{1}'",
                            txtEmpIDRemCR.Text, txtOonumRemCR.Text);
        OraDBConnection.ExecQry(sql);
        Utils.ShowMessageBox(this, "Deleted from Charge Reports");
    }
コード例 #23
0
    private string DoDelete()
    {
        long empid = Convert.ToInt64(txtEmpID.Text.Trim());
        int  rno   = Convert.ToInt32(GridView1.SelectedRow.Cells[1].Text.Trim());

        string sql    = string.Format("DELETE FROM emphistory WHERE empid={0} AND rowno={1}", empid, rno);
        bool   retval = OraDBConnection.ExecQry(sql);

        ResetRownos(empid);
        lblmsg.Text = retval ? "Event Deleted Successfully" : "Unable to delete event";
        return(rno.ToString());
    }
コード例 #24
0
    protected void btnArchive_Click(object sender, EventArgs e)
    {
        string  acno    = lblAcNo.Text;
        string  tbl     = lblCat.Text;
        string  userid  = Session[common.strUserID].ToString();
        string  sql     = string.Empty;
        string  sqlCond = string.Empty;
        string  sqlDel  = string.Empty;
        string  sqlIns  = string.Empty;
        string  sqlLog  = string.Empty;
        string  year    = DateTime.Now.Year.ToString();
        DataSet ds;
        Dictionary <string, string> dict_acno = new Dictionary <string, string>()
        {
            { "DSBELOW10KW", "ACCOUNTNO" },
            { "DSABOVE10KW", "ACCOUNTNO" },
            { "LS", "ACCOUNTNO" },
            { "MS", "PRT_AC_NO" },
            { "SP", "ACNO" }
        };

        if (!dict_acno.ContainsKey(tbl))
        {
            lblMsg.Text = "Invalid Category";
            return;
        }

        sqlCond = string.Format(" upper({0}) = upper('{1}') and upper(userid) = upper('{2}') ", dict_acno[tbl], acno, userid);
        sql     = string.Format("select count(*) from {0} where {1}", tbl, sqlCond);
        ds      = OraDBConnection.GetData(sql);

        if (ds.Tables[0].Rows[0][0].ToString() != "1")
        {
            lblMsg.Text = "No current bill or not uploaded by this user";
            return;
        }

        sqlIns = string.Format("insert into ARCBILL.ARC_{0}_{1} select * from {1} where {2}", year, tbl, sqlCond);
        sqlDel = string.Format("delete from {0} where {1}", tbl, sqlCond);
        sqlLog = string.Format("insert into ARCHIVEBILL_LOG values ('{0}','{1}', sysdate)", acno, userid);
        sql    = string.Format("BEGIN {0}; {1}; {2}; END;", sqlIns, sqlDel, sqlLog);
        try
        {
            OraDBConnection.ExecQry(sql);
            lblMsg.Text = "Record Archived";
        }
        catch (Exception ex)
        {
            lblMsg.Text = ex.Message;
        }
    }
コード例 #25
0
    private void DoLoginAudit(string userID, string userPass, bool isValid, string ip)
    {
        string sql;

        sql = string.Format("insert into onlinebill.loginaudit values('{0}','{1}',{2},'{3}',sysdate)",
                            userID, userPass, isValid ? 1 : 0, ip);
        try
        {
            OraDBConnection.ExecQry(sql);
        }
        catch
        {
            Response.Redirect(Request.RawUrl);
        }
    }
コード例 #26
0
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        string desg    = drpDesg.SelectedValue;
        string startdt = dt_start.Text;
        string enddt   = dt_end.Text;
        string sql     = String.Empty;

        //reset fromdate,todat
        sql = "update cadre.ret_proposals set fromdate = null, todate = null where pno = " + propno;
        OraDBConnection.ExecQry(sql);

        //delete earlier entered records (if any) for this proposal
        sql = "delete from cadre.ret_list where propno = " + propno;
        OraDBConnection.ExecQry(sql);

        //insert matched records in prop_redesig
        //sql = String.Format("insert into CADRE.prop_redesig SELECT e.empid, e.firstname  || ' '  || e.middlename  || ' '  || e.lastname AS name, "+
        //    "to_char(e.dob,'dd-Mon-YYYY') as DOB, m.locabb, to_char(h.fromdate,'dd-Mon-YYYY') AS Promoted_On, {3}, {0} FROM " +
        //    "(SELECT empid, MIN(fromdate) AS fromdate FROM emphistory WHERE desgcode = {0} GROUP BY empid) h,  empperso e,  mast_loc m "+
        //    "WHERE e.cdesgcode = {0} AND e.recstatus = 10 AND h.empid = e.empid AND m.loccode = e.cloccode AND h.fromdate BETWEEN '{1}' AND '{2}'", desg, startdt, enddt,propno);
        //sql = "SELECT e.empid, firstname||' '|| decode(middlename, NULL, '', middlename||' ') || lastname AS name,"+
        //        "e.dob AS DOB,  md.desgtext,  ml.locname,"+
        //        "last_day (add_months(e.dob - 1, md.retdage * 12)) as DOR"+
        //        "FROM pshr.empperso e, pshr.mast_loc ml, pshr.mast_desg md"+
        //        "WHERE last_day (add_months(e.dob - 1, md.retdage * 12)) between '01-Jul-2013' AND '01-Sep-2013'"+
        //        "AND e.empid like '1%'"+
        //        "AND e.cloccode = ml.loccode"+
        //        "AND e.cdesgcode = md.desgcode"+
        //        "AND e.recstatus   = 10" +
        //        "order by md.hecode,e.empid"
        sql = "INSERT INTO cadre.ret_list " +
              "SELECT e.empid,last_day (add_months(e.dob - 1, md.retdage * 12)) as DOR, " + propno + ", cdesgcode,null " +
              "FROM pshr.empperso e, pshr.mast_desg md " +
              "WHERE last_day (add_months(e.dob - 1, md.retdage * 12)) between '" + startdt + "' AND '" + enddt + "' " +
              "AND e.empid like '1%' " +
              "AND e.cdesgcode = md.desgcode " +
              "AND e.recstatus   = 10";
        OraDBConnection.ExecQry(sql);

        //enter fromdate, todate in ret_proposals
        sql = string.Format("update cadre.ret_proposals set fromdate = '{0}', todate = '{1}' where pno={2}", startdt, enddt, propno);
        OraDBConnection.ExecQry(sql);

        FillGrid();
        Search_Visible(false);
        Controls_Vis(gv_redesig.Rows.Count > 0);
    }
コード例 #27
0
    protected void btnDone_Click(object sender, EventArgs e)
    {
        string sql;
        int    i;
        int    ccnum = 0;

        OraDBConnection.ExecQry("delete from cadre.notes_proposal_person where proposalno = " + prono);
        for (i = 0; i < lstCC.Items.Count; i++)
        {
            ccnum = i + 1;
            sql   = string.Format("Insert into cadre.notes_proposal_person(sno,ccnum, notes, proposalno) values ({0},{1},'{2}',{3})", ccnum, lstCC.Items[i].Value, lstCC.Items[i].Text, prono);

            //sql = "update cadre.cnotes_person set ccnum=" + ccnum + " where sno=" + lstCC.Items[i].Value;
            OraDBConnection.ExecQry(sql);
        }
        Response.Write("<script>window.close()</script>");
    }
コード例 #28
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        double senno = 0;

        double.TryParse(txtNewSen.Text, out senno);
        string empid = txtEmpID.Text;

        if (senno == 0)
        {
            lblmsg.Text = "Invalid Seniority Number";
            return;
        }
        string sql = string.Format("update pshr.empperso set seniorityno={0} where empid = {1}", senno, empid);

        OraDBConnection.ExecQry(sql);
        lblmsg.Text = "Seniority Changed";
    }
コード例 #29
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        string loctype, locrep, locname;
        string loccode;
        string sql;

        if (drpLocs.SelectedValue == "")
        {
            Utils.ShowMessageBox(this, "No Reporting Location Selected");
            return;
        }
        if (txtNew.Text == "")
        {
            Utils.ShowMessageBox(this, "Enter Name of Location to Create");
            return;
        }
        if (drploctype.SelectedValue == "0")
        {
            Utils.ShowMessageBox(this, "No Location Type Selected");
            return;
        }
        locrep  = drpLocs.SelectedValue;
        loctype = drploctype.SelectedValue.ToString();
        locname = txtNew.Text;
        sql     = string.Format("select cadre.get_next_loccode({0},{1}) from dual", locrep, loctype);
        loccode = OraDBConnection.GetScalar(sql);

        if (loccode == "")
        {
            Utils.ShowMessageBox(this, "Error getting next loccode");
            return;
        }
        sql = string.Format("insert into pshr.mast_loc(loccode,locname,locabb,post,loctype,locrep,aloc) " +
                            "values({0},'{1}','{1}','{1}',{2},{3},'2')", loccode, locname, loctype, locrep);
        if (OraDBConnection.ExecQry(sql))
        {
            Utils.ShowMessageBox(this, "Location Added");
        }
        else
        {
            Utils.ShowMessageBox(this, "Error Adding Location");
        }
        FillLocations(drploctype.SelectedValue, chkShowAll.Checked, txtFilter.Text);
        return;
    }
コード例 #30
0
    private string DoEdit()
    {
        bool ondepu = isDepu();

        long empid = Convert.ToInt64(txtEmpID.Text.Trim());
        int  rno   = Convert.ToInt32(GridView1.SelectedRow.Cells[1].Text.Trim());

        //fill desgcode if it is filled
        string dcode = ((txtdesg.Text.Split('-')).Length >= 2) ? (txtdesg.Text.Split('-')[txtdesg.Text.Split('-').Length - 1]) : null;

        //fill posting location if it is filled
        string pcode = ((txtploc.Text.Split('-')).Length >= 2) ? (txtploc.Text.Split('-')[txtploc.Text.Split('-').Length - 1]) : null;

        //fill pay charge location if it is filled
        string pccode = "";

        if (!ondepu)
        {
            pccode = ((txtpcloc.Text.Split('-')).Length >= 2) ? (txtpcloc.Text.Split('-')[txtpcloc.Text.Split('-').Length - 1]) : null;
        }

        //string sancpost = drpSancDesg.SelectedValue;
        string sancpost = hidSancPost.Value;
        string sql;

        //sancpost (if filled) consists of "desgcode-indx",
        string sancdesg = "";
        string sancindx = "";

        if (!ondepu)
        {
            sancdesg = (sancpost.Split('-').Length == 2) ? sancpost.Split('-')[0] : "";
            sancindx = (sancpost.Split('-').Length == 2) ? sancpost.Split('-')[1] : "";
        }

        //update event in emphistory
        sql = String.Format("UPDATE pshr.emphistory SET eventcode='{0}', fromdate='{1}', todate='{2}',  desgcode='{3}', loccode='{4}', pcloccode='{5}'," +
                            "sancdesg='{6}', sancindx='{7}', oonum='{8}',   odate='{9}' WHERE empid={10} AND rowno={11}", drpEvent.SelectedValue,
                            txtDoR.Text, txtDoJ.Text, dcode, pcode, pccode, sancdesg, sancindx, txtOoNum.Text, txtOoDate.Text, empid, rno);

        bool retval = OraDBConnection.ExecQry(sql);

        lblmsg.Text = retval ? "Event Edited Successfully" : "Unable to edit event";
        return(rno.ToString());
    }