protected void Rpt_Terms(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
        {
            var item2 = e.Item;

            var HyperTerms     = item2.FindControl("HyperTerms") as HyperLink;
            var VocabularyName = item2.FindControl("VocabularyName") as Label;

            var ctrl = new ObserverOfScienceController();
            var item = e.Item.DataItem as InvTermsInfo;

            switch (item.Term.Vocabulary.Name)
            {
            case "GroupOfDevelopment":
                VocabularyName.Text    = item.Term.Vocabulary.Description + ":<br/>";
                HyperTerms.Text        = item.Term.Name + ";";
                HyperTerms.NavigateUrl = EditUrl("TermID", item.TermId.ToString(), "TermInventionView");
                break;

            case "IndustryInProduction":
                VocabularyName.Text    = item.Term.Vocabulary.Description + ":<br/>";
                HyperTerms.Text        = item.Term.Name + ";";
                HyperTerms.NavigateUrl = EditUrl("TermID", item.TermId.ToString(), "TermInventionView");
                break;

            case "IndustryInScience":
                VocabularyName.Text    = item.Term.Vocabulary.Description + ":<br/>";
                HyperTerms.Text        = item.Term.Name + ";";
                HyperTerms.NavigateUrl = EditUrl("TermID", item.TermId.ToString(), "TermInventionView");
                break;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    var settings = new ObserverOfScienceSettings(ModuleId, TabModuleId);


                    var ctrl  = new ObserverOfScienceController();
                    var items = ctrl.GetList <ObserverOfScienceInfo>();

//					List<ObserverOfScienceInfo> new_items =new List<ObserverOfScienceInfo>();
                    n = settings.LenghtText;
//					for(int i=0; i < Math.Min(n,items.Count); i++)
//						new_items.Add (items[i]);
//
//					items = new_items;

                    // bind the data
                    lstObserverOfScience.DataSource = items;
                    lstObserverOfScience.DataBind()
                    //привязать данные из таблици inventioninfo к таблице observer of sciensinfo
                    //поменять Invention на ObserverOfScienceInfo
                    //править айтем дата баленд менять связи
                    ;
                }
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Exemple #3
0
        /// <summary>
        /// Handles Page_Load event for a control
        /// </summary>
        /// <param name='sender'>
        /// Sender.
        /// </param>
        /// <param name='e'>
        /// Event args.
        /// </param>
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // parse querystring parameters
                int tmpItemId;
                if (int.TryParse(Request.QueryString ["InventionID"], out tmpItemId))
                {
                    itemId = tmpItemId;
                }

                if (!IsPostBack)
                {
                    // load the data into the control the first time we hit this page

                    cmdDelete.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');");

                    // check we have an item to lookup
                    // ALT: if (!Null.IsNull (itemId)
                    if (itemId.HasValue)
                    {
                        // load the item
                        var ctrl = new ObserverOfScienceController();
                        var item = ctrl.Get <InventionInfo> (itemId.Value, this.ModuleId);

                        if (item != null)
                        {
                            //TODO: Fill controls with data
                            txtTitle.Text = item.Name;
                            //	txtListOfDevelopment.Text=item.ListOfDevelopment;
                            //txtDevelopment.Text=item.Development;
                            txtDescription.Text = item.Description;
                            //	txtYearOfDevelopment.Text = item.YearOfDevelopment.ToString();
                            //setup audit control;
                            //ctlAudit.CreatedByUser = item.CreatedByUserName;
                            //	ctlAudit.CreatedDate = item.CreatedOnDate.ToLongDateString ();
                        }
                        else
                        {
                            Response.Redirect(Globals.NavigateURL(), true);
                        }
                    }
                    else
                    {
                        cmdDelete.Visible = false;
                        ctlAudit.Visible  = false;
                    }
                }
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
        /// <summary>
        /// Handles the items being bound to the datalist control. In this method we merge the data with the
        /// template defined for this control to produce the result to display to the user
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lstContent_ItemDataBound(object sender, System.Web.UI.WebControls.DataListItemEventArgs e)
        {
            // use e.Item.DataItem as object of ObserverOfScienceInfo class,
            // as we really know it is:
            var item1 = e.Item.DataItem as ObserverOfScienceInfo;
            var ctrl  = new ObserverOfScienceController();

            var item = ctrl.Get <InventionInfo> (item1.InventionId);

            var HyperName  = e.Item.FindControl("HyperName") as HyperLink;
            var lblContent = e.Item.FindControl("lblContent") as Label;
            //в таблице нет  поля статусvar lblStatus = e.Item.FindControl ("lblStatus") as Label;
            //	var lblScientists = e.Item.FindControl ("lblScientists") as Label;
            var ImgObserverOfScience = e.Item.FindControl("ImgObserverOfScience") as Image;
            //var CreateByUser = e.Item.ForeControl ("CreateByUser") as Label;
            var contentValue = string.Empty;

            var edit = e.Item.FindControl("HyperLink1") as HyperLink;

            edit.NavigateUrl = EditUrl("InventionID", item.InventionID.ToString());

            if (item.Image != null)
            {
                ImgObserverOfScience.ImageUrl = item.Image;
            }
            else
            {
                ImgObserverOfScience.ImageUrl = "~/DesktopModules/ObserverOfScience/images/irrigation.jpg";
            }



            HyperName.NavigateUrl = EditUrl("ObserverOfScienceID", item.InventionID.ToString(), "DetailView");
            linkinvention         = HyperName.NavigateUrl;
            contentValue          = Server.HtmlDecode(item.Description);
            HyperName.Text        = contentValue;

            //	contentValue = Server.HtmlDecode (LenghtText(item.Content));
            //	lblContent.Text = contentValue;

            contentValue = Server.HtmlDecode(item.Name);
            //lblStatus.Text =string.Format(Localization.GetString("lblTitle.Format", LocalResourceFile), contentValue);
            contentValue = null;
            //	foreach(ScientistInfo ind in item.Scientists)
            //	{
            //		contentValue+=ind.User.LastName+" "+ind.User.FirstName+";";
            //	}
            //	lblScientists.Text=string.Format(Localization.GetString("lblScientists.Format", LocalResourceFile),contentValue);
        }
Exemple #5
0
 /// <summary>
 /// Handles Click event for cmdDelete button
 /// </summary>
 /// <param name='sender'>
 /// Sender.
 /// </param>
 /// <param name='e'>
 /// Event args.
 /// </param>
 protected void cmdDelete_Click(object sender, EventArgs e)
 {
     try
     {
         // ALT: if (!Null.IsNull (itemId))
         if (itemId.HasValue)
         {
             var ctrl = new ObserverOfScienceController();
             ctrl.Delete <ObserverOfScienceInfo> (itemId.Value);
             Response.Redirect(Globals.NavigateURL(), true);
         }
     }
     catch (Exception ex)
     {
         Exceptions.ProcessModuleLoadException(this, ex);
     }
 }
        protected void Rpt_Patent(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
        {
            var item2 = e.Item;

            var HyperPatent = item2.FindControl("HyperPatent") as HyperLink;
            var lblDate     = item2.FindControl("lblDatePatent") as Label;

            lblDate.Text = string.Empty;
            var ctrl = new ObserverOfScienceController();
            var item = e.Item.DataItem as PatentInfo;

            HyperPatent.Text += "№ патента:" + item.NumberPatent.ToString();

            if (item.DatePatent.Year != 1)
            {
                lblDate.Text = " Дата выдачи патента:" + item.DatePatent.Day.ToString() + ":" + item.DatePatent.Month.ToString() + ":" + item.DatePatent.Year.ToString() + "г. <br>";
            }
            else
            {
                HyperPatent.Text = HyperPatent.Text + "<br>";
            }
            patent = 1;
        }
Exemple #7
0
        /// <summary>
        /// Handles Click event for cmdUpdate button
        /// </summary>
        /// <param name='sender'>
        /// Sender.
        /// </param>
        /// <param name='e'>
        /// Event args.
        /// </param>
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                var ctrl = new ObserverOfScienceController();
                ObserverOfScienceInfo item;
                InventionInfo         inv;


                // determine if we are adding or updating
                // ALT: if (Null.IsNull (itemId))
                if (!itemId.HasValue)
                {
                    // TODO: populate new object properties with data from controls
                    // to add new record
                    //Описание разработки
                    inv                  = new InventionInfo();
                    inv.Description      = txtDescription.Text;
                    inv.Status           = txtStatus.Text;
                    inv.YearOfCreation   = DateTime.Today;                  // временно
                    inv.Advantages       = txtAdvantages.Text;
                    inv.InventionEssence = txtInventionEssence.Text;

                    inv.Name = txtTitle.Text;
                    ctrl.Add <InventionInfo>(inv);


                    item               = new ObserverOfScienceInfo();
                    item.ModuleID      = ModuleId;
                    item.CreatedByUser = this.UserId;
                    item.InventionId   = inv.InventionID;
                    ctrl.Add <ObserverOfScienceInfo> (item);


                    //inv.Name = txtTitle.Text;
                    //ctrl.Add<InventionInfo>(inv);

                    //Суть разработки


                    //inv.Name = txtTitle.Text;
                    //ctrAdd<InventionInfo>(inv);
                }
                else
                {
                    inv                  = ctrl.Get <InventionInfo> (itemId.Value);
                    inv.Description      = txtDescription.Text;
                    inv.Advantages       = txtAdvantages.Text;
                    inv.InventionEssence = txtInventionEssence.Text;
                    inv.Name             = txtTitle.Text;
                    ctrl.Update <InventionInfo>(inv);


                    /*
                     * inv = ctrl.Get<InventionInfo> (itemId.Value);
                     * inv.Advantages = txtTitle.Text;
                     * ctrl.Update<InventionInfo>(inv);
                     * inv = ctrl.Get<InventionInfo> (itemId.Value);
                     * inv.Name = txtTitle.Text;
                     * ctrl.Update<InventionInfo>(inv);
                     */

                    //по аналогии с выше написанным + править поля в таблицах инвеншанинфо и удалить поля из оbserver of sience кроме invenrionid и modulId
                    // TODO: update properties of existing object with data from controls
                    // to update existing record
                    //item = ctrl.Get<ObserverOfScienceInfo> (itemId.Value, this.ModuleId);
                    //item.Content = txtDescription.Text;
                    //ctrl.Update<ObserverOfScienceInfo> (item);
                }

                Response.Redirect(Globals.NavigateURL(), true);
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
        /// <summary>
        /// Handles Page_Load event for a control
        /// </summary>
        /// <param name='sender'>
        /// Sender.
        /// </param>
        /// <param name='e'>
        /// Event args.
        /// </param>
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                int tmpItemId;
                if (int.TryParse(Request.QueryString ["InventionID"], out tmpItemId))
                {
                    itemId = tmpItemId;
                }
                if (!IsPostBack)
                {
                    if (itemId.HasValue)
                    {
                        // load the item
                        var ctrl         = new ObserverOfScienceController();
                        var item         = ctrl.Get <InventionInfo> (itemId.Value);
                        var contentValue = string.Empty;
                        if (item != null)
                        {
                            lblDetailInventionEssence.Text = item.Description + "<p>" + item.InventionEssence;
                            lblDetailName.Text             = item.Name;

                            //	lblDetailStatus.Text=string.Format(Localization.GetString("lblDetailStatus.Format", LocalResourceFile),item.Status);
                            lblDetailStatus.Text = item.Status;
                            lblAdvantages.Text   = item.Advantages;

                            if (item.YearOfCreation.Year != 1)
                            {
                                lblYearOfCreation.Text = "<b>Год разработки:</b>" + item.YearOfCreation.Year.ToString() + "г.";
                            }
                            foreach (ScientistInfo ind in item.Scientists)
                            {
                                contentValue += ind.User.LastName + " " + ind.User.FirstName + ";" + "<br>";
                            }
                            lblDetailScientist.Text = contentValue;
                            //lblDetailScientist.Text=string.Format(Localization.GetString("lblDetailScientist.Format", LocalResourceFile),contentValue);

                            #region Патент

                            RepeaterPatent.DataSource = item.Patents;
                            RepeaterPatent.DataBind();
                            if (patent == 0)
                            {
                                lblPatent.Text = "Патенты отсутсвуют";
                            }
                            #endregion

                            #region Термы
                            RepeaterTerms.DataSource = item.Terms;
                            RepeaterTerms.DataBind();
                            #endregion

                            #region  есурсы
                            RepeaterResources.DataSource = item.InventionResources;
                            RepeaterResources.DataBind();
                            if (patent != 2)
                            {
                                lblResources.Text = "У данной разработки материалы отсутствуют";
                            }
                            #endregion

                            #region Внедрения
                            if (item.Introductions.Count > 0)
                            {
                                foreach (IntroductionInfo introduction in item.Introductions)
                                {
                                    lblIntroduction.Text   = "<b>Была внедренна:</b><br/>";
                                    HyperIntroduction.Text = "<i>" + introduction.Vendor.VendorName + "</i>";
                                    YearIntroduction.Text  = " В " + introduction.YearIntroduction.Date.Year + "г.";
                                }
                            }
                            else
                            {
                                lblIntroduction.Text = "Разработка ещё не внедрялась";
                            }


                            #endregion
                        }
                        else
                        {
                            Response.Redirect(Globals.NavigateURL(), true);
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
        protected void Rpt_Resource(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
        {
            var item2 = e.Item;

            var HyperResource = item2.FindControl("HyperResource") as HyperLink;
            var ImgResource   = item2.FindControl("ImgResource") as Image;

            var ctrl = new ObserverOfScienceController();
            var item = e.Item.DataItem as InventionResourceInfo;

            switch (item.File.Extension)
            {
            case "doc":
                ImgResource.ImageUrl      = "~/DesktopModules/ObserverOfScience/images/Extension/word.png";
                HyperResource.Text        = item.File.FileName;
                HyperResource.NavigateUrl = item.File.FileName;
                break;

            case "docx":
                ImgResource.ImageUrl      = "~/DesktopModules/ObserverOfScience/images/Extension/word.png";
                HyperResource.Text        = item.File.FileName;
                HyperResource.NavigateUrl = Globals.LinkClick(item.File.PhysicalPath, this.TabId, this.ModuleId);
                break;

            case "pdf":
                ImgResource.ImageUrl      = "~/DesktopModules/ObserverOfScience/images/Extension/pdf.png";
                HyperResource.Text        = item.File.FileName;
                HyperResource.NavigateUrl = Globals.LinkClick(item.File.RelativePath, this.TabId, this.ModuleId);
                break;

            case "rtf":
                ImgResource.ImageUrl      = "~/DesktopModules/ObserverOfScience/images/Extension/word.png";
                HyperResource.Text        = item.File.FileName;
                HyperResource.NavigateUrl = Globals.LinkClick(item.File.PhysicalPath, this.TabId, this.ModuleId);
                break;

            case "jpg":
                ImgResource.ImageUrl      = "~/DesktopModules/ObserverOfScience/images/Extension/img.png";
                HyperResource.Text        = item.File.FileName;
                HyperResource.NavigateUrl = Globals.LinkClick(item.File.PhysicalPath, this.TabId, this.ModuleId);
                break;

            case "bmp":
                ImgResource.ImageUrl      = "~/DesktopModules/ObserverOfScience/images/Extension/img.png";
                HyperResource.Text        = item.File.FileName;
                HyperResource.NavigateUrl = Globals.LinkClick(item.File.PhysicalPath, this.TabId, this.ModuleId);
                break;

            case "png":
                ImgResource.ImageUrl      = "~/DesktopModules/ObserverOfScience/images/Extension/img.png";
                HyperResource.Text        = item.File.FileName;
                HyperResource.NavigateUrl = Globals.LinkClick(item.File.PhysicalPath, this.TabId, this.ModuleId);
                break;

            case "gif":
                ImgResource.ImageUrl      = "~/DesktopModules/ObserverOfScience/images/Extension/img.png";
                HyperResource.Text        = item.File.FileName;
                HyperResource.NavigateUrl = Globals.LinkClick(item.File.PhysicalPath, this.TabId, this.ModuleId);
                break;

            case "xls":
                ImgResource.ImageUrl      = "~/DesktopModules/ObserverOfScience/images/Extension/excel.png";
                HyperResource.Text        = item.File.FileName;
                HyperResource.NavigateUrl = Globals.LinkClick(item.File.PhysicalPath, this.TabId, this.ModuleId);
                break;

            case "xlsx":
                ImgResource.ImageUrl      = "~/DesktopModules/ObserverOfScience/images/Extension/excel.png";
                HyperResource.Text        = item.File.FileName;
                HyperResource.NavigateUrl = Globals.LinkClick(item.File.PhysicalPath, this.TabId, this.ModuleId);
                break;

            case "avi":
                ImgResource.ImageUrl      = "~/DesktopModules/ObserverOfScience/images/Extension/video.png";
                HyperResource.Text        = item.File.FileName;
                HyperResource.NavigateUrl = Globals.LinkClick(item.File.PhysicalPath, this.TabId, this.ModuleId);
                break;

            case "wmv":
                ImgResource.ImageUrl      = "~/DesktopModules/ObserverOfScience/images/Extension/video.png";
                HyperResource.Text        = item.File.FileName;
                HyperResource.NavigateUrl = Globals.LinkClick(item.File.PhysicalPath, this.TabId, this.ModuleId);
                break;

            case "mpeg":
                ImgResource.ImageUrl      = "~/DesktopModules/ObserverOfScience/images/Extension/video.png";
                HyperResource.Text        = item.File.FileName;
                HyperResource.NavigateUrl = Globals.LinkClick(item.File.PhysicalPath, this.TabId, this.ModuleId);
                break;

            case "rar":
                ImgResource.ImageUrl      = "~/DesktopModules/ObserverOfScience/images/Extension/rar.png";
                HyperResource.Text        = item.File.FileName;
                HyperResource.NavigateUrl = Globals.LinkClick(item.File.PhysicalPath, this.TabId, this.ModuleId);
                break;

            case "zip":
                ImgResource.ImageUrl      = "~/DesktopModules/ObserverOfScience/images/Extension/rar.png";
                HyperResource.Text        = item.File.FileName;
                HyperResource.NavigateUrl = Globals.LinkClick(item.File.PhysicalPath, this.TabId, this.ModuleId);
                break;

            case "ppt":
                ImgResource.ImageUrl      = "~/DesktopModules/ObserverOfScience/images/Extension/ppt.png";
                HyperResource.Text        = item.File.FileName;
                HyperResource.NavigateUrl = Globals.LinkClick(item.File.PhysicalPath, this.TabId, this.ModuleId);
                break;

            case "pptm":
                ImgResource.ImageUrl      = "~/DesktopModules/ObserverOfScience/images/Extension/ppt.png";
                HyperResource.Text        = item.File.FileName;
                HyperResource.NavigateUrl = Globals.LinkClick(item.File.PhysicalPath, this.TabId, this.ModuleId);
                break;

            default:
                HyperResource.Text        = item.File.FileName;
                HyperResource.NavigateUrl = Globals.LinkClick(item.File.PhysicalPath, this.TabId, this.ModuleId);
                break;
            }
            patent = 2;
        }