protected void Page_Load(object sender, EventArgs e)
        {
            Master.ChildPageTitle = "Tickets Managament";

            if (!IsPostBack)
            {
                LoadDDl();
                if (TicketID == 0)
                {
                    Response.Redirect("~/capa/managetickets.aspx");
                }
                else
                {
                    Pricing.BLL.Tickets ticket = new Pricing.BLL.Tickets();
                    ticket.LoadByPrimaryKey(TicketID);

                    if (ticket.RowCount == 0)
                        Response.Redirect("~/capa/managetickets.aspx");

                    uiLabelRequestText.Text = ticket.TextRequest;
                    if (!string.IsNullOrEmpty(ticket.TradeName))
                        uiLabelDrugName.Text = ticket.TradeName;
                    else
                    {
                        Pricing.BLL.TradePricing drug = new Pricing.BLL.TradePricing();
                        drug.LoadByPrimaryKey(ticket.TradePricingID);
                        uiLabelDrugName.Text = drug.TradeName;
                    }

                    if (!ticket.IsColumnNull("FileAttachement"))
                    {
                        if (!string.IsNullOrEmpty("FileAttachement"))
                        {
                            uiLiteralAttach.Text = "<a href='" + ticket.FileAttachement + "' class='btn btn-primary'>Check attachment</a>";
                            uiLiteralAttach.Visible = true;
                        }
                        else
                            uiLiteralAttach.Visible = false;
                    }
                    else
                    {
                        uiLiteralAttach.Visible = false;
                    }

                    if (ticket.TicketStatusID == 4)
                    {
                        uiPanelResponse.Visible = false;
                    }
                    else
                    {
                        uiPanelResponse.Visible = true;
                    }
                    BindHistory();
                }
            }
            lblCloseTicketValidation.Text = "";
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadDDl();
                if (TicketID == 0)
                {
                    Response.Redirect("~/tickets.aspx");
                }
                else
                {
                    Pricing.BLL.Tickets ticket = new Pricing.BLL.Tickets();
                    ticket.LoadByPrimaryKey(TicketID);

                    if(ticket.RowCount == 0)
                        Response.Redirect("~/tickets.aspx");

                    uiLabelRequestText.Text = ticket.TextRequest;
                    if (!string.IsNullOrEmpty(ticket.TradeName))
                        uiLabelDrugName.Text = ticket.TradeName;
                    else
                    {
                        Pricing.BLL.TradePricing drug = new Pricing.BLL.TradePricing();
                        drug.LoadByPrimaryKey(ticket.TradePricingID);
                        uiLabelDrugName.Text = drug.TradeName;
                    }
                    if (ticket.TicketStatusID == 4)
                    {
                        uiPanelResponse.Visible = true;
                    }
                    else
                    {
                        uiPanelResponse.Visible = false;
                    }
                    BindHistory();
                }
            }
        }
Esempio n. 3
0
        protected void uiLinkButtonReply_Click(object sender, EventArgs e)
        {
            Pricing.BLL.Tickets ticket = new Pricing.BLL.Tickets();
            ticket.LoadByPrimaryKey(TicketID);

            TicketHistory history = new TicketHistory();
            history.AddNew();
            history.TicketID = TicketID;
            history.ResponseDate = DateTime.Now;
            history.ResponseText = uiTextBoxResponse.Text;
            if (ticket.TicketStatusID == 4) // need more info
                history.TicketStatusID = 5; // need more info / complete
            //history.TicketStatusID = Convert.ToInt32(uiDropDownListStatus.SelectedValue);

            string filepath = "";
            if (uiFileUploadAttach.HasFile)
            {

                filepath = "/Attachments/TicketHistory/" + DateTime.Now.ToString("ddMMyyyyhhmmss_") + uiFileUploadAttach.FileName;
                uiFileUploadAttach.SaveAs(Server.MapPath("~" + filepath));
                history.FileAttachement = filepath;
            }
            history.Save();

            if (ticket.TicketStatusID == 4) // need more info
                ticket.TicketStatusID = 5;  // need more info / complete
            //ticket.TicketStatusID = Convert.ToInt32(uiDropDownListStatus.SelectedValue);
            ticket.Save();

            if (ticket.TicketStatusID == 4)
            {
                uiPanelResponse.Visible = true;
            }
            else
            {
                uiPanelResponse.Visible = false;
            }

            uiTextBoxResponse.Text = "";
            uiDropDownListStatus.SelectedIndex = 0;

            BindHistory();
        }
        private void LoadDDl()
        {
            Pricing.BLL.TicketStatus status = new Pricing.BLL.TicketStatus();
            status.LoadAll();
            uiDropDownListStatus.DataSource = status.DefaultView;
            uiDropDownListStatus.DataTextField = Pricing.BLL.TicketStatus.ColumnNames.Name;
            uiDropDownListStatus.DataValueField = Pricing.BLL.TicketStatus.ColumnNames.TicketStatusID;
            uiDropDownListStatus.DataBind();

            // Remove from the status list - the last status for the current ticket - to prevent status duplication .
            Pricing.BLL.Tickets obj = new Pricing.BLL.Tickets();
            obj.LoadByPrimaryKey(TicketID);

            ListItem item = uiDropDownListStatus.Items.FindByValue(obj.TicketStatusID.ToString());
            uiDropDownListStatus.Items.Remove(item);
        }
        protected void uiLinkButtonReply_Click(object sender, EventArgs e)
        {
            if (uiDropDownListStatus.SelectedItem.Text == "Closed" && uiTextBoxResponse.Text=="")
            {
                lblCloseTicketValidation.Text = "You must write a comment before close the ticket !";
                return;
            }

            // Admin only can change the status if it was closed
            Pricing.BLL.Tickets objTicket = new Pricing.BLL.Tickets();
            objTicket.LoadByPrimaryKey(TicketID);
            if (CodeGlobal.LogedInUser.s_Privaledge != "admin" && objTicket.TicketStatusID == 2)
            {
                lblCloseTicketValidation.Text = "System Admin only who can change the status now !";
                return;
            }

            TicketHistory history = new TicketHistory();
            history.AddNew();
            history.TicketID = TicketID;
            history.ResponseDate = DateTime.Now;
            history.ResponseText = uiTextBoxResponse.Text;
            history.TicketStatusID = Convert.ToInt32(uiDropDownListStatus.SelectedValue);
            string filepath = "";
            if (uiFileUploadAttach.HasFile)
            {

                filepath = "/Attachments/TicketHistory/" + DateTime.Now.ToString("ddMMyyyyhhmmss_") + uiFileUploadAttach.FileName;
                uiFileUploadAttach.SaveAs(Server.MapPath("~" + filepath));
                history.FileAttachement = filepath;
            }
            history.Save();

            Pricing.BLL.Tickets ticket = new Pricing.BLL.Tickets();
            ticket.LoadByPrimaryKey(TicketID);
            ticket.TicketStatusID = Convert.ToInt32(uiDropDownListStatus.SelectedValue);
            ticket.Save();

            if (ticket.TicketStatusID == 4)
            {
                uiPanelResponse.Visible = false;
            }
            else
            {
                uiPanelResponse.Visible = true;
            }

            uiTextBoxResponse.Text = "";
            uiDropDownListStatus.SelectedIndex = 0;

            BindHistory();
            LoadDDl();
        }
Esempio n. 6
0
 private void BindTickets()
 {
     Pricing.BLL.Tickets companyTickets = new Pricing.BLL.Tickets();
     companyTickets.GetAllTicketsByCompanyID(CodeGlobal.LogedInCompany.CompanyID);
     uiGridViewTickets.DataSource = companyTickets.DefaultView;
     uiGridViewTickets.DataBind();
 }
Esempio n. 7
0
        protected void uiLinkButtonAddTicket_Click(object sender, EventArgs e)
        {
            // condition added to solve refresh postback action
            if (Session["RefreshHit_tic"].ToString() == ViewState["RefreshHit_tic"].ToString())
            {
                Pricing.BLL.Tickets companyTickets = new Pricing.BLL.Tickets();
                companyTickets.AddNew();
                companyTickets.CompanyID = CodeGlobal.LogedInCompany.CompanyID;
                companyTickets.TicketTypeID = Convert.ToInt32(uiDropDownListType.SelectedValue);
                companyTickets.TicketStatusID = 1; // open
                if (uiDropDownListDrugs.SelectedValue != "0")
                {
                    companyTickets.TradePricingID = Convert.ToInt32(uiDropDownListDrugs.SelectedValue);
                }
                else
                {
                    companyTickets.TradeName = uiTextBoxTradeName.Text;

                }

                companyTickets.TextRequest = uiTextBoxRequestText.Text;
                DirectoryInfo dir = new DirectoryInfo(Server.MapPath("~/Attachments/Tickets"));
                if (!dir.Exists)
                    dir.Create();
                string filepath = "";
                if (uiFileUploadAttach.HasFile)
                {

                    filepath = "/Attachments/Tickets/" + DateTime.Now.ToString("ddMMyyyyhhmmss_") + uiFileUploadAttach.FileName;
                    uiFileUploadAttach.SaveAs(Server.MapPath("~" + filepath));
                    companyTickets.FileAttachement = filepath;
                }
                companyTickets.InitiateDate = DateTime.Now;
                switch (uiDropDownListType.SelectedValue)
                {
                    case "1":
                        if (!string.IsNullOrEmpty(uiTextBoxCommittedDate.Text))
                        {
                            DateTime d;
                            DateTime.TryParseExact(uiTextBoxCommittedDate.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d);
                            if (d != null && d != DateTime.MinValue)
                            {
                                companyTickets.LastCommitteeDate = d;
                            }
                        }
                        companyTickets.LastDescision = uiTextBoxCommittedDecision.Text;
                        double price = 0;
                        double.TryParse(uiTextBoxCommittedPrice.Text, out price);
                        companyTickets.CurrentPrice = price;
                        break;
                    case "2":
                    case "3":
                        double currentprice = 0;
                        double.TryParse(uiTextBoxCurrentPrice.Text, out currentprice);
                        companyTickets.CurrentPrice = currentprice;

                        double suggestprice = 0;
                        double.TryParse(uiTextBoxSuggestedPrice.Text, out suggestprice);
                        companyTickets.CurrentPrice = suggestprice;
                        break;
                    default:
                        break;
                }
                companyTickets.Save();
                //solve refresh postback action
                Session["RefreshHit_tic"] = Server.UrlEncode(System.DateTime.Now.ToString());
            }
            BindTickets();
        }