示例#1
0
    //***

    //*** CheckIfSended
    protected void CheckIfSended(SqlCommand cmd, SqlConnection con)
    {
        var    decrypt = new eXSecurity.Decryption();
        string session;

        ArrayList fields = new ArrayList();

        fields.Add("po_sendIt");

        Dictionary <string, string> conditions = new Dictionary <string, string>();

        conditions.Add("po_id", getPoID());

        DataTable dt = Controller.SelectFrom(cmd, con, "CNRS_PurchaseOrder", fields, conditions, new ArrayList(), false, false, "");

        bool po_sendIt = (bool)dt.Rows[0]["po_sendIt"];

        if (po_sendIt == true)
        {
            hideAdd();
        }
        else
        {
            SendBTN.Visible = true;
            RadGridBoxes.MasterTableView.GetColumn("EditCommandColumn").Display = true;
            RadGridBoxes.MasterTableView.GetColumn("delete").Display            = true;
            RadGridBoxes.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
            RadGridBoxes.Rebind();
        }
    }
示例#2
0
    //***** RadGrid1_SelectedIndexChanged
    protected void RadGridBoxes_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            GridDataItem item      = (GridDataItem)RadGridBoxes.SelectedItems[0];//get selected row
            string       user_name = item.GetDataKeyValue("user_name").ToString();

            Dictionary <string, string> fields     = new Dictionary <string, string>();
            Dictionary <string, string> conditions = new Dictionary <string, string>();
            fields.Add("user_isnew", false.ToString());
            conditions.Add("user_name", user_name);

            using (SqlConnection con = new SqlConnection(Controller.connection))
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    con.Open();
                    Controller.Update(cmd, con, "SEC_User", fields, conditions);
                }
            }
            ScriptManager.RegisterStartupScript(this, GetType(), "function", "NewUsers();", true);
            RadGridBoxes.Rebind();
        }
        catch (Exception ex)
        {
            Controller.SaveErrors(Path.GetFileName(Request.PhysicalPath), ex.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name);
        }
    }
示例#3
0
    //RadGridBoxes_SelectedIndexChanged
    protected void RadGridBoxes_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            string role_id = getRoleID();
            if (role_id != "2")
            {
                GridDataItem item  = (GridDataItem)RadGridBoxes.SelectedItems[0];//get selected row
                string       po_id = item.GetDataKeyValue("po_id").ToString();

                Dictionary <string, string> fields     = new Dictionary <string, string>();
                Dictionary <string, string> conditions = new Dictionary <string, string>();
                conditions.Add("po_id", po_id);


                if (role_id == "1")
                {
                    fields.Add("po_isnewforAdmin", false.ToString());
                }
                else
                if (role_id == "3")
                {
                    fields.Add("po_isnewforSectretary", false.ToString());
                }
                else
                if (role_id == "4")
                {
                    fields.Add("po_isnewforDirector", false.ToString());
                }
                else
                if (role_id == "5")
                {
                    fields.Add("po_isnewforHOD", false.ToString());
                }
                else
                if (role_id == "6")
                {
                    fields.Add("po_isnewforTechmical", false.ToString());
                }


                using (SqlConnection con = new SqlConnection(Controller.connection))
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        con.Open();
                        Controller.Update(cmd, con, "CNRS_PurchaseOrder", fields, conditions);
                    }
                }
                RadGridBoxes.Rebind();
            }
        }
        catch (Exception ex)
        {
            Controller.SaveErrors(Path.GetFileName(Request.PhysicalPath), ex.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name);
        }
    }
示例#4
0
    protected void po_date_end_technicalOfficerRCB_Click(object sender, EventArgs e)
    {
        try
        {
            CheckBox rcb = (CheckBox)sender;
            Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)((Control)sender).NamingContainer;

            string po_id              = item.GetDataKeyValue("po_id").ToString();
            string user_email         = ((Label)item.FindControl("user_emailLBL")).Text;
            string user_contactPerson = ((Label)item.FindControl("user_contactPersonLBL")).Text;


            Dictionary <string, string> fields     = new Dictionary <string, string>();
            Dictionary <string, string> conditions = new Dictionary <string, string>();
            conditions.Add("po_id", po_id);

            if (rcb.Checked == true)
            {
                fields.Add("po_date_end_technicalOfficer", DateTime.Now.ToString());
                fields.Add("po_isnewforTechmical", false.ToString());
            }
            else
            {
                fields.Add("po_date_end_technicalOfficer", DBNull.Value.ToString());
            }

            bool sendedEmail = false;
            if (rcb.Checked == true)
            {
                sendedEmail = SendEmail(user_email, user_contactPerson, 1);
            }
            else
            {
                sendedEmail = SendEmail(user_email, user_contactPerson, 2);
            }

            using (SqlConnection con = new SqlConnection(Controller.connection))
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    con.Open();
                    if (sendedEmail == true)
                    {
                        Controller.Update(cmd, con, "CNRS_PurchaseOrder", fields, conditions);
                        AlertJS();
                        RadGridBoxes.Rebind();
                    }
                }
            }
        }
        catch (Exception ex)
        {
            Controller.SaveErrors(Path.GetFileName(Request.PhysicalPath), ex.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name);
        }
    }
示例#5
0
    //***

    //*** hideAdd
    protected void hideAdd()
    {
        SendBTN.Visible = false;
        RadGridBoxes.MasterTableView.GetColumn("EditCommandColumn").Display = false;
        RadGridBoxes.MasterTableView.GetColumn("delete").Display            = false;
        //RadGridBoxes2.MasterTableView.GetColumn("EditCommandColumn").Display = false;
        //RadGridBoxes2.MasterTableView.GetColumn("delete").Display = false;
        RadGridBoxes.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
        RadGridBoxes.Rebind();
        //RadGridBoxes2.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
        //RadGridBoxes2.Rebind();
    }
示例#6
0
    //****

    //*** Security
    protected void Security(DataTable dt)
    {
        if (dt.Rows.Count > 0)
        {
            if (Controller.Can(dt, "can_add") == true)
            {
                RadGridBoxes.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
                RadGridBoxes.Rebind();
            }
            else
            {
                RadGridBoxes.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
                RadGridBoxes.Rebind();
            }
        }
    }
示例#7
0
    protected void po_accept_headOfDepartmentCB_CheckedChanged(object sender, EventArgs e)
    {
        CheckBox cb = (CheckBox)sender;

        Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)((Control)sender).NamingContainer;

        string po_id = item.GetDataKeyValue("po_id").ToString();

        try
        {
            using (SqlConnection con = new SqlConnection(Controller.connection))
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    con.Open();

                    Dictionary <string, string> fields = new Dictionary <string, string>();
                    fields.Add("po_date_headOfDepartment", DateTime.Now.ToString());

                    Dictionary <string, string> conditions = new Dictionary <string, string>();
                    conditions.Add("po_id", po_id);

                    if (cb.Checked == true)
                    {
                        fields.Add("po_accept_headOfDepartment", true.ToString());
                        fields.Add("po_isnewforHOD", false.ToString());
                        Controller.Update(cmd, con, "CNRS_PurchaseOrder", fields, conditions);
                    }
                    else
                    {
                        fields.Add("po_accept_headOfDepartment", false.ToString());
                        Controller.Update(cmd, con, "CNRS_PurchaseOrder", fields, conditions);
                    }
                    AlertJS();
                    RadGridBoxes.Rebind();
                }
            }
        }
        catch (Exception ex)
        {
            Controller.SaveErrors(Path.GetFileName(Request.PhysicalPath), ex.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name);
        }
    }
示例#8
0
    //***

    protected void langRCB_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        Session["language_id"] = langRCB.SelectedValue;
        try
        {
            using (SqlConnection con = new SqlConnection(Controller.connection))
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    Translate(cmd, con);
                    RadGridBoxes.Rebind();
                }
            }
        }
        catch (Exception ex)
        {
            Controller.SaveErrors(Path.GetFileName(Request.PhysicalPath), ex.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name);
        }
    }
    //***

    //*** Security
    protected void Security(DataTable dt)
    {
        if (dt.Rows.Count > 0)
        {
            if (Controller.Can(dt, "can_add") == true)
            {
                RadGridBoxes.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
                RadGridBoxes.Rebind();
            }
            else
            {
                RadGridBoxes.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
                RadGridBoxes.Rebind();
            }

            RadGridBoxes.MasterTableView.GetColumn("delete").Display = Controller.Can(dt, "can_delete");

            // RadGridBoxes.MasterTableView.GetColumn("edit").Display = Controller.Can(dt, "can_edit");

            //  RadGrid.MasterTableView.GetColumn("export").Display = Controller.Can(dt, "can_export");
        }
    }
示例#10
0
    //***

    //*** Security
    protected void Security(DataTable dt)
    {
        string role_id = getRoleID();

        if (dt.Rows.Count > 0)
        {
            if (Controller.Can(dt, "can_add") == true)
            {
                RadGridBoxes.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
                RadGridBoxes.Rebind();
            }
            else
            {
                RadGridBoxes.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
                RadGridBoxes.Rebind();
            }

            RadGridBoxes.MasterTableView.GetColumn("createdOn").Display = Controller.Can(dt, "can_viewReceivedDate");

            RadGridBoxes.MasterTableView.GetColumn("po_number").Display = Controller.Can(dt, "can_fillPoNbr");

            RadGridBoxes.MasterTableView.GetColumn("official_number").Display = Controller.Can(dt, "can_fillOfficialNbre");

            RadGridBoxes.MasterTableView.GetColumn("delete").Display = Controller.Can(dt, "can_delete");

            RadGridBoxes.MasterTableView.GetColumn("EditCommandColumn").Display = Controller.Can(dt, "can_edit");

            RadGridBoxes.MasterTableView.GetColumn("Print").Display = Controller.Can(dt, "can_export");


            RadGridBoxes.MasterTableView.GetColumn("po_accept_director").Display         = false;
            RadGridBoxes.MasterTableView.GetColumn("po_accept_secretary").Display        = false;
            RadGridBoxes.MasterTableView.GetColumn("po_accept_headOfDepartment").Display = false;

            if (role_id == "4") // director
            {
                RadGridBoxes.MasterTableView.GetColumn("po_accept_director").Display = Controller.Can(dt, "can_acceptPO");
            }
            else if (role_id == "3") //secretary
            {
                RadGridBoxes.MasterTableView.GetColumn("po_accept_secretary").Display = Controller.Can(dt, "can_acceptPO");
            }
            else if (role_id == "5") //headOfDepartment
            {
                RadGridBoxes.MasterTableView.GetColumn("po_accept_headOfDepartment").Display = Controller.Can(dt, "can_finishAcceptingPO");
            }

            RadGridBoxes.MasterTableView.GetColumn("po_date_end_technicalOfficer").Display = Controller.Can(dt, "can_reachedPO");

            RadGridBoxes.MasterTableView.GetColumn("po_date_secretary").Display = Controller.Can(dt, "can_viewSecretayRD");

            RadGridBoxes.MasterTableView.GetColumn("po_date_director").Display = Controller.Can(dt, "can_viewDirectorRD");

            RadGridBoxes.MasterTableView.GetColumn("po_date_headOfDepartment").Display = Controller.Can(dt, "can_viewHODRD");

            //RadGridBoxes.MasterTableView.GetColumn("po_date_technicalOfficer").Display = Controller.Can(dt, "can_viewTechnicalOffRD");
        }

        RadGridBoxes.ClientSettings.EnablePostBackOnRowClick = true;
        RadGridBoxes.ClientSettings.Selecting.AllowRowSelect = true;
        RadGridBoxes.ClientSettings.Scrolling.AllowScroll    = false;
        if (role_id == "2")  //  client
        {
            RadGridBoxes.MasterTableView.GetColumn("user_contactPerson").Display = false;
            RadGridBoxes.MasterTableView.GetColumn("user_companyName").Display   = false;
            RadGridBoxes.MasterTableView.GetColumn("user_address").Display       = false;

            RadGridBoxes.ClientSettings.EnablePostBackOnRowClick = false;
            RadGridBoxes.ClientSettings.Selecting.AllowRowSelect = false;
        }
        else if (role_id == "1") //admin
        {
            RadGridBoxes.ClientSettings.Scrolling.AllowScroll = true;
        }
    }
示例#11
0
 protected void hideAdd()
 {
     SendBTN.Visible = false;
     RadGridBoxes.MasterTableView.DetailTables[0].GetColumn("EditCommandColumn").Visible = false;
     RadGridBoxes.Rebind();
 }