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();
        }
        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();
        }
示例#3
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();
        }