Esempio n. 1
0
    /* ******************
     * * *Page Event* * *
     * ******************
     */


    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["CurPage"] == null)
        {
            CurPage = 1;
        }
        else if (Convert.ToInt32(Request.QueryString["CurPage"].ToString()) == 0 || string.IsNullOrEmpty(Request.QueryString["CurPage"].ToString()))
        {
            CurPage = 1;
        }
        else
        {
            CurPage = Convert.ToInt32(Request.QueryString["CurPage"].ToString());
        }

        clsSpeedo.Authenticate();
        if (!Page.IsPostBack)
        {
            BindEmployee();
            BindAssignStatus();
            //ddlAssignStatus.SelectedValue = "999";

            if (string.IsNullOrEmpty(Request.QueryString["pUser"]))
            {
                ddlEmployee.SelectedValue = "999";
            }
            else
            {
                ddlEmployee.SelectedValue = Request.QueryString["pUser"].ToString();
            }

            if (string.IsNullOrEmpty(Request.QueryString["pStatCode"]))
            {
                ddlAssignStatus.SelectedValue = "999";
            }
            else
            {
                ddlAssignStatus.SelectedValue = Request.QueryString["pStatCode"].ToString();
            }

            using (clsMRCFAssign objAssign = new clsMRCFAssign())
            {
                if (objAssign.GetProcurementManager("PROCMNGR").ToString() == Request.Cookies["Speedo"]["UserName"].ToString())
                {
                    trEmployee.Visible = true;
                }
                else
                {
                    trEmployee.Visible = false;
                }
            }
        }
        //if (Request.QueryString["hdlrcode"] == null) { return; }
        LoadListAssigned(ddlAssignStatus.SelectedValue.ToString(), GetUser(), CurPage);
    }
Esempio n. 2
0
    public string GetUser()
    {
        string strHandler;

        using (clsMRCFAssign objAssign = new clsMRCFAssign())
        {
            if (objAssign.GetProcurementManager("PROCMNGR").ToString() == Request.Cookies["Speedo"]["UserName"].ToString())
            {
                strHandler = ddlEmployee.SelectedValue.ToString();
            }
            else
            {
                strHandler = Request.Cookies["Speedo"]["UserName"].ToString();
            }
        }
        return(strHandler);
    }
Esempio n. 3
0
    protected void btnApprove_Click(object sender, EventArgs e)
    {
        if (!clsOracleMrcf.IsOracleUp())
        {
            Response.Redirect("OracleDatabaseProblem.aspx");
        }

        clsMRCFAssign objAssign = new clsMRCFAssign();

        objAssign.MRCFCode   = Request.QueryString["mrcfcode"].ToString();
        objAssign.AssignBy   = objAssign.GetProcurementManager("PROCMNGR");
        objAssign.CreateBy   = objAssign.GetProcurementManager("PROCMNGR");
        objAssign.IsActive   = "1"; //1 = Active , 0 = Inactive
        objAssign.AssignTo   = ddlAssign.SelectedValue.ToString();
        objAssign.Remarks    = txtAssignRemarks.Text;
        objAssign.StatusCode = objAssign.GetInitialStatusCode();
        objAssign.AssignEmployee();
        objAssign.AssignEmployeeDetails("None");


        using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["Speedo"].ToString()))
        {
            SqlCommand cmd = cn.CreateCommand();
            cn.Open();


            //Retrieve information of MRCF
            DataTable tblMRCF = clsOracleMrcf.GetMRCFDetails(Request.QueryString["mrcfcode"]);

            using (clsOracleMrcf ReqMrcf = new clsOracleMrcf())
            {
                //Update MRCF status
                cmd.CommandText = "UPDATE CIS.Mrcf SET status='A',procstat='A',sprvstat=@sprvstat,headstat=@headstat,procdate='" + DateTime.Now + "',procrem=@procrem WHERE mrcfcode='" + Request.QueryString["mrcfcode"] + "'";
                cmd.Parameters.Add("@procrem", SqlDbType.VarChar, 200);
                cmd.Parameters.Add("@sprvstat", SqlDbType.Char, 1);
                cmd.Parameters.Add("@headstat", SqlDbType.Char, 1);
                cmd.Parameters["@procrem"].Value  = txtProcMngrRem.Text;
                cmd.Parameters["@sprvstat"].Value = (hdnGrpHeadStat.Value == "F" ? "N" : hdnGrpHeadStat.Value);
                cmd.Parameters["@headstat"].Value = (hdnDiviHeadStat.Value == "F" ? "N" : hdnDiviHeadStat.Value);
                cmd.ExecuteNonQuery();
                cmd.Parameters.Clear();

                //Update MRCF Details
                cmd.CommandText = "UPDATE CIS.MrcfDetails SET itemspec=@itemspec WHERE mitmcode=@mitmcode";
                cmd.Parameters.Add("@itemspec", SqlDbType.VarChar, 5000);
                cmd.Parameters.Add("@mitmcode", SqlDbType.BigInt);
                foreach (DataGridItem itm in dgItems.Items)
                {
                    HiddenField phdnMitmCode = (HiddenField)itm.FindControl("hdnMitmCode");
                    TextBox     ptxtItemSpec = (TextBox)itm.FindControl("txtItemSpec");
                    cmd.Parameters["@itemspec"].Value = ptxtItemSpec.Text;
                    cmd.Parameters["@mitmcode"].Value = phdnMitmCode.Value;
                    cmd.ExecuteNonQuery();
                }
                cmd.Parameters.Clear();

                clsMRCF.SendNotification(clsMRCF.MRCFMailType.ApproveToRequestor, txtRequestorName.Text, txtProcMngrName.Text, hdnRequestorMail.Value, txtMrcfCode.Text);
                clsMRCF.SendNotification(clsMRCF.MRCFMailType.ApproveToApproverPM, txtRequestorName.Text, txtProcMngrName.Text, clsUsers.GetEmail(Request.Cookies["Speedo"]["UserName"].ToString()), txtMrcfCode.Text);


                //Validate if the Request is not canvass only. If Not it will enter the ORACLE for Interfacing.
                if (clsMRCF.GetRequestType(Request.QueryString["mrcfcode"]) != "C")
                {
                    //Generate batch entry number
                    int intBatchCode = 0;
                    cmd.CommandText = "SELECT pvalue FROM Speedo.Keys WHERE pkey='btchcode'";
                    intBatchCode    = cmd.ExecuteScalar().ToString().ToInt() + 1;
                    cmd.Parameters.Clear();
                    ReqMrcf.BatchId = intBatchCode;

                    if (ReqMrcf.Insert(tblMRCF) == 1)
                    {
                        //Delete MRCF and Batch if existing
                        cmd.CommandText = "DELETE FROM CIS.MrcfBatch WHERE mrcfcode= @mrcfcode";
                        cmd.Parameters.Add(new SqlParameter("@mrcfcode", Request.QueryString["mrcfcode"].ToString()));
                        cmd.Parameters.Add(new SqlParameter("@btchcode", intBatchCode));
                        cmd.ExecuteNonQuery();
                        cmd.Parameters.Clear();

                        //Insert MRCFCode and Batch code of Approved MRCF that is uploaded in interface table
                        cmd.CommandText = "INSERT INTO CIS.MrcfBatch VALUES (@mrcfcode,@btchcode)";
                        cmd.Parameters.Add(new SqlParameter("@mrcfcode", Request.QueryString["mrcfcode"].ToString()));
                        cmd.Parameters.Add(new SqlParameter("@btchcode", intBatchCode));
                        cmd.ExecuteNonQuery();
                        cmd.Parameters.Clear();

                        //Increment Batchcode in SPeedo.Keys
                        cmd.CommandText = "UPDATE Speedo.Keys SET pvalue=(pvalue+1) WHERE pkey='btchcode'";
                        cmd.ExecuteNonQuery();
                        cmd.Parameters.Clear();
                    }

                    Response.Redirect("MRCFMenu.aspx");
                }
                else
                {
                    Response.Redirect("MRCFMenu.aspx");
                }
            }
        }
    }