protected void Page_Load(object sender, EventArgs e)
        {
            complaintApp = new ComplaintApplication();

            var master = (Pop)this.Master;

            if (master != null)
            {
                master.Width = 580;
            }

            if (!IsPostBack)
            {
                int complaintID = QS("ComplaintID", 0);
                ltlComplaintID.Text = complaintID.ToString();

                IComplaintRepository comRepository = ObjectFactory.GetInstance <IComplaintRepository>();
                cmplEntity = comRepository.Get(complaintID);

                GetComplaintItem();

                IComplaintHistoryRepository   comHisRepository = ObjectFactory.GetInstance <IComplaintHistoryRepository>();
                List <ComplaintHistoryEntity> list             = comHisRepository.GetHistorysByComID(complaintID);

                if (null != list && list.Count > 0)
                {
                    this.rptComplaintHistoryList.DataSource = list;
                }
                else
                {
                    this.trNoComments.Visible = true;
                    this.rptComplaintHistoryList.DataSource = new List <ComplaintHistoryEntity>();
                }

                this.rptComplaintHistoryList.DataBind();
            }
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // Get value from QueryStrings
                txtKeyword.Text   = QS("Keyword");
                txtUpdatedBy.Text = QS("UpdatedBy");

                if (QS("Type") != "" && QS("Type") != "-1")
                {
                    ddlType.SelectedValue = QS("Type");
                }
                if (QS("Status") != "" && QS("Status") != "-1")
                {
                    ddlStatus.SelectedValue = QS("Status");
                }
                if (QS("Reason") != "" && QS("Reason") != "-1")
                {
                    ddlReason.SelectedValue = QS("Reason");
                }
                if (QS("SystemID") != "" && QS("SystemID") != "-1")
                {
                    ddlSystemID.SelectedValue = QS("SystemID");
                }
                if (QS("AppSrc") != "" && QS("AppSrc") != "-1")
                {
                    ddlAppSrc.SelectedValue = QS("AppSrc");
                }

                // Bind dropdownlists
                List <ListItem> lst = ComplaintTypeHelper.AllComplaintType.Select(x => new ListItem()
                {
                    Text = x.ToText(), Value = ((int)x).ToString()
                }).ToList();
                lst.BindDropdown <ListItem>(ddlType, "Text", "Value", "ALL", "-1");

                lst = ComplaintReasonHelper.AllReason.Select(x => new ListItem()
                {
                    Text = x.ToText(), Value = ((int)x).ToString()
                }).ToList();
                lst.BindDropdown <ListItem>(ddlReason, "Text", "Value", "ALL", "-1");

                ISystemRepository   systemRepository = ObjectFactory.GetInstance <ISystemRepository>();
                List <SystemEntity> sysList          = systemRepository.GetAllSystems();
                sysList.BindDropdown(ddlSystemID, "SystemName", "SystemID", "ALL", "-1");

                lst = ComplaintAppSrcHelper.AllAppSrc.Select(x => new ListItem()
                {
                    Text = x.ToText(), Value = ((int)x).ToString()
                }).ToList();
                lst.BindDropdown <ListItem>(ddlAppSrc, "Text", "Value", "ALL", "-1");

                lst = ComplaintStatusHelper.AllStatus.Select(x => new ListItem()
                {
                    Text = x.ToText(), Value = ((int)x).ToString()
                }).ToList();
                lst.BindDropdown <ListItem>(ddlStatus, "Text", "Value", "ALL", "-1");

                // Search db to display the table
                ComplaintSearchEntity request = new ComplaintSearchEntity(true, OrderBy, OrderDirection);
                request.Type          = int.Parse(ddlType.SelectedValue);
                request.Reason        = int.Parse(ddlReason.SelectedValue);
                request.SystemID      = int.Parse(ddlSystemID.SelectedValue);
                request.AppSrc        = int.Parse(ddlAppSrc.SelectedValue);
                request.Status        = int.Parse(ddlStatus.SelectedValue);
                request.Keyword       = txtKeyword.Text.NoHTML();
                request.UpdatedByName = txtUpdatedBy.Text.NoHTML();

                request.CurrentPage = CurrentPageIndex;
                request.PageCount   = ComplaintsPage.PageSize;

                ComplaintApplication complaintApp = new ComplaintApplication();
                int recordCount;
                List <ComplaintEntity> comEntityLst = complaintApp.SearchComplaints(request, out recordCount);
                rptUsers.DataSource = comEntityLst;
                rptUsers.DataBind();

                ComplaintsPage.RecordCount = recordCount;
            }
        }
示例#3
0
        public int Report(int type, int targetID, int reason, string additionalInfo, int systemID,
                          int appSource, int reporterID, string reporterEmail, long timeStamp, string sign)
        {
            try
            {
                ISystemRepository systemRepository = ObjectFactory.GetInstance <ISystemRepository>();
                SystemEntity      systemEntity     = systemRepository.Get(systemID);
                string            md5Key           = systemEntity.MD5Key; // "MFBUY#!982015"

                if (additionalInfo == null)
                {
                    additionalInfo = "";
                }
                if (reporterEmail == null)
                {
                    reporterEmail = "";
                }

                string seed = "" + type + targetID + reason + additionalInfo + systemID + appSource + reporterID + reporterEmail + timeStamp;

                string localSign = UtilFactory.GetEncryptProvider(EncryptType.MD5).Encrypt(seed + md5Key);

                localSign = localSign.Replace("-", "");

                //Log seed and Local Sign
                WebLogAgent.Write(string.Format("[Complaint Seed: {0},\r\nLocalSign: {1}\r\nSign:{2}]",
                                                seed,
                                                localSign,
                                                sign));

                if (localSign == sign.ToUpper())
                {
                    //Insert to dababas
                    ComplaintEntity complaintEntity = new ComplaintEntity();
                    complaintEntity.Type           = type;
                    complaintEntity.TargetID       = targetID;
                    complaintEntity.Reason         = reason;
                    complaintEntity.AdditionalInfo = additionalInfo;
                    complaintEntity.SystemID       = systemID;
                    complaintEntity.AppSrc         = appSource;
                    complaintEntity.ReporterID     = reporterID;
                    complaintEntity.ReporterEmail  = reporterEmail;

                    RealSystemDateTime time = new RealSystemDateTime();
                    complaintEntity.CreatedOn = time.Now;

                    complaintEntity.Status = 1;

                    ComplaintApplication complaintApp = new ComplaintApplication();
                    int newComID = complaintApp.AddComplaint(complaintEntity);

                    try
                    {
                        //Send email
                        IEmailSender sender       = ObjectFactory.GetInstance <IEmailSender>();
                        string       emailTitle   = string.Format("Complaint Received from {0} ", systemEntity.SystemName);
                        string       emailContent = "Please check this URL: \r\n " + Config.AppDomain + "/OA/Complaints/ComplaintReview.aspx?ComplaintID=" + newComID + "\r\n\r\n";
                        sender.SendMail(Config.ComplainNotifyList, Config.DefaultSendEmail, emailTitle, emailContent);
                    }
                    catch (Exception ex)
                    {
                        WebLogAgent.Write(string.Format("[Email Sending Exception]: {0}", ex.Message));
                    }
                    return(1); //Accepted, Successed
                }

                return(2); //Invalid
            }
            catch (Exception ex)
            {
                //log this excption
                WebLogAgent.Write(string.Format("[Exception]: {0}", ex.Message));

                return(3);//System Error
            }
        }