示例#1
0
        public void DownLoadAsExcel(System.Data.DataTable myList, Homa homa)
        {
            string   fileName = homa.CongressTitle + "UserList.xls";
            DataGrid dg       = new DataGrid();

            dg.AllowPaging = false;
            dg.DataSource  = myList;
            dg.DataBind();
            Response.Clear();
            Response.Buffer = true;

            Response.ContentEncoding = System.Text.Encoding.Unicode;
            Response.BinaryWrite(System.Text.Encoding.Unicode.GetPreamble());
            Response.Charset = "";
            Response.AddHeader("Content-Disposition",
                               "attachment; filename=" + fileName);
            Response.ContentType =
                "application/vnd.ms-excel";
            System.IO.StringWriter       stringWriter   = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter htmlTextWriter =
                new System.Web.UI.HtmlTextWriter(stringWriter);
            dg.RenderControl(htmlTextWriter);
            Response.Write(stringWriter.ToString());
            Response.End();
        }
示例#2
0
 public static string GetAtricleTitle(Homa homa)
 {
     if (homa != null)
     {
         return(homa.Configuration.ArticleTitle);
     }
     return(string.Empty);
 }
示例#3
0
        public List <ModelView.UserCardModel> GetCardList(IConnectionHandler connectionHandler, User user, ConfigurationContent configcontent,
                                                          Homa homa, List <BoothOfficer> boothOfficers)
        {
            var list       = new List <ModelView.UserCardModel>();
            var fileFacade = FileManagerComponent.Instance.FileFacade;


            foreach (var boothOfficer in boothOfficers)
            {
                var booth = boothOfficer.Booth;
                if (booth == null)
                {
                    continue;
                }
                var userKartModel = new ModelView.UserCardModel();
                if (configcontent != null && configcontent.LogoId.HasValue && configcontent.Logo != null)
                {
                    userKartModel.CongressLogo = configcontent.Logo.Content;
                }
                var enterpriseNode = boothOfficer.EnterpriseNode;
                if (enterpriseNode != null)
                {
                    if (enterpriseNode.PictureId.HasValue)
                    {
                        var file = fileFacade.Get(enterpriseNode.PictureId);
                        if (file != null)
                        {
                            userKartModel.UserImage = file.Content;
                        }
                    }

                    var realEnterpriseNode = enterpriseNode.RealEnterpriseNode;
                    if (realEnterpriseNode != null)
                    {
                        userKartModel.FirstName    = realEnterpriseNode.FirstName;
                        userKartModel.LastName     = realEnterpriseNode.LastName;
                        userKartModel.NationalCode = realEnterpriseNode.NationalCode;
                    }
                }
                userKartModel.Id            = user.Id.ToString();
                userKartModel.CongressTitle = homa.CongressTitle;
                userKartModel.UseName       = enterpriseNode.Title();
                userKartModel.Type          = string.Format(Resources.Congress.BoothOfficerCard, booth.Code);
                userKartModel.CardType      = Enums.CardType.BoothOfficerCard;
                userKartModel.CardId        = Enums.CardType.BoothOfficerCard + "-" + user.Id;
                list.Add(userKartModel);
            }
            return(list);
        }
示例#4
0
        public ActionResult Create(FormCollection collection)
        {
            var homa = new Homa()
            {
                Owner = new Radyn.EnterpriseNode.DataStructure.EnterpriseNode()
            };

            try
            {
                this.RadynTryUpdateModel(homa);
                this.RadynTryUpdateModel(homa.Owner);
                HttpPostedFileBase file = null;
                if (Session["Image"] != null)
                {
                    file = (HttpPostedFileBase)Session["Image"];
                    Session.Remove("Image");
                }
                switch (homa.Owner.EnterpriseNodeTypeId)
                {
                case 1:
                    homa.Owner.RealEnterpriseNode = new RealEnterpriseNode();
                    this.RadynTryUpdateModel(homa.Owner.RealEnterpriseNode);
                    break;

                case 2:
                    homa.Owner.LegalEnterpriseNode = new LegalEnterpriseNode();
                    this.RadynTryUpdateModel(homa.Owner.LegalEnterpriseNode);
                    break;
                }
                var list = (List <HomaAlias>)Session["AliasList"];
                homa.CurrentUICultureName = collection["LanguageId"];
                if (CongressComponent.Instance.BaseInfoComponents.HomaFacade.Insert(homa, file, list))
                {
                    Session.Remove("AliasList");
                    ShowMessage(Resources.Common.InsertSuccessMessage, Resources.Common.MessaageTitle, messageIcon: MessageIcon.Succeed);
                    return(Redirect("~/Congress/Homa/Edit?Id=" + homa.Id));
                }
                ShowMessage(Resources.Common.ErrorInInsert, Resources.Common.MessaageTitle,
                            messageIcon: MessageIcon.Error);
                return(Redirect("~/Congress/Homa/Index"));
            }
            catch (Exception exception)
            {
                ShowExceptionMessage(exception);

                return(View(homa));
            }
        }
示例#5
0
        public static List <string> GetCongressYear(this Homa homa)
        {
            var list = new List <string>();

            if (homa == null || string.IsNullOrEmpty(homa.StartDate) || string.IsNullOrEmpty(homa.EndDate))
            {
                return(list);
            }
            var shamsiDateToGregorianDate = homa.StartDate.Substring(0, 4).ToInt();
            var gregorianDate             = homa.EndDate.Substring(0, 4).ToInt();

            for (int i = shamsiDateToGregorianDate; i <= gregorianDate; i++)
            {
                list.Add(i.ToString());
            }
            return(list);
        }
示例#6
0
 public List <Tools.ModelView.ArticleCertificateModel> GetArticleCertificate(Homa homa, Guid id,
                                                                             bool isadmin)
 {
     try
     {
         return(new ArticleBO().GetArticleCertificate(ConnectionHandler, id, homa, isadmin));
     }
     catch (KnownException ex)
     {
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
     catch (Exception ex)
     {
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
 }
示例#7
0
        public List <Tools.ModelView.ArticleCertificateModel> GetAllArticleCertificate(Homa homa, Article article,
                                                                                       string serachvalue, FormStructure formStructure, Enums.AscendingDescending ascendingDescending, Enums.SortAccordingToArticle articleflow)
        {
            try
            {
                List <ModelView.ArticleCertificateModel> list = new List <Tools.ModelView.ArticleCertificateModel>();

                ArticleBO      articleBo = new ArticleBO();
                List <Article> search    = articleBo.Search(ConnectionHandler, homa.Id, article, serachvalue, ascendingDescending, articleflow, formStructure);
                foreach (Article item in search)
                {
                    list.AddRange(articleBo.GetArticleCertificate(ConnectionHandler, item.Id, homa, true));
                }
                return(list);
            }
            catch (KnownException ex)
            {
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            catch (Exception ex)
            {
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
        }
示例#8
0
        public static string GetHomaArticleRefereePanelUrl(this Homa homa, Guid articleId, Guid RefereeId)
        {
            string urlPanel = !string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Url.Authority) ? "Http://" + System.Web.HttpContext.Current.Request.Url.Authority + $"/Congress/RefereePanel/RefereeCartabl?refreeId={RefereeId}&articleId={articleId}"  : "";

            return("<a href=\"" + urlPanel + "\">" + urlPanel + "</a>");
        }
示例#9
0
        public static string GetHomaRefereePanelUrl(this Homa homa)
        {
            string urlPanel = !string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Url.Authority) ? "Http://" + System.Web.HttpContext.Current.Request.Url.Authority + "/Congress/RefereePanel/Login?hid=" + homa.Id : "";

            return("<a href=\"" + urlPanel + "\">" + urlPanel + "</a>");
        }
示例#10
0
 public static string GetHomaCompleteUrl(this Homa homa)
 {
     return(System.Web.HttpContext.Current != null ? (!string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Url.Authority) ? "Http://" + System.Web.HttpContext.Current.Request.Url.Authority : "") : "");
 }