Example #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();
        }
    }
Example #2
0
    protected void SendEmail(object sender, EventArgs e)
    {
        var       decrypt  = new eXSecurity.Decryption();
        string    username = string.Empty;
        string    password = string.Empty;
        DataTable dt       = new DataTable();
        Dictionary <string, string> conditions = new Dictionary <string, string>();

        conditions.Add("user_email", user_emailTXT.Text.Trim());
        conditions.Add("user_name", usernameTXT.Value);

        using (SqlConnection con = new SqlConnection(Controller.connection))
        {
            using (SqlCommand cmd = new SqlCommand())
            {
                con.Open();
                dt = Controller.ExtraSelect(con, cmd, "SELECT user_contactPerson, user_password FROM SEC_User", conditions, "");
            }
        }

        if (dt.Rows.Count > 0)
        {
            SendEmailToUser(decrypt.DecryptData(dt.Rows[0]["user_password"].ToString()), dt.Rows[0]["user_contactPerson"].ToString());

            AlertJS(1);

            ClearTXT();
        }
        else
        {
            AlertJS(2);
        }
    }
    protected string getPoID()
    {
        var    decrypt = new eXSecurity.Decryption();
        string session;

        try
        {
            session = Request["P"].ToString();
            session = session.Replace(" ", "+");
        }
        catch (Exception ex)
        {
            Redirect("~/Pages/PurchaseOrder.aspx");
            return("");
        }
        return(decrypt.DecryptData(session));
    }
Example #4
0
    //***

    protected string getRoleID()
    {
        var    decrypt = new eXSecurity.Decryption();
        string session;

        try
        {
            session = Session["role_id"].ToString();
            session = session.Replace(" ", "+");
        }
        catch (Exception ex)
        {
            Session["user_name"] = "";
            Redirect("~/Login/Login.aspx");
            return("");
        }
        return(decrypt.DecryptData(session));
    }
Example #5
0
    //***


    //*** RadGridBoxes_NeedDataSource1
    protected void RadGridBoxes_NeedDataSource1(object sender, GridNeedDataSourceEventArgs e)
    {
        try
        {
            var    decrypt = new eXSecurity.Decryption();
            string session = Session["tldh_id"].ToString();
            session = session.Replace(" ", "+");
            string tldh_id = decrypt.DecryptData(session);

            //RadGridBoxes.MasterTableView.IsItemInserted = true;

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

                    cmd.CommandText = "select * from CNRS_TLDHeaderDetails where active = @active and tldh_id = @tldh_id and tldhd_name <> @tldhd_name;";
                    cmd.Parameters.AddWithValue("active", true.ToString());
                    cmd.Parameters.AddWithValue("tldhd_name", "");
                    cmd.Parameters.AddWithValue("tldh_id", tldh_id);
                    cmd.Connection  = con;
                    cmd.CommandType = CommandType.Text;
                    SqlDataAdapter sda = new SqlDataAdapter();
                    sda.SelectCommand = cmd;
                    sda.Fill(dt);

                    RadGridBoxes.DataSource = dt;
                }
            }
        }
        catch (Exception ex)
        {
            Controller.SaveErrors(Path.GetFileName(Request.PhysicalPath), ex.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name);
        }
    }
Example #6
0
    //***

    //*** RadGridBoxes_ItemCommand
    protected void RadGridBoxes_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
    {
        try
        {
            if (e.CommandName == "PerformInsert")   // add
            {
                var    decrypt = new eXSecurity.Decryption();
                string session = Session["tldh_id"].ToString();
                session = session.Replace(" ", "+");
                string tldh_id = decrypt.DecryptData(session);

                GridDataItem item = e.Item as GridDataItem;

                string po_id      = "";
                string tldhd_name = Controller.Clean(((TextBox)item.FindControl("tldhd_nameTXT")).Text);

                using (SqlConnection con = new SqlConnection(Controller.connection))
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        Dictionary <string, string> fields = new Dictionary <string, string>();
                        fields.Add("tldhd_name", tldhd_name);
                        fields.Add("tldh_id", tldh_id);
                        fields.Add("createdBy", Session["user_name"].ToString());

                        con.Open();
                        po_id = Controller.InsertInto(cmd, con, "CNRS_TLDHeaderDetails", fields, true);
                    }
                }
            }


            if (e.CommandName == "Update")   //edit
            {
                if (e.Item is GridDataItem)
                {
                    GridDataItem item = e.Item as GridDataItem;

                    int    tldhd_id   = (int)item.GetDataKeyValue("tldhd_id");
                    string tldhd_name = Controller.Clean(((TextBox)item.FindControl("tldhd_nameTXT")).Text);

                    using (SqlConnection con = new SqlConnection(Controller.connection))
                    {
                        using (SqlCommand cmd = new SqlCommand())
                        {
                            Dictionary <string, string> fields = new Dictionary <string, string>();
                            fields.Add("tldhd_name", tldhd_name);
                            fields.Add("modifedBy", Session["user_name"].ToString());
                            fields.Add("modifiedOn", DateTime.Now.ToString());

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

                            con.Open();
                            Controller.Update(cmd, con, "CNRS_TLDHeaderDetails", fields, conditions);
                            AlertJS();
                        }
                    }
                }
            }


            else if (e.CommandName == "Delete")  // inactivate
            {
                if (e.Item is GridDataItem)
                {
                    GridDataItem item = e.Item as GridDataItem;

                    int tldhd_id = (int)item.GetDataKeyValue("tldhd_id");
                    using (SqlConnection con = new SqlConnection(Controller.connection))
                    {
                        using (SqlCommand cmd = new SqlCommand())
                        {
                            con.Open();
                            Controller.Inactivate(cmd, con, "CNRS_TLDHeaderDetails", "tldhd_id", tldhd_id.ToString(), Session["user_name"].ToString());
                            AlertJS();
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            Controller.SaveErrors(Path.GetFileName(Request.PhysicalPath), ex.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name);
        }
    }