Ejemplo n.º 1
0
    protected void btnMove_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            string strID = string.Empty;
            if (Request.QueryString["id"] != null)
            {
                strID = Request.QueryString["id"].ToString();
            }
            if (Request.QueryString["did"] != null)
            {
                strID = Request.QueryString["did"].ToString();
            }
            if (strID.Length > 0)
            {
                dsRequestorsTableAdapters.licenseeTableTableAdapter licenseeTableTA = new dsRequestorsTableAdapters.licenseeTableTableAdapter();
                dsRequestors.licenseeTableDataTable licenseeTableDT = new dsRequestors.licenseeTableDataTable();
                licenseeTableDT = licenseeTableTA.GetLicenseesByRequestorTable(Convert.ToInt32(strID));
                string tmp = string.Empty;
                foreach (DataRow dr in licenseeTableDT)
                {
                    if (dr["RequestorID"] != DBNull.Value)
                    {
                        dr["RequestorID"] = Convert.ToInt32(ddlMLBContacts.SelectedValue);
                        //tmp += dr["id"].ToString() + ":";
                    }
                    //tmp += dr["RequestorID"].ToString() + ":";
                    //if (cblLicensees.Items.FindByValue(dr["id"].ToString()).Selected)
                    //{
                    //    dr["RequestorID"] = Convert.ToInt32(strID);
                    //}
                    //else
                    //{
                    //    dr["RequestorID"] = DBNull.Value;
                    //}
                }

                //lblMoveDone.Text = tmp;
                licenseeTableTA.Update(licenseeTableDT);

                //Display the requester name
                dsRequestorsTableAdapters.requestorsTableAdapter requestorsTA = new dsRequestorsTableAdapters.requestorsTableAdapter();
                dsRequestors.requestorsDataTable requestorsDT = new dsRequestors.requestorsDataTable();
                requestorsDT = requestorsTA.GetRequestorByID(Convert.ToInt32(strID));
                string ln = ddlMLBContacts.SelectedItem.Text.Substring(0, ddlMLBContacts.SelectedItem.Text.IndexOf(" ") - 1);
                string fn = ddlMLBContacts.SelectedItem.Text.Substring(ddlMLBContacts.SelectedItem.Text.IndexOf(" ") + 1);
                lblMoveDone.Text = requestorsDT[0]["FirstName"].ToString() + " " + requestorsDT[0]["LastName"].ToString() + "'s ALL users been assigned to <br>'" + fn + " " + ln + "' SUCCESSFULLY!";
                // Response.Redirect("RequesterMgr.aspx?id=" + ddlMLBContacts.SelectedValue);

                PopulateCblLicensees();
            }
        }
    }
Ejemplo n.º 2
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string strID = string.Empty;

        if (Request.QueryString["id"] != null)
        {
            strID = Request.QueryString["id"].ToString();
        }
        if (Request.QueryString["did"] != null)
        {
            strID = Request.QueryString["did"].ToString();
        }
        if (strID.Length > 0)
        {
            dsRequestorsTableAdapters.licenseeTableTableAdapter licenseeTableTA = new dsRequestorsTableAdapters.licenseeTableTableAdapter();
            dsRequestors.licenseeTableDataTable licenseeTableDT = new dsRequestors.licenseeTableDataTable();
            licenseeTableDT = licenseeTableTA.GetLicenseesByRequestorTable(Convert.ToInt32(strID));
            foreach (DataRow dr in licenseeTableDT)
            {
                if (cblLicensees.Items.FindByValue(dr["id"].ToString()).Selected)
                {
                    dr["RequestorID"] = Convert.ToInt32(strID);
                }
                else
                {
                    dr["RequestorID"] = DBNull.Value;
                }
            }
            licenseeTableTA.Update(licenseeTableDT);

            /*
             *  dsRequestorsTableAdapters.licenseeTableAdapter licenseeTA = new dsRequestorsTableAdapters.licenseeTableAdapter();
             * dsRequestors.licenseeDataTable licenseeDT = new dsRequestors.licenseeDataTable();
             * licenseeDT = licenseeTA.GetLicenseesByRequestor(Convert.ToInt32(Request.QueryString["id"].ToString()));
             * foreach (DataRow dr in licenseeDT)
             * {
             *  if (cblLicensees.Items.FindByValue(dr["ID"].ToString()).Selected)
             *  {
             *      dr["RequestorID"] = Convert.ToInt32(Request.QueryString["id"].ToString());
             *
             *  }
             *
             *
             *
             * }
             *
             */
            //Display the requester name
            dsRequestorsTableAdapters.requestorsTableAdapter requestorsTA = new dsRequestorsTableAdapters.requestorsTableAdapter();
            dsRequestors.requestorsDataTable requestorsDT = new dsRequestors.requestorsDataTable();
            requestorsDT           = requestorsTA.GetRequestorByID(Convert.ToInt32(strID));
            lblDone.Text           = requestorsDT[0]["FirstName"].ToString() + " " + requestorsDT[0]["LastName"].ToString() + "'s user list has been updated SUCCESSFULLY!";
            ddlMLBContacts.Enabled = false;
            btnMove.Enabled        = false;
            lblDone.Visible        = true;

            pnlEdit.Visible  = true;
            pnlUsers.Visible = false;
        }
        else
        {
            Response.Redirect("RequesterMgr.aspx");
        }
    }