Beispiel #1
0
        public bool WorkShopUserInsert(Guid congressId, WorkShopUser WorkShop, FormStructure formModel)
        {
            bool result   = false;
            var  entitiys = new ModelView.InFormEntitiyList <WorkShopUser>();

            try
            {
                this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                this.FormGeneratorConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                result = new WorkShopUserBO().WorkShopUserInsert(this.ConnectionHandler,
                                                                 this.FormGeneratorConnection, WorkShop, formModel);
                entitiys.Add(

                    WorkShop,
                    Resources.Congress.WorkShopInsertEmail,
                    Resources.Congress.WorkShopInsertSMS
                    );

                this.ConnectionHandler.CommitTransaction();
                this.FormGeneratorConnection.CommitTransaction();
            }
            catch (KnownException ex)
            {
                this.ConnectionHandler.RollBack();
                this.FormGeneratorConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            catch (Exception ex)
            {
                this.ConnectionHandler.RollBack();
                this.FormGeneratorConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            try
            {
                if (result)
                {
                    new WorkShopUserBO().InformWorkShopReserv(this.ConnectionHandler, congressId, entitiys);
                }
            }
            catch (Exception)
            {
            }
            return(result);
        }
Beispiel #2
0
 public FormStructure GenerateForm(FormStructure formStructure)
 {
     try
     {
         return(new GeneratorBO().GenerateForm(formStructure));
     }
     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);
     }
 }
 public List <FormData> GetGridDataSource(FormStructure form, string objactname, string refId, string gridId, string culture)
 {
     try
     {
         return(new FormDataBO().GetGridDataSource(ConnectionHandler, form, objactname, refId, gridId, culture));
     }
     catch (KnownException ex)
     {
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw;
     }
     catch (Exception ex)
     {
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
 }
 public FormData GetWithoutGridFormData(FormStructure form, string refId, string objname, string culture)
 {
     try
     {
         return(new FormDataBO().GetWithoutGridFormData(ConnectionHandler, form, refId, objname, culture));
     }
     catch (KnownException ex)
     {
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw;
     }
     catch (Exception ex)
     {
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
 }
Beispiel #5
0
        public void aBtn_DbClick(object sender, EventArgs e)
        {
            //ShowForm();
            ButtonEx sendButton = (ButtonEx)sender;

            this.click_NO = int.Parse(sendButton.Name);
            if (sendButton.Tag.ToString() != "1")
            {
                FormStep fs = new FormStep(this);
                fs.Show(this);
            }
            else if (sendButton.AccessibleDescription.ToString() == "结构检查")
            {
                FormStructure fs    = new FormStructure(this.click_NO);
                Panel         panel = this.splitContainer2.Panel2;
                ShowForm(panel, fs);
            }
            else if (sendButton.AccessibleDescription.ToString() == "数据排查")
            {
            }
            else if (sendButton.AccessibleDescription.ToString() == "变化提取")
            {
            }
            else if (sendButton.AccessibleDescription.ToString() == "自动计算")
            {
            }
            else if (sendButton.AccessibleDescription.ToString() == "属性检查")
            {
                FormAttr fad   = new FormAttr(this.click_NO, this.comboBoxScheme.Text.ToString());
                Panel    panel = this.splitContainer2.Panel2;
                ShowForm(panel, fad);
            }
            else if (sendButton.AccessibleDescription.ToString() == "图形检查")
            {
                FormTopo fad   = new FormTopo(this.click_NO, this.comboBoxScheme.Text.ToString());
                Panel    panel = this.splitContainer2.Panel2;
                ShowForm(panel, fad);
            }
            else if (sendButton.AccessibleDescription.ToString() == "统计报表")
            {
                FormReportConfig report = new FormReportConfig(this.click_NO, this.comboBoxScheme.Text.ToString());
                Panel            panel  = this.splitContainer2.Panel2;
                ShowForm(panel, report);
            }
        }
 public bool ModifyFormData(FormStructure formStructure)
 {
     try
     {
         this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
         this.FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted);
         var formDataBo = new FormDataBO();
         var frm        = formDataBo.GetFormData(this.ConnectionHandler, formStructure.Id, formStructure.RefId, formStructure.ObjectName);
         if (frm == null)
         {
             if (formStructure.Id == Guid.Empty)
             {
                 return(true);
             }
             if (!formDataBo.Insert(this.ConnectionHandler, this.FileManagerConnection, formStructure))
             {
                 return(false);
             }
         }
         else
         {
             if (!formDataBo.Update(this.ConnectionHandler, this.FileManagerConnection, formStructure, frm))
             {
                 return(false);
             }
         }
         this.ConnectionHandler.CommitTransaction();
         this.FileManagerConnection.CommitTransaction();
         return(true);
     }
     catch (KnownException ex)
     {
         this.ConnectionHandler.RollBack();
         this.FileManagerConnection.RollBack();
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
     catch (Exception ex)
     {
         this.ConnectionHandler.RollBack();
         this.FileManagerConnection.RollBack();
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
 }
        public bool UserBoothUpdate(Guid congressId, UserBooth userBooth,
                                    FormStructure formModel, List <BoothOfficer> boothOfficers)
        {
            ModelView.ModifyResult <UserBooth> modifyResult;
            try
            {
                this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                this.FormGeneratorConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                this.EnterpriseNodeConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                modifyResult = new UserBoothBO().UserBoothUpdate(this.ConnectionHandler,
                                                                 this.FormGeneratorConnection, this.EnterpriseNodeConnection, userBooth, formModel, boothOfficers);

                this.ConnectionHandler.CommitTransaction();
                this.FormGeneratorConnection.CommitTransaction();
                this.EnterpriseNodeConnection.CommitTransaction();
            }
            catch (KnownException ex)
            {
                this.ConnectionHandler.RollBack();
                this.FormGeneratorConnection.RollBack();
                this.EnterpriseNodeConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            catch (Exception ex)
            {
                this.ConnectionHandler.RollBack();
                this.FormGeneratorConnection.RollBack();
                this.EnterpriseNodeConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            try
            {
                if (modifyResult.SendInform)
                {
                    new UserBoothBO().InformUserboothReserv(ConnectionHandler, congressId, modifyResult.InformList);
                }
            }
            catch (Exception)
            {
            }
            return(modifyResult.Result);
        }
Beispiel #8
0
        public bool UserUpdate(Article article, List <ArticleAuthors> articleAuthorses,
                               HttpPostedFileBase abstractFileId,
                               HttpPostedFileBase orginalFileId, FormStructure formModel)
        {
            ArticleBO articleBo = new ArticleBO();

            try
            {
                ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                FormGeneratorConnection.StartTransaction(IsolationLevel.ReadUncommitted);

                if (
                    !articleBo.UserUpdate(ConnectionHandler, FileManagerConnection,
                                          FormGeneratorConnection, article, articleAuthorses, abstractFileId, orginalFileId,
                                          formModel))
                {
                    return(false);
                }

                ConnectionHandler.CommitTransaction();
                FileManagerConnection.CommitTransaction();
                FormGeneratorConnection.CommitTransaction();
                return(true);
            }
            catch (KnownException ex)
            {
                ConnectionHandler.RollBack();
                FileManagerConnection.RollBack();
                FormGeneratorConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            catch (Exception ex)
            {
                ConnectionHandler.RollBack();
                FileManagerConnection.RollBack();
                FormGeneratorConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
        }
Beispiel #9
0
 public IEnumerable <WorkShopUser> Search(Guid id, byte?status, string registerDate, string searchvalue,
                                          FormStructure formStructure)
 {
     try
     {
         var workShopUserBO = new WorkShopUserBO();
         var outlist        = workShopUserBO.Search(this.ConnectionHandler, id, status, registerDate, searchvalue, formStructure);
         return(outlist);
     }
     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);
     }
 }
Beispiel #10
0
        public IEnumerable <HotelUser> Search(Guid hotelId, byte?status, string registerDate, string searchvalue,
                                              FormStructure formStructure)
        {
            try
            {
                var hotelUserBo = new HotelUserBO();

                var list = hotelUserBo.Search(this.ConnectionHandler, hotelId, status, registerDate, searchvalue, formStructure);
                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);
            }
        }
Beispiel #11
0
        public bool Insert(Guid congressId, FormStructure formStructure)
        {
            try
            {
                this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                this.FormGeneratorConnection.StartTransaction(IsolationLevel.ReadUncommitted);

                formStructure.IsExternal = true;
                var formStructureTransactionalFacade =
                    FormGeneratorComponent.Instance.FormStructureTransactionalFacade(this.FormGeneratorConnection);
                if (!formStructureTransactionalFacade.Insert(formStructure))
                {
                    throw new Exception("خطایی در ذخیره فرم وجود دارد");
                }
                var congressContent = new CongressForms {
                    FomId = formStructure.Id, CongressId = congressId
                };
                if (!new CongressFormsBO().Insert(this.ConnectionHandler, congressContent))
                {
                    throw new Exception(Resources.Congress.ErrorInSaveCongressContainer);
                }
                this.ConnectionHandler.CommitTransaction();
                this.FormGeneratorConnection.CommitTransaction();
                return(true);
            }
            catch (KnownException ex)
            {
                this.ConnectionHandler.RollBack();
                this.FormGeneratorConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            catch (Exception ex)
            {
                this.ConnectionHandler.RollBack();
                this.FormGeneratorConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
        }
Beispiel #12
0
        public List <dynamic> SearchDynamic(Guid congressId, Article article, string serachvalue,
                                            FormStructure formStructure, Enums.AscendingDescending ascendingDescending, Enums.SortAccordingToArticle articleflow)
        {
            try
            {
                List <dynamic> searchArticleList = new ArticleBO().SearchDynamic(ConnectionHandler, congressId, article, serachvalue, ascendingDescending, articleflow);
                if (!searchArticleList.Any())
                {
                    return(searchArticleList);
                }

                List <Guid> @select = new List <Guid>();
                if (searchArticleList.Any())
                {
                    List <Guid> idlist = searchArticleList.Select(user1 => (Guid)user1.Id).ToList();
                    @select = new RefereeCartableBO().Select(ConnectionHandler, x => x.ArticleId,
                                                             x => x.ArticleId.In(idlist), true);
                }

                foreach (dynamic item in searchArticleList)
                {
                    item.HasRefereeOpinion     = @select.Any(x => x.Equals(item.Id));
                    item.HasRefereeAttachment  = item.HasRefereeOpinion;
                    item.AllowPrintCertificate = true;
                    item.Abstract           = item.Abstract == null ? "" : ((string)item.Abstract).RemoveHtml();
                    item.ArticleOrginalText = item.ArticleOrginalText == null ? "" : ((string)item.ArticleOrginalText).RemoveHtml();
                }
                return(searchArticleList);
            }
            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);
            }
        }
Beispiel #13
0
        public ActionResult Create(FormCollection collection)
        {
            var formStructure = new FormStructure();

            try
            {
                this.RadynTryUpdateModel(formStructure);
                if (FormGeneratorComponent.Instance.FormStructureFacade.Insert(formStructure))
                {
                    ShowMessage(Resources.Common.InsertSuccessMessage, Resources.Common.MessaageTitle, messageIcon: MessageIcon.Succeed);
                    return(RedirectToAction("Edit", new { Id = formStructure.Id }));
                }
                ShowMessage(Resources.Common.ErrorInInsert, Resources.Common.MessaageTitle, messageIcon: MessageIcon.Error);
                return(RedirectToAction("Index"));
            }
            catch (Exception exception)
            {
                ShowExceptionMessage(exception);
                TempData["Containers"] = new SelectList(ContentManagerComponent.Instance.ContainerFacade.SelectKeyValuePair(x => x.Id, x => x.Title, x => x.IsExternal), "Key", "Value");
                return(View(formStructure));
            }
        }
Beispiel #14
0
        public IEnumerable <Article> GetAllForZipFile(Guid congressId, Article article, string serachvalue,
                                                      FormStructure formStructure, Enums.AscendingDescending ascendingDescending, Enums.SortAccordingToArticle articleflow)
        {
            try
            {
                List <Article> search = new ArticleBO().Search(ConnectionHandler, congressId, article, serachvalue, ascendingDescending, articleflow, formStructure);
                if (!search.Any())
                {
                    return(null);
                }

                List <Guid> @select = new RefereeCartableBO().Select(ConnectionHandler, x => x.ArticleId,
                                                                     x => x.ArticleId.In(search.Select(i => i.Id)), true);
                foreach (Article item in search)
                {
                    if (!string.IsNullOrEmpty(item.Abstract))
                    {
                        item.Abstract = Regex.Replace(item.Abstract, "<.*?>", "");
                    }

                    item.HasRefereeOpinion     = @select.Any(x => x.Equals(item.Id));
                    item.HasRefereeAttachment  = item.HasRefereeOpinion;
                    item.AllowPrintCertificate = true;
                    item.Abstract           = item.Abstract == null ? "" : item.Abstract.RemoveHtml();
                    item.ArticleOrginalText = item.ArticleOrginalText == null ? "" : item.ArticleOrginalText.RemoveHtml();
                }
                return(search);
            }
            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);
            }
        }
Beispiel #15
0
        public bool Insert(Guid websiteId, FormStructure formStructure)
        {
            try
            {
                this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                this.FormGeneratorConnection.StartTransaction(IsolationLevel.ReadUncommitted);

                formStructure.IsExternal = true;
                var formStructureTransactionalFacade = FormGeneratorComponent.Instance.FormStructureTransactionalFacade(this.FormGeneratorConnection);
                if (!formStructureTransactionalFacade.Insert(formStructure))
                {
                    throw new Exception("خطایی در ذخیره فرم وجود دارد");
                }
                var congressContent = new Forms {
                    FormId = formStructure.Id, WebId = websiteId
                };
                if (!new FormsBO().Insert(this.ConnectionHandler, congressContent))
                {
                    throw new Exception("خطایی در ذخیره فرم وجود دارد");
                }
                this.ConnectionHandler.CommitTransaction();
                this.FormGeneratorConnection.CommitTransaction();
                return(true);
            }
            catch (KnownException knownException)
            {
                this.ConnectionHandler.RollBack();
                this.FormGeneratorConnection.RollBack();
                throw new KnownException(knownException.Message, knownException);
            }
            catch (Exception ex)
            {
                this.ConnectionHandler.RollBack();
                this.FormGeneratorConnection.RollBack();
                throw new KnownException(ex.Message, ex);
            }
        }
Beispiel #16
0
        public void DownLoadAsExcel(System.Data.DataTable myList, FormStructure homa)
        {
            string   fileName = homa.Name + "DataList.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();
        }
Beispiel #17
0
        public ActionResult Create(FormCollection collection)
        {
            var formStructure = new FormStructure();

            try
            {
                this.RadynTryUpdateModel(formStructure, collection);
                if (WebDesignComponent.Instance.FormsFacade.Insert(this.WebSite.Id, formStructure))
                {
                    ShowMessage(Resources.Common.InsertSuccessMessage, Resources.Common.MessaageTitle, messageIcon: MessageIcon.Succeed);
                    return(RedirectToAction("Edit", new { Id = formStructure.Id }));
                }
                ShowMessage(Resources.Common.ErrorInInsert, Resources.Common.MessaageTitle, messageIcon: MessageIcon.Error);
                return(RedirectToAction("Index"));
            }
            catch (Exception exception)
            {
                ShowMessage(Resources.Common.ErrorInInsert + exception.Message, Resources.Common.MessaageTitle, messageIcon: MessageIcon.Error);
                TempData["Containers"] =
                    new SelectList(
                        WebDesignComponent.Instance.ContainerFacade.GetByWebSiteId(this.WebSite.Id), "Id", "Title");
                return(View());
            }
        }
Beispiel #18
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);
            }
        }
Beispiel #19
0
        public bool UserInsert(Article article, List <ArticleAuthors> articleAuthorses,
                               HttpPostedFileBase abstractFileId,
                               HttpPostedFileBase orginalFileId, FormStructure formModel)
        {
            bool result = false;

            ModelView.InFormEntitiyList <RefereeCartable> keyValuePairs = new ModelView.InFormEntitiyList <RefereeCartable>();
            ModelView.InFormEntitiyList <Article>         articles      = new ModelView.InFormEntitiyList <Article>();
            ArticleBO articleBo = new ArticleBO();

            try
            {
                ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                FormGeneratorConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                if (
                    !articleBo.UserInsert(ConnectionHandler, FileManagerConnection,
                                          FormGeneratorConnection, article, articleAuthorses, abstractFileId, orginalFileId,
                                          formModel))
                {
                    return(false);
                }

                if (!articleBo.SendArticle(ConnectionHandler, FileManagerConnection, article, keyValuePairs))
                {
                    return(false);
                }

                ConnectionHandler.CommitTransaction();
                FileManagerConnection.CommitTransaction();
                FormGeneratorConnection.CommitTransaction();
                result = true;
                articles.Add(
                    article, Resources.Congress.ArticleInsertEmail,
                    Resources.Congress.ArticleInsertSMS
                    );
            }
            catch (KnownException)
            {
                ConnectionHandler.RollBack();
                FileManagerConnection.RollBack();
                FormGeneratorConnection.RollBack();
                throw;
            }
            catch (Exception ex)
            {
                ConnectionHandler.RollBack();
                FileManagerConnection.RollBack();
                FormGeneratorConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            try
            {
                articleBo.InformArticle(ConnectionHandler, article.CongressId, articles);
                new RefereeBO().InformRefereeAddArticle(ConnectionHandler, article.CongressId, keyValuePairs);
            }
            catch (Exception)
            {
            }
            return(result);
        }
Beispiel #20
0
        public void AddDataTableColumn(IConnectionHandler connectionHandler, object obj, FormStructure formStructure, ref DataTable table)
        {
            foreach (var property in obj.GetType().GetProperties())
            {
                if (property.Name == "Dynamic" || property.PropertyType == typeof(ObjectState))
                {
                    continue;
                }
                var column       = new DataColumn();
                var propertyType = property.PropertyType;
                if (propertyType.IsGenericType &&
                    propertyType.GetGenericTypeDefinition() == typeof(Nullable <>))
                {
                    propertyType       = propertyType.GetGenericArguments()[0];
                    column.AllowDBNull = true;
                }
                column.DataType   = propertyType;
                column.ColumnName = property.Name;
                if (!table.Columns.Contains(property.Name))
                {
                    table.Columns.Add(column);
                }
            }
            if (formStructure == null)
            {
                return;
            }
            new FormStructureBO().DeSerializeForm(ref formStructure);
            var generatorBo = new GeneratorBO();

            formStructure.FormState = FormState.ReportMode;
            var generateForm = generatorBo.GenerateForm(connectionHandler, formStructure);

            if (generateForm == null)
            {
                return;
            }
            foreach (Control control in generateForm.Controls)
            {
                if (control == null || control.DisplayName == null)
                {
                    continue;
                }
                if (!table.Columns.Contains(control.DisplayName))
                {
                    table.Columns.Add(control.DisplayName, control.DisplayValue != null ? control.DisplayValueType : typeof(string));
                }
            }
        }
Beispiel #21
0
        public bool AdminUpdate(Guid adminId, Article obj, List <ArticleAuthors> articleAuthorses,
                                string comment, HttpPostedFileBase flowFile, HttpPostedFileBase orginalFileId, HttpPostedFileBase abstractFileId, FormStructure formModel)
        {
            bool      result;
            ArticleBO articleBo = new ArticleBO();

            ModelView.InFormEntitiyList <Article> articles = new ModelView.InFormEntitiyList <Article>();

            try
            {
                ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                FormGeneratorConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                Article oldsatus = articleBo.Get(ConnectionHandler, obj.Id);
                articleBo.AdminUpdate(ConnectionHandler, FileManagerConnection, FormGeneratorConnection, adminId, obj, articleAuthorses, orginalFileId, abstractFileId, comment, flowFile, formModel);
                ConnectionHandler.CommitTransaction();
                FileManagerConnection.CommitTransaction();
                FormGeneratorConnection.CommitTransaction();
                result = true;
                if (oldsatus.Status != obj.Status)
                {
                    articles.Add(obj, Resources.Congress.ArticleChangeStatusEmail, Resources.Congress.ArticleChangeStatusSMS);
                }
            }
            catch (KnownException ex)
            {
                ConnectionHandler.RollBack();
                FileManagerConnection.RollBack();
                FormGeneratorConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            catch (Exception ex)
            {
                ConnectionHandler.RollBack();
                FileManagerConnection.RollBack();
                FormGeneratorConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            try
            {
                articleBo.InformArticle(ConnectionHandler, obj.CongressId, articles);
            }
            catch (Exception)
            {
            }
            return(result);
        }
Beispiel #22
0
        public void AddDataTableRows(IConnectionHandler connectionHandler, object obj, FormStructure formStructure, string objectName, string[] refcolumnNames, ref DataTable table)
        {
            var row = table.NewRow();

            foreach (var property in obj.GetType().GetProperties())
            {
                if (property.Name == "Dynamic" || property.PropertyType == typeof(ObjectState))
                {
                    continue;
                }
                var propertyType = property.PropertyType;
                if (propertyType.IsGenericType &&
                    propertyType.GetGenericTypeDefinition() == typeof(Nullable <>))
                {
                    propertyType = propertyType.GetGenericArguments()[0];
                }
                if (property.GetValue(obj, null) != null)
                {
                    row[property.Name] = System.Convert.ChangeType(property.GetValue(obj, null), propertyType);
                }
            }
            if (formStructure != null)
            {
                new FormStructureBO().DeSerializeForm(ref formStructure);
                if (refcolumnNames != null)
                {
                    var str = "";
                    foreach (var refcolumnName in refcolumnNames)
                    {
                        var value = obj.GetType().GetProperty(refcolumnName).GetValue(obj, null);
                        if (value == null)
                        {
                            continue;
                        }
                        if (!string.IsNullOrEmpty(str))
                        {
                            str += ",";
                        }
                        str += value;
                    }

                    formStructure.RefId = str;
                }
                formStructure.ObjectName = objectName;
                formStructure.FormState  = FormState.ReportMode;
                var generateForm = new GeneratorBO().GenerateForm(connectionHandler, formStructure);
                if (generateForm != null)
                {
                    var stringWriter = new StringWriter();
                    var writer       = new Html32TextWriter(stringWriter);
                    foreach (var control in generateForm.Controls)
                    {
                        if (control == null)
                        {
                            continue;
                        }
                        var key = (Control)control;
                        key.Writer = writer;
                        if (key.DisplayName == null)
                        {
                            continue;
                        }
                        row[key.DisplayName] = key.DisplayValue != null?System.Convert.ChangeType(key.DisplayValue, key.DisplayValueType) : null;

                        if (row[key.DisplayName] != null && generateForm.GetFormControl.Count > 0 && string.IsNullOrEmpty(row[key.DisplayName].ToString()))
                        {
                            key.Value = generateForm.GetFormControl.FirstOrDefault(c => c.Key == key.Id).Value;
                        }
                        key.Generate();
                        row[key.DisplayName] = key.DisplayValue;
                    }
                }
            }
            table.Rows.Add(row);
        }
Beispiel #23
0
        public Dictionary <User, bool> SearchChipFood(IConnectionHandler connectionHandler, Guid congressId, Guid chipFoodId, string txtSearch, User user, EnterpriseNode.Tools.Enums.Gender gender, FormStructure formStructure)
        {
            var outlist = new Dictionary <User, bool>();
            var search  = new UserBO().Search(connectionHandler, congressId, txtSearch, user, Enums.AscendingDescending.Descending, Enums.SortAccordingToUser.RegisterDate, gender, formStructure);

            var chipsFoodUserBo = new ChipsFoodUserBO();
            var @select         = chipsFoodUserBo.Select(connectionHandler, x => x.UserId, x => x.ChipsFoodId == chipFoodId);

            foreach (var item in search)
            {
                var chipsFoodUsers = @select.Any(x => x.Equals(item.Id));
                outlist.Add(item, chipsFoodUsers);
            }
            return(outlist);
        }
Beispiel #24
0
        public bool Insert(IConnectionHandler connectionHandler, IConnectionHandler filemanagerconnectionHandler, FormStructure formPostModel)
        {
            var fileTransactionalFacade = FileManagerComponent.Instance.FileTransactionalFacade(filemanagerconnectionHandler);

            foreach (var source in formPostModel.GetFormControl.Where(x => x.Key.Contains(typeof(FileUpload).Name)).ToList())
            {
                if (source.Value != null && !Equals(source.Value, "") && source.Value.GetType() == typeof(HttpPostedFileWrapper))
                {
                    formPostModel.GetFormControl[source.Key] = fileTransactionalFacade.Insert((HttpPostedFileBase)source.Value).ToString();
                }
            }
            var formData = new FormData
            {
                RefId       = formPostModel.RefId,
                StructureId = formPostModel.Id,
                ObjectName  = formPostModel.ObjectName,
                Data        = Extentions.GetFormData(formPostModel.GetFormControl)
            };

            formData.CurrentUICultureName = formPostModel.CurrentUICultureName;
            if (!this.Insert(connectionHandler, formData))
            {
                throw new Exception("خطایی در ذخیره اطلاعات فرم وجود دارد");
            }
            return(true);
        }
Beispiel #25
0
        public IEnumerable <UserBooth> Search(IConnectionHandler connectionHandler, string serachvalue, Guid boothId, byte?status, string registerDate, FormStructure formStructure)
        {
            PredicateBuilder <UserBooth> predicateBuilder = new PredicateBuilder <UserBooth>();

            predicateBuilder.And(x => x.BoothId == boothId);
            if (!string.IsNullOrEmpty(serachvalue))
            {
                predicateBuilder.And(
                    (x =>
                     x.EnterpriseNode.RealEnterpriseNode.FirstName.Contains(serachvalue) || x.EnterpriseNode.RealEnterpriseNode.LastName.Contains(serachvalue) ||
                     x.EnterpriseNode.RealEnterpriseNode.NationalCode.Contains(serachvalue) || x.EnterpriseNode.RealEnterpriseNode.IDNumber.Contains(serachvalue) || x.EnterpriseNode.Address.Contains(serachvalue) ||
                     x.EnterpriseNode.Website.Contains(serachvalue) || x.EnterpriseNode.Email.Contains(serachvalue) || x.EnterpriseNode.Tel.Contains(serachvalue)));
            }
            if (formStructure != null)
            {
                IEnumerable <string> search = FormGeneratorComponent.Instance.FormDataFacade.Search(formStructure);
                if (search.Any())
                {
                    IEnumerable <Guid> @select = search.Select(i => i.Split(',')[0].ToGuid());
                    predicateBuilder.And(x => x.UserId.In(@select));
                }
            }
            if (status.HasValue)
            {
                predicateBuilder.And(x => x.Status == status);
            }

            if (!string.IsNullOrEmpty(registerDate))
            {
                predicateBuilder.And(x => x.RegisterDate == registerDate);
            }

            return(OrderByDescending(connectionHandler, x => x.RegisterDate, predicateBuilder.GetExpression()));
        }
        public bool AssgineForm(IConnectionHandler connectionHandler, IConnectionHandler formgeneratorconnectionHandler, Guid congressId, FormStructure formStructure, string url, bool forUser)
        {
            var formAssigmentTransactionalFacade = FormGeneratorComponent.Instance.FormAssigmentTransactionalFacade(formgeneratorconnectionHandler);
            var formStructureTransactionalFacade = FormGeneratorComponent.Instance.FormStructureTransactionalFacade(formgeneratorconnectionHandler);
            var userFormsTransactionalFacade     = new UserFormsBO();
            var formAssigments = formAssigmentTransactionalFacade.Where(x => x.FormStructureId == formStructure.Id);
            var userform       = userFormsTransactionalFacade.Get(connectionHandler, congressId, formStructure.Id);

            if (forUser)
            {
                if (userform == null)
                {
                    var userformdata = new UserForms()
                    {
                        CongressId = congressId, FormId = formStructure.Id
                    };
                    if (!userFormsTransactionalFacade.Insert(connectionHandler, userformdata))
                    {
                        throw new Exception("خطایی در ویرایش فرم وجود دارد");
                    }
                }
            }
            else
            {
                if (userform != null)
                {
                    if (!userFormsTransactionalFacade.Delete(connectionHandler, userform))
                    {
                        throw new Exception("خطایی در ویرایش فرم وجود دارد");
                    }
                }
            }

            foreach (var formAssigment in formAssigments)
            {
                if (!string.IsNullOrEmpty(url) && url.Equals(formAssigment.Url.ToLower()))
                {
                    continue;
                }
                if (!formAssigmentTransactionalFacade.Delete(formAssigment.FormStructureId, formAssigment.Url))
                {
                    throw new Exception("خطایی در ویرایش فرم وجود دارد");
                }
            }
            if (!string.IsNullOrEmpty(url))
            {
                var assigments = formAssigmentTransactionalFacade.GetByUrl(url);
                if (assigments == null)
                {
                    assigments = new FormAssigment {
                        FormStructureId = formStructure.Id, Url = url
                    };
                    if (!formAssigmentTransactionalFacade.Insert(assigments))
                    {
                        throw new Exception("خطایی در ویرایش فرم وجود دارد");
                    }
                }
                else
                {
                    if (assigments.FormStructureId != formStructure.Id)
                    {
                        if (!formAssigmentTransactionalFacade.Delete(assigments.FormStructureId, assigments.Url))
                        {
                            throw new Exception("خطایی در ویرایش فرم وجود دارد");
                        }
                        assigments = new FormAssigment {
                            FormStructureId = formStructure.Id, Url = url
                        };
                        if (!formAssigmentTransactionalFacade.Insert(assigments))
                        {
                            throw new Exception("خطایی در ویرایش فرم وجود دارد");
                        }
                    }
                }
            }


            if (!formStructureTransactionalFacade.Update(formStructure))
            {
                throw new Exception("خطایی در ویرایش فرم وجود دارد");
            }
            return(true);
        }
Beispiel #27
0
        public bool Update(IConnectionHandler connectionHandler, IConnectionHandler filemanagerconnectionHandler, FormStructure formPostModel, FormData frm)
        {
            var fileTransactionalFacade = FileManagerComponent.Instance.FileTransactionalFacade(filemanagerconnectionHandler);
            var controlData             = Extentions.GetControlData(frm.Data);

            foreach (var source in formPostModel.GetFormControl.Where(x => x.Key.Contains(typeof(FileUpload).Name)).ToList())
            {
                var keyValuePair = new KeyValuePair <string, object>();
                if (controlData != null)
                {
                    keyValuePair = controlData.FirstOrDefault(x => x.Key == source.Key);
                }
                if (source.Value != null && !Equals(source.Value, ""))
                {
                    if (source.Value.GetType() == typeof(HttpPostedFileWrapper))
                    {
                        if (keyValuePair.Value != null && !Equals(keyValuePair.Value, ""))
                        {
                            fileTransactionalFacade.Delete(((string)keyValuePair.Value).ToGuid());
                        }
                        formPostModel.GetFormControl[source.Key] = fileTransactionalFacade.Insert((HttpPostedFileBase)source.Value).ToString();
                    }
                }
                else
                {
                    if (keyValuePair.Value != null && !Equals(keyValuePair.Value, ""))
                    {
                        fileTransactionalFacade.Delete(((string)keyValuePair.Value).ToGuid());
                    }
                }
            }
            frm.CurrentUICultureName = formPostModel.CurrentUICultureName;
            frm.StructureId          = formPostModel.Id;
            frm.Data = Extentions.GetFormData(formPostModel.GetFormControl);
            if (!this.Update(connectionHandler, frm))
            {
                throw new Exception("خطایی در ویرایش اطلاعات فرم وجود دارد");
            }

            return(true);
        }
Beispiel #28
0
        public IEnumerable <ModelView.UserArticleAbstract> SearchArticle(Guid congressId, Article article, string serachvalue, FormStructure formStructure, Enums.AscendingDescending ascendingDescending, Enums.SortAccordingToArticle articleflow)
        {
            try
            {
                ArticleBO      articleBo = new ArticleBO();
                List <Article> list      = articleBo.Search(ConnectionHandler, congressId, article, serachvalue, ascendingDescending, articleflow, formStructure);
                if (!list.Any())
                {
                    return(null);
                }

                List <ModelView.UserArticleAbstract> outlist = new List <ModelView.UserArticleAbstract>();
                List <ArticleAuthors> articleAuthorses       = new ArticleAuthorsBO().Where(ConnectionHandler, c => c.ArticleId.In(list.Select(i => i.Id)));
                Homa homa = new HomaBO().Get(ConnectionHandler, congressId);
                ConfigurationContent configcontent = new ConfigurationContentBO().Get(ConnectionHandler, congressId, homa.Configuration.CardLanguageId);
                List <Guid>          @select       = new RefereeCartableBO().Select(ConnectionHandler, x => x.ArticleId, x => x.ArticleId.In(list.Select(i => i.Id)));
                foreach (Article item in list)
                {
                    ModelView.UserArticleAbstract model = new ModelView.UserArticleAbstract();
                    item.HasRefereeOpinion     = @select.Any(x => x.Equals(item.Id));
                    item.HasRefereeAttachment  = item.HasRefereeOpinion;
                    item.AllowPrintCertificate = true;

                    List <ArticleAuthors> authorbo = articleAuthorses.Where(c => c.ArticleId == item.Id).OrderBy(c => c.Order).ToList();
                    string auters = "";
                    if (string.IsNullOrEmpty(item.Title))
                    {
                        foreach (ArticleAuthors author in authorbo)
                        {
                            auters += "," + author.Name + ":" + (author.IsDirector == false ? "" : "Director" + ":") + author.Address;
                        }
                        if (!string.IsNullOrEmpty(auters))
                        {
                            model.Authors = auters.Substring(1);
                        }
                    }
                    if (string.IsNullOrEmpty(auters))
                    {
                        foreach (ArticleAuthors author in authorbo)
                        {
                            auters += "," + author.Name + ":" + (author.IsDirector == false ? "" : "مسوول" + ":") + author.Address;
                        }
                        if (!string.IsNullOrEmpty(auters))
                        {
                            model.Authors = auters.Substring(1);
                        }
                    }
                    if (configcontent != null && configcontent.LogoId.HasValue && configcontent.Logo != null)
                    {
                        model.CongressLogo = configcontent.Logo.Content;
                    }

                    model.Id = item.Id.ToString();
                    model.OrginalTextFile = item.ArticleOrginalText == null ? "" : item.ArticleOrginalText.RemoveHtml();
                    model.Abstract        = item.Abstract == null ? "" : item.Abstract.RemoveHtml();
                    model.CongressTitle   = homa.CongressTitle;
                    model.Description     = item.Description;
                    model.Title           = item.Title;
                    model.Keyword         = item.Keyword;
                    if (item.Pivot != null)
                    {
                        model.Pivot = item.Pivot.Title;
                    }

                    outlist.Add(model);
                }
                return(outlist);
            }
            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);
            }
        }
Beispiel #29
0
 public FormStructure GetUserFormReport(FormStructure form, string culture)
 {
     return(new GeneratorBO().GenerateForm(form, culture));
 }
Beispiel #30
0
        public List <FormData> GetGridDataSource(IConnectionHandler connectionHandler, FormStructure formStructure, string objactname, string refId, string gridId, string culture)
        {
            var datas = new List <FormData>();

            if (!string.IsNullOrEmpty(refId))
            {
                var controls  = formStructure.Controls.Where(x => x.GetType().Name != typeof(Grid).Name && ((Control)x).GridId == gridId).ToList();
                var formDatas = new FormDataBO().Where(connectionHandler,
                                                       x =>
                                                       x.RefId.ToLower() == refId.ToLower() && x.ObjectName.ToLower() == objactname.ToLower() &&
                                                       x.StructureId == formStructure.Id);
                if (formDatas == null || !formDatas.Any())
                {
                    return(null);
                }
                new FormDataBO().GetLanuageContent(connectionHandler, culture, formDatas);
                foreach (var formData in formDatas)
                {
                    var  list = Extentions.GetControlData(formData.Data);
                    bool add  = false;
                    foreach (var control in controls)
                    {
                        if (!list.ContainsKey(((Control)control).Id))
                        {
                            continue;
                        }
                        add = true;
                        if (!formData.GetFormControl.ContainsKey(((Control)control).Id))
                        {
                            formData.GetFormControl.Add(((Control)control).Id, list[((Control)control).Id]);
                        }
                    }
                    if (add)
                    {
                        datas.Add(formData);
                    }
                }
            }
            return(datas);
        }