Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string strStatusClose = Resources.MessageResource.strStatusClose.ToString().Trim();
        string statusString   = "";
        int    incidentid     = Convert.ToInt16(Request.QueryString[0]);

        Objincident          = Objincident.Get_By_id(incidentid);
        Objincidentstate     = Objincidentstate.Get_By_id(incidentid);
        Objincidentresoution = Objincidentresoution.Get_By_id(incidentid);
        objstatus            = objstatus.Get_By_id(Objincidentstate.Statusid);
        statusString         = objstatus.Statusname.ToString();
        if (statusString.ToLower() == strStatusClose.ToLower())
        {
            lbltcktno.Text     = Objincident.Incidentid.ToString();
            lblcreatedate.Text = Objincident.Createdatetime.ToString();

            if (Objincidentstate.AssignedTime != null)
            {
                lblstarttime.Text = Objincidentstate.AssignedTime.ToString();
            }
            lblendtime.Text = Objincident.Completedtime.ToString();
            Objcategory     = Objcategory.Get_By_id(Objincidentstate.Categoryid);

            lblcomponenteffected.Text = Objcategory.CategoryName.ToString();
            lbldescription.Text       = Objincident.Title.ToString();
            string bb       = Objincidentresoution.Resolution.ToString();
            string stripped = Regex.Replace(bb, @"<(.|\n)*?>", string.Empty);
            lblresolution.Text = stripped.ToString();
            //bind data to data bound controls and do other stuff
            objUser           = objUser.Get_By_id(Objincident.Requesterid);
            lblcustomer.Text  = objUser.Username.ToString();
            objUser           = objUser.Get_By_id(Objincidentstate.Technicianid);
            lblengineer.Text  = objUser.Username.ToString();
            objstatus         = objstatus.Get_By_id(Objincidentstate.Statusid);
            lblrcaresult.Text = objstatus.Statusname.ToString();
        }
        Response.Clear();       //this clears the Response of any headers or previous output
        Response.Buffer = true; //make sure that the entire output is rendered simultaneously

        ///
        ///Set content type to MS Excel sheet
        ///Use "application/msword" for MS Word doc files
        ///"application/pdf" for PDF files
        ///

        Response.ContentType = "application/vnd.ms-excel";
        StringWriter stringWriter = new StringWriter(); //System.IO namespace should be used

        HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter);

        ///
        ///Render the entire Page control in the HtmlTextWriter object
        ///We can render individual controls also, like a DataGrid to be
        ///exported in custom format (excel, word etc)
        ///
        this.RenderControl(htmlTextWriter);
        Response.Write(stringWriter.ToString());
        Response.End();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string strStatusClose = Resources.MessageResource.strStatusClose.ToString().Trim();
        string statusString = "";
        int incidentid =Convert.ToInt16(Request.QueryString[0]);
        Objincident = Objincident.Get_By_id(incidentid);
        Objincidentstate = Objincidentstate.Get_By_id(incidentid);
        Objincidentresoution = Objincidentresoution.Get_By_id(incidentid);
        objstatus = objstatus.Get_By_id(Objincidentstate.Statusid);
        statusString = objstatus.Statusname.ToString();
         if (statusString.ToLower() == strStatusClose.ToLower())
        {
        lbltcktno.Text = Objincident.Incidentid.ToString();
        lblcreatedate.Text = Objincident.Createdatetime.ToString();

        if (Objincidentstate.AssignedTime != null)
        {
            lblstarttime.Text = Objincidentstate.AssignedTime.ToString();
        }
        lblendtime.Text = Objincident.Completedtime.ToString();
        Objcategory=Objcategory.Get_By_id(Objincidentstate.Categoryid);

        lblcomponenteffected.Text = Objcategory.CategoryName.ToString();
        lbldescription.Text = Objincident.Title.ToString();
        string bb = Objincidentresoution.Resolution.ToString();
           string stripped = Regex.Replace(bb,@"<(.|\n)*?>",string.Empty);
           lblresolution.Text = stripped.ToString();
        //bind data to data bound controls and do other stuff
           objUser = objUser.Get_By_id(Objincident.Requesterid);
           lblcustomer.Text = objUser.Username.ToString();
           objUser = objUser.Get_By_id(Objincidentstate.Technicianid);
           lblengineer.Text = objUser.Username.ToString();
           objstatus = objstatus.Get_By_id(Objincidentstate.Statusid);
           lblrcaresult.Text = objstatus.Statusname.ToString();
           }
        Response.Clear(); //this clears the Response of any headers or previous output
        Response.Buffer = true; //make sure that the entire output is rendered simultaneously

        ///
        ///Set content type to MS Excel sheet
        ///Use "application/msword" for MS Word doc files
        ///"application/pdf" for PDF files
        ///

        Response.ContentType = "application/vnd.ms-excel";
        StringWriter stringWriter = new StringWriter(); //System.IO namespace should be used

        HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter);

        ///
        ///Render the entire Page control in the HtmlTextWriter object
        ///We can render individual controls also, like a DataGrid to be
        ///exported in custom format (excel, word etc)
        ///
        this.RenderControl(htmlTextWriter);
        Response.Write(stringWriter.ToString());
        Response.End();
    }
Beispiel #3
0
    protected void Statusgrdvw_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        string name, desc, id;
        int    StatusId = 0;

        name            = ((TextBox)Statusgrdvw.Rows[e.RowIndex].Cells[1].Controls[0]).Text;
        desc            = ((TextBox)Statusgrdvw.Rows[e.RowIndex].Cells[2].Controls[0]).Text;
        id              = Convert.ToString(Statusgrdvw.Rows[e.RowIndex].Cells[0].Text);
        StatusId        = Convert.ToInt32(id);
        statusnamecount = ObjStatus.Get_By_StatusName(name);
        ObjStatus       = ObjStatus.Get_By_id(StatusId);

        if ((statusnamecount == 0) && (name != ""))
        {
            ObjStatus.Statusid    = StatusId;
            ObjStatus.Statusname  = name;
            ObjStatus.Description = desc;
            ObjStatus.Update();
            Statusgrdvw.EditIndex = -1;
            BindGrid();
            lblerrmsg.Text = Resources.MessageResource.errupdate.ToString();
        }
        else if (name == "")
        {
            lblerrmsg.Text = Resources.MessageResource.errnotempty.ToString();
        }
        else if (ObjStatus.Statusname.ToLower() == name.ToLower())
        {
            ObjStatus.Statusid    = StatusId;
            ObjStatus.Statusname  = name;
            ObjStatus.Description = desc;
            ObjStatus.Update();
            Statusgrdvw.EditIndex = -1;
            BindGrid();
            lblerrmsg.Text = Resources.MessageResource.errupdate.ToString();
        }
        else
        {
            lblerrmsg.Text = Resources.MessageResource.errStatusExist.ToString();
        }
    }
Beispiel #4
0
    protected void grdvwRequest_RowDataBound(Object sender, GridViewRowEventArgs e)
    {
        System.Drawing.ColorConverter   colConvert = new ColorConverter();
        BLLCollection <ColorScheme_mst> colColor   = new BLLCollection <ColorScheme_mst>();

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            #region Autogenerate Serial number
            Label lblSerial = (Label)e.Row.FindControl("lblSerial");
            lblSerial.Text = i.ToString();
            i++;
            #endregion

            int TotalTimeSpentonCall;
            int TotalResolutionTime;


            int    varIncidentid     = Convert.ToInt16(((Label)e.Row.FindControl("incidentid")).Text.ToString());
            string varCreateDatetime = e.Row.Cells[9].Text;
            string varStatusOpen     = Resources.MessageResource.strStatusOpen.ToString();
            string varStatusClose    = Resources.MessageResource.strStatusClose.ToString();
            string varStatusOnHold   = Resources.MessageResource.strStatusOnHold.ToString();
            string varStatusResolved = Resources.MessageResource.strStatusResolved.ToString();

            #region Bind Data Row at Run time with requesterid to Requester name
            int requesterid = Convert.ToInt16(e.Row.Cells[3].Text);
            objUser = objUser.Get_By_id(requesterid);

            if (objUser.Userid != 0)
            {
                e.Row.Cells[3].Text = objUser.Username.ToString();
            }
            else
            {
                e.Row.Cells[3].Text = "";
            }
            #endregion

            #region Bind Datarow at Run Time with Createdbyid to Created by name
            int createdbyid = Convert.ToInt16(e.Row.Cells[4].Text);
            objUser = objUser.Get_By_id(createdbyid);
            if (objUser.Userid != 0)
            {
                e.Row.Cells[4].Text = objUser.Username.ToString();
            }
            else
            {
                e.Row.Cells[4].Text = "";
            }
            #endregion

            #region Bind Datarow at Run Time with technicianid to technician name
            int technicianid = Convert.ToInt16(e.Row.Cells[5].Text);
            objUser = objUser.Get_By_id(technicianid);
            if (objUser.Userid != 0)
            {
                e.Row.Cells[5].Text = objUser.Username.ToString();
            }
            else
            {
                e.Row.Cells[5].Text = "";
            }
            #endregion

            #region Bind Datarow at run time with Statusid to Status
            int statusid = Convert.ToInt16(e.Row.Cells[6].Text);
            objStatus = objStatus.Get_By_id(statusid);
            if (objStatus.Statusid != 0)
            {
                e.Row.Cells[6].Text = objStatus.Statusname.ToString();
            }
            else
            {
                e.Row.Cells[6].Text = "";
            }
            #endregion

            #region Bind Datarow at run time with Priorityid to Priority
            int priorityid = Convert.ToInt16(e.Row.Cells[7].Text);
            objPriority = objPriority.Get_By_id(priorityid);
            if (objPriority.Priorityid != 0)
            {
                e.Row.Cells[7].Text = objPriority.Name.ToString();
            }
            else
            {
                e.Row.Cells[7].Text = "";
            }
            #endregion


            #region Bind Datarow at run time with Siteid to Site
            int siteid = Convert.ToInt16(e.Row.Cells[8].Text);
            objSite = objSite.Get_By_id(siteid);
            if (objSite.Siteid != 0)
            {
                string custSiteName;
                int    custid = 0;
                colCustToSite = objCustToSite.Get_All_By_siteid(objSite.Siteid);
                foreach (CustomerToSiteMapping objCuToSite in colCustToSite)
                {
                    custid = objCuToSite.Custid;
                }
                objCustomer = objCustomer.Get_By_id(custid);

                e.Row.Cells[8].Text = objCustomer.Customer_name + "/" + objSite.Sitename.ToString();
            }
            else
            {
                e.Row.Cells[8].Text = "";
            }
            #endregion

            #region Apply Color Coding to Open Calls,According to define SLA
            if (varStatusOpen.ToLower() == objStatus.Statusname.ToString().ToLower())
            {
                Incident_mst obj = new Incident_mst();
                obj = obj.Get_By_id(varIncidentid);
                if (obj.Incidentid != 0)
                {
                    if (obj.Slaid != 0)
                    {
                        #region Declare local variables,and objects of various classes
                        int percent;

                        ProcessEscalateEmail objPro = new ProcessEscalateEmail();
                        #endregion
                        #region Get Total Resolution time define for particular SLA and Time Spent on Request
                        TotalResolutionTime  = objPro.GetResolutionTimeInMins(obj.Slaid);
                        TotalTimeSpentonCall = objIncident.Get_TimeSpentonRequest(varIncidentid, siteid, varCreateDatetime, DateTime.Now.ToString());
                        if (TotalTimeSpentonCall < 0)
                        {
                            TotalTimeSpentonCall = 0;
                        }
                        #endregion
                        #region Calculate Percent
                        percent = (TotalTimeSpentonCall * 100) / TotalResolutionTime;

                        #endregion

                        ColorScheme_mst objColor = new ColorScheme_mst();
                        colColor = objColor.Get_All_By_CallStatus(varStatusOpen);


                        foreach (ColorScheme_mst objCol in colColor)
                        {
                            if (objCol.Percnt_to != 0)
                            {
                                if (percent >= objCol.Percnt && percent <= objCol.Percnt_to)
                                {
                                    e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(objCol.Colorname);
                                }
                            }
                            else
                            {
                                if (percent >= objCol.Percnt)
                                {
                                    e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(objCol.Colorname);
                                }
                            }
                        }
                    }
                    else
                    {
                        ColorScheme_mst objColor = new ColorScheme_mst();
                        colColor = objColor.Get_All_By_CallStatus("NonSLA");


                        foreach (ColorScheme_mst objCol in colColor)
                        {
                            e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(objCol.Colorname);
                        }
                    }
                }
            }
            #endregion

            #region Apply Color Coding to Close Calls
            if (varStatusClose.ToLower() == objStatus.Statusname.ToString().ToLower())
            {
                ColorScheme_mst objColor = new ColorScheme_mst();
                colColor = objColor.Get_All_By_CallStatus(varStatusClose);
                foreach (ColorScheme_mst obj in colColor)
                {
                    try { e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(obj.Colorname); }
                    catch (Exception ex)
                    { e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString("White"); }
                }
            }
            #endregion

            #region Apply Color Coding to On Hold Calls
            if (varStatusOnHold.ToLower() == objStatus.Statusname.ToString().ToLower())
            {
                ColorScheme_mst objColor = new ColorScheme_mst();
                colColor = objColor.Get_All_By_CallStatus(varStatusOnHold);
                foreach (ColorScheme_mst obj in colColor)
                {
                    e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(obj.Colorname);
                }
            }
            #endregion

            #region Apply Color Coding to Resolved Calls
            if (varStatusResolved.ToLower() == objStatus.Statusname.ToString().ToLower())
            {
                ColorScheme_mst objColor = new ColorScheme_mst();
                colColor = objColor.Get_All_By_CallStatus(varStatusResolved);
                foreach (ColorScheme_mst obj in colColor)
                {
                    e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(obj.Colorname);
                }
            }
            #endregion
        }
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        //Add Exception handilng try catch change by vishal 21-05-2012
        try
        {
            # region Declare Local Variable
            string StrStatusRequested;
            string StrStatusRejected;
            string StrStatusApproval;
            string StrStatusApproved;
            string StrStatusPlanning;
            string StrStatusTesting;
            string StrStatusRelease;
            string StrStatusImplemented;
            string StrStatusCompleted;
            string StrStatusString = "";
            int userid = 0;
            int changeid = Convert.ToInt32(Request.QueryString[0]);
            string userName = "";
            #endregion
            #region Fetch the Status Value from Resource File
            StrStatusString = GetChangeStatusString(Convert.ToInt32(drpStatus.SelectedValue));
            StrStatusRejected = Resources.MessageResource.StrRejected.ToString();
            StrStatusApproval = Resources.MessageResource.StrApproval.ToString();
            StrStatusRequested = Resources.MessageResource.StrRequested.ToString();
            StrStatusApproved = Resources.MessageResource.StrApproved.ToString();
            StrStatusPlanning = Resources.MessageResource.StrPlanning.ToString();
            StrStatusTesting = Resources.MessageResource.StrTesting.ToString();
            StrStatusRelease = Resources.MessageResource.StrRelease.ToString();
            StrStatusImplemented = Resources.MessageResource.StrImplemented.ToString();
            StrStatusCompleted = Resources.MessageResource.StrCompleted.ToString();

            #endregion
            MembershipUser User = Membership.GetUser();
            userName = User.UserName.ToString();

            #region On the basis of Username ,get Userid by calling Function Get_UserLogin_By_UserName(),via passing parameter Username and organizationid

            if (userName != "")
            {
                Objorganization = Objorganization.Get_Organization();
                ObjUser = ObjUser.Get_UserLogin_By_UserName(userName, Objorganization.Orgid);
                if (ObjUser.Userid != 0)
                {
                    userid = ObjUser.Userid;
                }
            }
            #endregion

            #region Insert Historyvalue in Change History Table
            int result = String.Compare(StrStatusString, StrStatusRequested, true);
            if (result == 0)
            {
                ObjChangeHistory.Changeid = changeid;
                ObjChangeHistory.Operationownerid = userid;
                ObjChangeHistory.Operation = "Requested";
                ObjChangeHistory.Insert();
            }
            result = String.Compare(StrStatusString, StrStatusRejected, true);
            if (result == 0)
            {
                ObjChangeHistory.Changeid = changeid;
                ObjChangeHistory.Operationownerid = userid;
                ObjChangeHistory.Operation = "Rejected";
                ObjChangeHistory.Insert();
            }
            result = String.Compare(StrStatusString, StrStatusApproval, true);
            if (result == 0)
            {
                ObjChangeHistory.Changeid = changeid;
                ObjChangeHistory.Operationownerid = userid;
                ObjChangeHistory.Operation = "Approval";
                ObjChangeHistory.Insert();
            }
            result = String.Compare(StrStatusString, StrStatusApproved, true);
            if (result == 0)
            {
                ObjChangeHistory.Changeid = changeid;
                ObjChangeHistory.Operationownerid = userid;
                ObjChangeHistory.Operation = "Approved";
                ObjChangeHistory.Insert();
            }
            result = String.Compare(StrStatusString, StrStatusPlanning, true);
            if (result == 0)
            {
                ObjChangeHistory.Changeid = changeid;
                ObjChangeHistory.Operationownerid = userid;
                ObjChangeHistory.Operation = "Planning";
                ObjChangeHistory.Insert();
            }
            result = String.Compare(StrStatusString, StrStatusTesting, true);
            if (result == 0)
            {
                ObjChangeHistory.Changeid = changeid;
                ObjChangeHistory.Operationownerid = userid;
                ObjChangeHistory.Operation = "Testing";
                ObjChangeHistory.Insert();
            }
            result = String.Compare(StrStatusString, StrStatusRelease, true);
            if (result == 0)
            {
                ObjChangeHistory.Changeid = changeid;
                ObjChangeHistory.Operationownerid = userid;
                ObjChangeHistory.Operation = "Release";
                ObjChangeHistory.Insert();
            }
            result = String.Compare(StrStatusString, StrStatusImplemented, true);
            if (result == 0)
            {
                ObjChangeHistory.Changeid = changeid;
                ObjChangeHistory.Operationownerid = userid;
                ObjChangeHistory.Operation = "Implemented";
                ObjChangeHistory.Insert();
            }
            result = String.Compare(StrStatusString, StrStatusCompleted, true);
            if (result == 0)
            {
                ObjChangeHistory.Changeid = changeid;
                ObjChangeHistory.Operationownerid = userid;
                ObjChangeHistory.Operation = "Completed";
                ObjChangeHistory.Insert();
            }
            #endregion
            #region Get the Current historyid by calling function Get_Current_ProblemHistoryid()

            int historyid = ObjChangeHistory.Get_Current_ChangeHistoryid();
            #endregion
            #region Find Current value of Problem aBy Calling Function Get_By_id(),via passing problemid

            ObjChange = ObjChange.Get_By_id(changeid);

            #endregion
            #region Insert into ChangeHistoryDiff table ,By Comparing Current value and Updated Values
            if (ObjChange.Changeid != 0)
            {
                #region Declare local variable
                string columnName;
                string prev_value;
                string curnt_value;
                #endregion
                #region If Priority value is changed,Insert into ChangeHistoryDiff table

                if (ObjChange.Priority != Convert.ToInt32(drpPriority.SelectedValue))
                {
                    columnName = Resources.MessageResource.strColumnPriorityid.ToString();
                    prev_value = Convert.ToString(ObjChange.Priority);
                    curnt_value = Convert.ToString(drpPriority.SelectedValue);
                    ObjChangeHistoryDiff.Historyid = historyid;
                    ObjChangeHistoryDiff.Columnname = columnName;
                    ObjChangeHistoryDiff.Current_value = curnt_value;
                    ObjChangeHistoryDiff.Prev_value = prev_value;
                    ObjChangeHistoryDiff.Insert();
                }
                #endregion
                #region If Technician value is changed,Insert into ChangeHistoryDiff table
                if (ObjChange.Technician != Convert.ToInt32(drpTechnician.SelectedValue))
                {
                    columnName = Resources.MessageResource.strColumnTechnicianid.ToString();
                    prev_value = Convert.ToString(ObjChange.Technician);
                    curnt_value = Convert.ToString(drpTechnician.SelectedValue);
                    ObjChangeHistoryDiff.Historyid = historyid;
                    ObjChangeHistoryDiff.Columnname = columnName;
                    ObjChangeHistoryDiff.Current_value = curnt_value;
                    ObjChangeHistoryDiff.Prev_value = prev_value;
                    ObjChangeHistoryDiff.Insert();

                }
                #endregion
                #region If category value is changed,Insert into ChangeHistoryDiff table

                if (ObjChange.Categoryid != Convert.ToInt32(drpCategory.SelectedValue))
                {
                    columnName = Resources.MessageResource.strColumnCategoryid.ToString();
                    prev_value = Convert.ToString(ObjChange.Categoryid);
                    curnt_value = Convert.ToString(drpCategory.SelectedValue);
                    ObjChangeHistoryDiff.Historyid = historyid;
                    ObjChangeHistoryDiff.Columnname = columnName;
                    ObjChangeHistoryDiff.Current_value = curnt_value;
                    ObjChangeHistoryDiff.Prev_value = prev_value;
                    ObjChangeHistoryDiff.Insert();
                }
                #endregion
                #region If Subcategory value is changed,Insert into ChangeHistoryDiff table

                if (ObjChange.Subcategoryid != Convert.ToInt32(drpSubcategory.SelectedValue))
                {
                    columnName = Resources.MessageResource.strColumnSubcategoryid.ToString();
                    prev_value = Convert.ToString(ObjChange.Subcategoryid);
                    curnt_value = Convert.ToString(drpSubcategory.SelectedValue);
                    ObjChangeHistoryDiff.Historyid = historyid;
                    ObjChangeHistoryDiff.Columnname = columnName;
                    ObjChangeHistoryDiff.Current_value = curnt_value;
                    ObjChangeHistoryDiff.Prev_value = prev_value;
                    ObjChangeHistoryDiff.Insert();
                }
                #endregion
                #region If Changetype value is changed,Insert into ChangeHistoryDiff table

                if (ObjChange.Changetype != Convert.ToInt32(drpchangetype.SelectedValue))
                {
                    columnName = Resources.MessageResource.strColumnChangeType.ToString();
                    prev_value = Convert.ToString(ObjChange.Changetype);
                    curnt_value = Convert.ToString(drpchangetype.SelectedValue);
                    ObjChangeHistoryDiff.Historyid = historyid;
                    ObjChangeHistoryDiff.Columnname = columnName;
                    ObjChangeHistoryDiff.Current_value = curnt_value;
                    ObjChangeHistoryDiff.Prev_value = prev_value;
                    ObjChangeHistoryDiff.Insert();
                }
                #endregion
                #region If Changestatus value is changed,Insert into ChangeHistoryDiff table

                if (ObjChange.Changetype != Convert.ToInt32(drpStatus.SelectedValue))
                {
                    columnName = Resources.MessageResource.strColumnstatusid.ToString();
                    prev_value = Convert.ToString(ObjChange.Statusid);
                    curnt_value = Convert.ToString(drpStatus.SelectedValue);
                    ObjChangeHistoryDiff.Historyid = historyid;
                    ObjChangeHistoryDiff.Columnname = columnName;
                    ObjChangeHistoryDiff.Current_value = curnt_value;
                    ObjChangeHistoryDiff.Prev_value = prev_value;
                    ObjChangeHistoryDiff.Insert();
                }
                #endregion

            }
            #endregion
            #region Update the completed status

            #endregion
            #region update the data in change_mst table

            ObjChange.Technician = Convert.ToInt32(drpTechnician.SelectedValue);
            ObjChange.Categoryid = Convert.ToInt32(drpCategory.SelectedValue);
            ObjChange.Subcategoryid = Convert.ToInt32(drpSubcategory.SelectedValue);
            ObjChange.Priority = Convert.ToInt32(drpPriority.SelectedValue);
            ObjChange.Changetype = Convert.ToInt32(drpchangetype.SelectedValue);
            ObjChange.Statusid = Convert.ToInt32(drpStatus.SelectedValue);
            ObjChange.Changeid = Convert.ToInt32(Request.QueryString[0]);
            ObjChange.Active = true;
            #region If Current status is closed,then Assign Completed time
            result = String.Compare(StrStatusString, StrStatusCompleted, true);
            if (result == 0)
            {
                BLLCollection<Incident_To_Change> colincidentchnage = new BLLCollection<Incident_To_Change>();
                colincidentchnage = Objincidenttochange.Get_All_By_Changeid(changeid);
                int id = 0;
                foreach (Incident_To_Change objitoc in colincidentchnage)
                {
                    id = Convert.ToInt32(objitoc.Incidentid);
                }

                IncidentStates objstate = new IncidentStates();
                objstate = objstate.Get_By_id(id);
                Status_mst objincidentstats = new Status_mst();

                objincidentstats = objincidentstats.Get_By_id(objstate.Statusid);
                string currentincidentstatus = objincidentstats.Statusname.ToString();
                int comparestatus = String.Compare(currentincidentstatus, Resources.MessageResource.strStatusClose.ToString(), true);
                if (comparestatus == 0)
                {
                    ObjChange.Completedtime = DateTime.Now.ToString();
                    Change_mst Objcurrentchange = new Change_mst();
                    ChangeStatus_mst Objchangestatus = new ChangeStatus_mst();
                    Objcurrentchange = Objcurrentchange.Get_By_id(changeid);
                    Objchangestatus = Objchangestatus.Get_By_id(Objcurrentchange.Statusid);
                    string status = Objchangestatus.Statusname.ToString();

                    int result1 = String.Compare(status, StrStatusCompleted, true);
                    if (result1 == 0)
                    {
                        ObjChange.Completedtime = Objcurrentchange.Completedtime;
                        ObjChange.Update();

                    }
                    else
                    {
                        ObjChange.Completedtime = DateTime.Now.ToString();
                        ObjChange.Update();

                    }
                }

                else
                {
                    string myScript;
                    //myScript = "<script language=javascript>javascript:alert('Please Close All the Attached Incident');</script>";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Javascript:alert('Please Close Alll the attached incident');", "Javascript:alert('Please Close Alll the attached incident');", true);
                    ///'''Page.RegisterClientScriptBlock("MyScript", myScript);
                }

            }
            else
            {

            #endregion

                ObjChange.Update();

            }

            #endregion
            //   #region Update Include Assets in Change value in IncludedAssetinchange

            //objincludeasset.Delete(changeid);
            //for (int i = lstassetupdate.Items.Count - 1; i >= 0; i--)
            //{
            //    if (lstassetupdate.Items[i].Selected == true)
            //    {
            //        objincludeasset.Assetid = Convert.ToInt32(lstassetupdate.Items[i].Value);
            //        objincludeasset.Changeid = changeid;
            //        objincludeasset.Insert();

            //    }
            //}

            //#endregion
            Showchangeinfo();
            btnUpdate.Visible = false;
            btnCancel.Visible = false;
        }
Beispiel #6
0
    protected void grdvwProblem_RowDataBound(Object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            #region Bind Data Row at Run time with requesterid to Requester name
            int requesterid = Convert.ToInt16(e.Row.Cells[3].Text);
            objUser = objUser.Get_By_id(requesterid);

            if (objUser.Userid != 0)
            {
                e.Row.Cells[3].Text = objUser.Username.ToString();
            }
            else
            {
                e.Row.Cells[3].Text = "";
            }
            #endregion

            #region Bind Datarow at Run Time with Createdbyid to Created by name
            int createdbyid = Convert.ToInt16(e.Row.Cells[4].Text);
            objUser = objUser.Get_By_id(createdbyid);
            if (objUser.Userid != 0)
            {
                e.Row.Cells[4].Text = objUser.Username.ToString();
            }
            else
            {
                e.Row.Cells[4].Text = "";
            }
            #endregion

            #region Bind Datarow at Run Time with technicianid to technician name
            int technicianid = Convert.ToInt16(e.Row.Cells[5].Text);
            objUser = objUser.Get_By_id(technicianid);
            if (objUser.Userid != 0)
            {
                e.Row.Cells[5].Text = objUser.Username.ToString();
            }
            else
            {
                e.Row.Cells[5].Text = "";
            }
            #endregion

            #region Bind Datarow at run time with Statusid to Status
            int statusid = Convert.ToInt16(e.Row.Cells[6].Text);
            objStatus = objStatus.Get_By_id(statusid);
            if (objStatus.Statusid != 0)
            {
                e.Row.Cells[6].Text = objStatus.Statusname.ToString();
            }
            else
            {
                e.Row.Cells[6].Text = "";
            }
            #endregion

            #region Bind Datarow at run time with Priorityid to Priority
            int priorityid = Convert.ToInt16(e.Row.Cells[7].Text);
            objPriority = objPriority.Get_By_id(priorityid);
            if (objPriority.Priorityid != 0)
            {
                e.Row.Cells[7].Text = objPriority.Name.ToString();
            }
            else
            {
                e.Row.Cells[7].Text = "";
            }
            #endregion


            #region Bind Datarow at run time with CategoryId to Category
            int categoryid = Convert.ToInt16(e.Row.Cells[8].Text);
            objCategory = objCategory.Get_By_id(categoryid);
            if (objCategory.Categoryid != 0)
            {
                e.Row.Cells[8].Text = objCategory.CategoryName.ToString();
            }
            else
            {
                e.Row.Cells[8].Text = "";
            }
            #endregion
        }
    }
Beispiel #7
0
    protected void Page_Load(object sender, EventArgs e)
    {//Add Exception handilng try catch change by vishal 21-05-2012
        try
        {
            string strStatusClose = Resources.MessageResource.strStatusClose.ToString().Trim();
            string statusString   = "";
            int    problemid      = Convert.ToInt32(Request.QueryString[0]);
            ObjProbelm   = ObjProbelm.Get_By_id(problemid);
            objrootcause = objrootcause.Get_By_id(problemid);
            objimpact    = objimpact.Get_By_id(problemid);
            objstatus    = objstatus.Get_By_id(ObjProbelm.Statusid);
            statusString = objstatus.Statusname.ToString();
            if (statusString.ToLower() == strStatusClose.ToLower())
            {
                string ii        = objimpact.Description.ToString();
                string stripped4 = Regex.Replace(ii, @"<(.|\n)*?>", string.Empty);
                lblserviceeffected.Text = objimpact.Description.ToString();
                string rr        = objrootcause.Description.ToString();
                string stripped1 = Regex.Replace(rr, @"<(.|\n)*?>", string.Empty);
                lblcause.Text      = stripped1.ToString();
                objproblemsysmptom = objproblemsysmptom.Get_By_id(problemid);
                string ss        = objproblemsysmptom.Description.ToString();
                string stripped3 = Regex.Replace(ss, @"<(.|\n)*?>", string.Empty);
                lblsymptom.Text    = stripped3.ToString();
                lbltcktno.Text     = ObjProbelm.ProblemId.ToString();
                lblcreatedate.Text = ObjProbelm.CreateDatetime.ToString();
                if (ObjProbelm.AssginedTime != null)
                {
                    lblstarttime.Text = ObjProbelm.AssginedTime.ToString();
                }
                lblendtime.Text = ObjProbelm.Closedatetime.ToString();
                Objcategory     = Objcategory.Get_By_id(ObjProbelm.Categoryid);

                lblcomponenteffected.Text = Objcategory.CategoryName.ToString();
                lbldescription.Text       = ObjProbelm.title.ToString();
                objproblemtosolution      = objproblemtosolution.Get_By_id(ObjProbelm.ProblemId);
                Objsolution = Objsolution.Get_By_id(objproblemtosolution.Solutionid);
                string bb       = Objsolution.Solution.ToString();
                string stripped = Regex.Replace(bb, @"<(.|\n)*?>", string.Empty);
                lblresolution.Text = stripped.ToString();
                //bind data to data bound controls and do other stuff
                objUser           = objUser.Get_By_id(ObjProbelm.Requesterid);
                lblcustomer.Text  = objUser.Username.ToString();
                objUser           = objUser.Get_By_id(ObjProbelm.Technicianid);
                lblengineer.Text  = objUser.Username.ToString();
                lblrcaresult.Text = "Completed";
            }
            Response.Clear();       //this clears the Response of any headers or previous output
            Response.Buffer = true; //make sure that the entire output is rendered simultaneously

            ///
            ///Set content type to MS Excel sheet
            ///Use "application/msword" for MS Word doc files
            ///"application/pdf" for PDF files
            ///

            Response.ContentType = "application/vnd.ms-excel";
            StringWriter stringWriter = new StringWriter(); //System.IO namespace should be used

            HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter);

            ///
            ///Render the entire Page control in the HtmlTextWriter object
            ///We can render individual controls also, like a DataGrid to be
            ///exported in custom format (excel, word etc)
            ///
            this.RenderControl(htmlTextWriter);
            Response.Write(stringWriter.ToString());
            Response.End();
        }
        catch (Exception ex)
        {
            string myScript;
            myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>";
            Page.RegisterClientScriptBlock("MyScript", myScript);
            return;
        }
    }
    protected void grdvwProblem_RowDataBound(Object sender, GridViewRowEventArgs e)
    {
        //System.Drawing.ColorConverter colConvert = new ColorConverter();
        //BLLCollection<ColorScheme_mst> colColor = new BLLCollection<ColorScheme_mst>();

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            #region Autogenerate Serial number
            //Label lblSerial = (Label)e.Row.FindControl("lblSerial");
            //lblSerial.Text = i.ToString();
            //i++;
            #endregion

            int TotalTimeSpentonCall;
            int TotalResolutionTime;



            string varStatusOpen     = Resources.MessageResource.strStatusOpen.ToString();
            string varStatusClose    = Resources.MessageResource.strStatusClose.ToString();
            string varStatusOnHold   = Resources.MessageResource.strStatusOnHold.ToString();
            string varStatusResolved = Resources.MessageResource.strStatusResolved.ToString();

            #region Bind Data Row at Run time with requesterid to Requester name
            int requesterid = Convert.ToInt32(e.Row.Cells[2].Text);
            objUser = objUser.Get_By_id(requesterid);

            if (objUser.Userid != 0)
            {
                e.Row.Cells[2].Text = objUser.Username.ToString();
            }
            else
            {
                e.Row.Cells[2].Text = "";
            }
            #endregion

            #region Bind Datarow at Run Time with Createdbyid to Created by name
            int createdbyid = Convert.ToInt32(e.Row.Cells[3].Text);
            objUser = objUser.Get_By_id(createdbyid);
            if (objUser.Userid != 0)
            {
                e.Row.Cells[3].Text = objUser.Username.ToString();
            }
            else
            {
                e.Row.Cells[3].Text = "";
            }
            #endregion

            #region Bind Datarow at Run Time with technicianid to technician name
            int technicianid = Convert.ToInt32(e.Row.Cells[4].Text);
            objUser = objUser.Get_By_id(technicianid);
            if (objUser.Userid != 0)
            {
                e.Row.Cells[4].Text = objUser.Username.ToString();
            }
            else
            {
                e.Row.Cells[4].Text = "";
            }
            #endregion

            #region Bind Datarow at run time with Statusid to Status
            int statusid = Convert.ToInt32(e.Row.Cells[5].Text);
            objStatus = objStatus.Get_By_id(statusid);
            if (objStatus.Statusid != 0)
            {
                e.Row.Cells[5].Text = objStatus.Statusname.ToString();
            }
            else
            {
                e.Row.Cells[5].Text = "";
            }
            #endregion

            #region Bind Datarow at run time with Priorityid to Priority
            int priorityid = Convert.ToInt32(e.Row.Cells[6].Text);
            objPriority = objPriority.Get_By_id(priorityid);
            if (objPriority.Priorityid != 0)
            {
                e.Row.Cells[6].Text = objPriority.Name.ToString();
            }
            else
            {
                e.Row.Cells[6].Text = "";
            }
            #endregion
        }
    }