protected void btnAttach_Click(object sender, EventArgs e)
    {
        int incidentid = Convert.ToInt16(Session["incidentid"].ToString());
        foreach (GridViewRow gv in grdvwProblem.Rows)
        {
            string gvIDs;
            // Declare local variable deleteChkBxItem of Checkbox type to get the Checkbox Instance of Grid Row
            CheckBox deleteChkBxItem = (CheckBox)gv.FindControl("deleteRec");
            // If deleteChkBxItem is Checked then ,mapped Current site to this user
            if (deleteChkBxItem.Checked)
            {
                int probId;

                gvIDs = ((Label)gv.FindControl("ProblemId")).Text.ToString();
                probId = Convert.ToInt16(gvIDs);
                // Check if gvIDs is not null
                if (gvIDs != "")
                {
                    objIncidentToProblem = objIncidentToProblem.Get_By_id(incidentid, probId);
                    if (objIncidentToProblem.Incidentid==0)
                    {
                    objIncidentToProblem.Incidentid = incidentid;
                    objIncidentToProblem.Problemid = probId;
                    objIncidentToProblem.Insert();
                    }

                }

            }
        }

        lblErrorMsg.Text = "Incident Request is Attached to Current Problems";
    }
Ejemplo n.º 2
0
    protected void btnAttach_Click(object sender, EventArgs e)
    {
        int incidentid = Convert.ToInt16(Session["incidentid"].ToString());

        foreach (GridViewRow gv in grdvwProblem.Rows)
        {
            string gvIDs;
            // Declare local variable deleteChkBxItem of Checkbox type to get the Checkbox Instance of Grid Row
            CheckBox deleteChkBxItem = (CheckBox)gv.FindControl("deleteRec");
            // If deleteChkBxItem is Checked then ,mapped Current site to this user
            if (deleteChkBxItem.Checked)
            {
                int probId;

                gvIDs  = ((Label)gv.FindControl("ProblemId")).Text.ToString();
                probId = Convert.ToInt16(gvIDs);
                // Check if gvIDs is not null
                if (gvIDs != "")
                {
                    objIncidentToProblem = objIncidentToProblem.Get_By_id(incidentid, probId);
                    if (objIncidentToProblem.Incidentid == 0)
                    {
                        objIncidentToProblem.Incidentid = incidentid;
                        objIncidentToProblem.Problemid  = probId;
                        objIncidentToProblem.Insert();
                    }
                }
            }
        }


        lblErrorMsg.Text = "Incident Request is Attached to Current Problems";
    }
Ejemplo n.º 3
0
    //protected void btnReset_Click(object sender, EventArgs e)
    //{
    //    lblErrorMsg.Text = "";
    //    BindGrid();
    //}
    protected void FindIncidentToProblemAttach()
    {
        int incidentid = Convert.ToInt16(Session["incidentid"].ToString());

        foreach (GridViewRow gv in grdvwProblem.Rows)
        {
            string gvIDs;
            // Declare local variable deleteChkBxItem of Checkbox type to get the Checkbox Instance of Grid Row
            CheckBox deleteChkBxItem = (CheckBox)gv.FindControl("deleteRec");
            // If deleteChkBxItem is Checked then ,mapped Current site to this user

            int probId;

            gvIDs  = ((Label)gv.FindControl("ProblemId")).Text.ToString();
            probId = Convert.ToInt16(gvIDs);
            // Check if gvIDs is not null
            if (gvIDs != "")
            {
                objIncidentToProblem = objIncidentToProblem.Get_By_id(incidentid, probId);
                if (objIncidentToProblem.Incidentid != 0)
                {
                    deleteChkBxItem.Checked = true;
                }
            }
        }
    }
    protected void btnAttach_Click(object sender, EventArgs e)
    {
        //Add Exception handilng try catch change by vishal 21-05-2012
        try
        {
        int incidentid = Convert.ToInt32(Session["incidentid"].ToString());
        foreach (GridViewRow gv in grdvwProblem.Rows)
        {
            string gvIDs;
            // Declare local variable deleteChkBxItem of Checkbox type to get the Checkbox Instance of Grid Row
            CheckBox deleteChkBxItem = (CheckBox)gv.FindControl("deleteRec");
            // If deleteChkBxItem is Checked then ,mapped Current site to this user
            if (deleteChkBxItem.Checked)
            {
                int probId;

                gvIDs = ((Label)gv.FindControl("ProblemId")).Text.ToString();
                probId = Convert.ToInt32(gvIDs);
                // Check if gvIDs is not null
                if (gvIDs != "")
                {
                    objIncidentToProblem = objIncidentToProblem.Get_By_id(incidentid, probId);
                    if (objIncidentToProblem.Incidentid == 0)
                    {
                        objIncidentToProblem.Incidentid = incidentid;
                        objIncidentToProblem.Problemid = probId;
                        objIncidentToProblem.Insert();
                    }

                }

            }
        }

        lblErrorMsg.Text = "Incident Request is Attached to Current Problems";
        }
        catch (Exception ex)
        {
            string myScript;
            myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>";
            Page.RegisterClientScriptBlock("MyScript", myScript);
            return;
        }
    }
    protected void btnAttach_Click(object sender, EventArgs e)
    {//Add Exception handilng try catch change by vishal 21-05-2012
        try
        {
            int incidentid = Convert.ToInt32(Session["incidentid"].ToString());
            foreach (GridViewRow gv in grdvwProblem.Rows)
            {
                string gvIDs;
                // Declare local variable deleteChkBxItem of Checkbox type to get the Checkbox Instance of Grid Row
                CheckBox deleteChkBxItem = (CheckBox)gv.FindControl("deleteRec");
                // If deleteChkBxItem is Checked then ,mapped Current site to this user
                if (deleteChkBxItem.Checked)
                {
                    int probId;

                    gvIDs  = ((Label)gv.FindControl("ProblemId")).Text.ToString();
                    probId = Convert.ToInt32(gvIDs);
                    // Check if gvIDs is not null
                    if (gvIDs != "")
                    {
                        objIncidentToProblem = objIncidentToProblem.Get_By_id(incidentid, probId);
                        if (objIncidentToProblem.Incidentid == 0)
                        {
                            objIncidentToProblem.Incidentid = incidentid;
                            objIncidentToProblem.Problemid  = probId;
                            objIncidentToProblem.Insert();
                        }
                    }
                }
            }


            lblErrorMsg.Text = "Incident Request is Attached to Current Problems";
        }
        catch (Exception ex)
        {
            string myScript;
            myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>";
            Page.RegisterClientScriptBlock("MyScript", myScript);
            return;
        }
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        bool FlagUserStatus = true;
        #region Find Userid of User who is Requesting to log a call

        #region If User Already Exist
        if (ViewState["UserCreate"].ToString() == "Exist")
        {
            objOrganization = objOrganization.Get_Organization();
            ObjUserLogin = ObjUserLogin.Get_UserLogin_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid);
            if (ObjUserLogin.Userid != 0)
            {
                requesterid = ObjUserLogin.Userid;
            }
        }
        #endregion
        #region If New User is to be Created
        else if (ViewState["UserCreate"].ToString() == "create")
        {
            string varEmail = "";
            string varRoleName = Resources.MessageResource.BasicUserRole.ToString();
            if (txtEmail.Text == "")
            {
                varEmail = Resources.MessageResource.errMemshipCreateUserEmail.ToString();
            }
            else
            {
                varEmail = txtEmail.Text;
            }

            int roleid = objRole.Get_By_RoleName(varRoleName);
            int status;
            objOrganization = objOrganization.Get_Organization();

            objuser.Username = txtUsername.Text.ToString();
            objuser.Password = Resources.MessageResource.strDefaultPassword.ToString();
            objuser.Roleid = roleid;
            objuser.Orgid = objOrganization.Orgid;
            objuser.ADEnable = false;
            objuser.Enable = true;
            objuser.Createdatetime = DateTime.Now.ToString();
            status = objuser.Insert();
            if (status == 1)
            {
                // Create Mstatus field to send in Membership.CreateUser function as Out Variable for creating Membership User database
                MembershipCreateStatus Mstatus = default(MembershipCreateStatus);
                // Call Membership.CreateUser function to create Membership user
                Membership.CreateUser(txtUsername.Text.ToString().Trim(), Resources.MessageResource.strDefaultPassword.ToString(), varEmail, "Project Name", "Helpdesk", true, out Mstatus);
                // Call Roles.AddUserToRole Function to Add User To Role
                Roles.AddUserToRole(txtUsername.Text.ToString().Trim(), varRoleName);
                // Declare Local Variable Userid to fetch userid of newly created user

                // Create Object objUserLogin of UserLogin_mst()Class
                objuser = new UserLogin_mst();
                // Fetch userid of Newly created user and assign to local variable userid by calling function objUserLogin.Get_By_UserName
                requesterid = objuser.Get_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid);
                // If userid not equal to 0 then we get userid of Newly created user otherwise error Occured

                ContactInfo_mst objContactInfo = new ContactInfo_mst();
                objContactInfo.Userid = requesterid;
                objContactInfo.Emailid = varEmail;
                objContactInfo.Firstname = txtUsername.Text.ToString();
                objContactInfo.Lastname = txtUsername.Text.ToString();
                objContactInfo.Insert();

            }
        }
        #endregion
        #region If User is Not to be Created
        else if (ViewState["UserCreate"].ToString() == "notcreate")
        {
            FlagUserStatus = false;

        }
        #endregion

        #endregion

        MembershipUser User = Membership.GetUser();
        string userName;
        userName = User.UserName.ToString();
        if (FlagUserStatus == true)
        {

            objOrganization = objOrganization.Get_Organization();
            objuser = objuser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid);
            ObjProblem.CreatedByid = objuser.Userid;
            ObjProblem.Requesterid = requesterid;
            ObjProblem.Categoryid = Convert.ToInt16(drpCategory.SelectedValue);
            ObjProblem.Subcategoryid = Convert.ToInt16(drpSubcategory.SelectedValue);

            ObjProblem.Priorityid = Convert.ToInt16(drpPriority.SelectedValue);
            ObjProblem.Statusid = Convert.ToInt16(drpStatus.SelectedValue);
            ObjProblem.Technicianid = Convert.ToInt16(drpTechnician.SelectedValue);
            ObjProblem.title = txtTitle.Text;
            ObjProblem.Description = txtDescription.Text;
            if (Convert.ToInt16(drpTechnician.SelectedValue) != 0)
            {
                ObjProblem.AssginedTime = DateTime.Now.ToString();
            }

            ObjProblem.Insert();
            int problemid = ObjProblem.Get_Current_Problemid();

            ObjProblemHistory.Operationtime = DateTime.Now.ToString();
            ObjProblemHistory.Problemid = problemid;
            ObjProblemHistory.Operation = "create";
            ObjProblemHistory.Operationownerid = objuser.Userid;
            if (Session["IncidentToProblem"] != null)
            {
                int incidentid = Convert.ToInt16(Session["IncidentToProblem"].ToString());
                Incident_To_Problem objIncToprob = new Incident_To_Problem();
                objIncToprob.Incidentid = incidentid;
                objIncToprob.Problemid = problemid;
                objIncToprob.Insert();

            }
            if (Convert.ToInt16(drpTechnician.SelectedValue) != 0)
            {
                objSentMailToUser.SentMailToTechnicianForProblemCall(problemid, Convert.ToInt16(drpTechnician.SelectedValue));

            }

            ObjProblemHistory.Insert();
            //ResetControls();

            string myScript;
            myScript = "<script language=javascript>javascript:window.close();</script>";
            Page.RegisterClientScriptBlock("MyScript", myScript);

        }
    }
Ejemplo n.º 7
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {//Add Exception handilng try catch change by vishal 21-05-2012
        try
        {
            bool FlagUserStatus = true;
            #region Find Userid of User who is Requesting to log a call

            #region If User Already Exist
            if (ViewState["UserCreate"].ToString() == "Exist")
            {
                objOrganization = objOrganization.Get_Organization();
                ObjUserLogin    = ObjUserLogin.Get_UserLogin_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid);
                if (ObjUserLogin.Userid != 0)
                {
                    requesterid = ObjUserLogin.Userid;
                }
            }
            #endregion
            #region If New User is to be Created
            else if (ViewState["UserCreate"].ToString() == "create")
            {
                string varEmail    = "";
                string varRoleName = Resources.MessageResource.BasicUserRole.ToString();
                if (txtEmail.Text == "")
                {
                    varEmail = Resources.MessageResource.errMemshipCreateUserEmail.ToString();
                }
                else
                {
                    varEmail = txtEmail.Text;
                }


                int roleid = objRole.Get_By_RoleName(varRoleName);
                int status;
                objOrganization = objOrganization.Get_Organization();

                objuser.Username       = txtUsername.Text.ToString();
                objuser.Password       = Resources.MessageResource.strDefaultPassword.ToString();
                objuser.Roleid         = roleid;
                objuser.Orgid          = objOrganization.Orgid;
                objuser.ADEnable       = false;
                objuser.Enable         = true;
                objuser.Createdatetime = DateTime.Now.ToString();
                status = objuser.Insert();
                if (status == 1)
                {
                    // Create Mstatus field to send in Membership.CreateUser function as Out Variable for creating Membership User database
                    MembershipCreateStatus Mstatus = default(MembershipCreateStatus);
                    // Call Membership.CreateUser function to create Membership user
                    Membership.CreateUser(txtUsername.Text.ToString().Trim(), Resources.MessageResource.strDefaultPassword.ToString(), varEmail, "Project Name", "Helpdesk", true, out Mstatus);
                    // Call Roles.AddUserToRole Function to Add User To Role
                    Roles.AddUserToRole(txtUsername.Text.ToString().Trim(), varRoleName);
                    // Declare Local Variable Userid to fetch userid of newly created user

                    // Create Object objUserLogin of UserLogin_mst()Class
                    objuser = new UserLogin_mst();
                    // Fetch userid of Newly created user and assign to local variable userid by calling function objUserLogin.Get_By_UserName
                    requesterid = objuser.Get_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid);
                    // If userid not equal to 0 then we get userid of Newly created user otherwise error Occured

                    ContactInfo_mst objContactInfo = new ContactInfo_mst();
                    objContactInfo.Userid    = requesterid;
                    objContactInfo.Emailid   = varEmail;
                    objContactInfo.Firstname = txtUsername.Text.ToString();
                    objContactInfo.Lastname  = txtUsername.Text.ToString();
                    objContactInfo.Insert();
                }
            }
            #endregion
            #region If User is Not to be Created
            else if (ViewState["UserCreate"].ToString() == "notcreate")
            {
                FlagUserStatus = false;
            }
            #endregion

            #endregion

            MembershipUser User = Membership.GetUser();
            string         userName;
            userName = User.UserName.ToString();
            if (FlagUserStatus == true)
            {
                objOrganization          = objOrganization.Get_Organization();
                objuser                  = objuser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid);
                ObjProblem.CreatedByid   = objuser.Userid;
                ObjProblem.Requesterid   = requesterid;
                ObjProblem.Categoryid    = Convert.ToInt32(drpCategory.SelectedValue);
                ObjProblem.Subcategoryid = Convert.ToInt32(drpSubcategory.SelectedValue);

                ObjProblem.Priorityid   = Convert.ToInt32(drpPriority.SelectedValue);
                ObjProblem.Statusid     = Convert.ToInt32(drpStatus.SelectedValue);
                ObjProblem.Technicianid = Convert.ToInt32(drpTechnician.SelectedValue);
                ObjProblem.title        = txtTitle.Text;
                ObjProblem.Description  = txtDescription.Text;
                if (Convert.ToInt32(drpTechnician.SelectedValue) != 0)
                {
                    ObjProblem.AssginedTime = DateTime.Now.ToString();
                }

                ObjProblem.Insert();
                int problemid = ObjProblem.Get_Current_Problemid();

                ObjProblemHistory.Operationtime    = DateTime.Now.ToString();
                ObjProblemHistory.Problemid        = problemid;
                ObjProblemHistory.Operation        = "create";
                ObjProblemHistory.Operationownerid = objuser.Userid;
                if (Session["IncidentToProblem"] != null)
                {
                    int incidentid = Convert.ToInt32(Session["IncidentToProblem"].ToString());
                    Incident_To_Problem objIncToprob = new Incident_To_Problem();
                    objIncToprob.Incidentid = incidentid;
                    objIncToprob.Problemid  = problemid;
                    objIncToprob.Insert();
                }
                if (Convert.ToInt32(drpTechnician.SelectedValue) != 0)
                {
                    objSentMailToUser.SentMailToTechnicianForProblemCall(problemid, Convert.ToInt32(drpTechnician.SelectedValue));
                }

                ObjProblemHistory.Insert();
                //ResetControls();

                string myScript;
                myScript = "<script language=javascript>javascript:window.close();</script>";
                Page.RegisterClientScriptBlock("MyScript", myScript);
            }
        }
        catch (Exception ex)
        {
            string myScript;
            myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>";
            Page.RegisterClientScriptBlock("MyScript", myScript);
            return;
        }
    }
    //protected void btnReset_Click(object sender, EventArgs e)
    //{
    //    lblErrorMsg.Text = "";
    //    BindGrid();
    //}
    protected void FindIncidentToProblemAttach()
    {
        int incidentid = Convert.ToInt32(Session["incidentid"].ToString());
        foreach (GridViewRow gv in grdvwProblem.Rows)
        {
            string gvIDs;
            // Declare local variable deleteChkBxItem of Checkbox type to get the Checkbox Instance of Grid Row
            CheckBox deleteChkBxItem = (CheckBox)gv.FindControl("deleteRec");
            // If deleteChkBxItem is Checked then ,mapped Current site to this user

            int probId;

            gvIDs = ((Label)gv.FindControl("ProblemId")).Text.ToString();
            probId = Convert.ToInt32(gvIDs);
            // Check if gvIDs is not null
            if (gvIDs != "")
            {
                objIncidentToProblem = objIncidentToProblem.Get_By_id(incidentid, probId);
                if (objIncidentToProblem.Incidentid != 0)
                {
                    deleteChkBxItem.Checked = true;
                }

            }

        }
    }
 public int Update_Incident_To_Problem_By_id(Incident_To_Problem objIncident_To_Problem)
 {
     return (int)ExecuteNonQuery(Sp_Incident_To_Problem_Update, new object[] { objIncident_To_Problem.Problemid, objIncident_To_Problem.Incidentid });
 }
 public int Insert_Incident_To_Problem(Incident_To_Problem objIncident_To_Problem)
 {
     return (int)ExecuteNonQuery(Sp_Incident_To_Problem_Insert, new object[] { objIncident_To_Problem.Problemid, objIncident_To_Problem.Incidentid });
 }
 public object GenerateIncident_To_Problem_mstObject(ref IDataReader returnData)
 {
     Incident_To_Problem obj = new Incident_To_Problem();
     while (returnData.Read())
     {
         obj.Incidentid = (int)returnData["Incidentid"];
         obj.Problemid = (int)returnData["Problemid"];
     }
     returnData.Close();
     returnData.Dispose();
     return obj;
 }
    public CollectionBase GenerateIncident_To_Problem_mstCollection(ref IDataReader returnData)
    {
        BLLCollection<Incident_To_Problem> col = new BLLCollection<Incident_To_Problem>();
        while (returnData.Read())
        {

            Incident_To_Problem obj = new Incident_To_Problem();
            obj.Incidentid = (int)returnData["Incidentid"];
            obj.Problemid = (int)returnData["Problemid"];

            col.Add(obj);
        }
        returnData.Close();
        returnData.Dispose();
        return col;
    }