Пример #1
0
        protected void uiButtonUpdate_Click(object sender, EventArgs e)
        {
            EGEMech.BLL.Project project = new EGEMech.BLL.Project();
            if (CurrentProject != null)
            {
                project = CurrentProject;
            }
            else
            {
                project.AddNew();
            }

            project.Name = uiTextBoxName.Text;
            project.IsEPC= uiCheckBoxIsEPC.Checked;
            project.Description= Server.HtmlEncode(uiFCKeditorDescription.Value);
            string file = "";
            if (uiFileUploadImg.HasFile)
            {
                uiFileUploadImg.SaveAs(Server.MapPath("~/UploadFolder/projects/" + uiFileUploadImg.FileName));
                file = "/UploadFolder/projects/" + uiFileUploadImg.FileName;
                project.PicPath = file;
            }
            project.Save();
            uiPanelEdit.Visible = false;
            uiPanelViewProjects.Visible = true;
            Clearfields();
            BindData();
            CurrentProject = null;
        }
Пример #2
0
 protected void uiButtonCancel_Click(object sender, EventArgs e)
 {
     uiPanelEdit.Visible = false;
     uiPanelViewProjects.Visible = true;
     Clearfields();
     CurrentProject = null;
 }
Пример #3
0
 private void BindData()
 {
     EGEMech.BLL.Project projects = new EGEMech.BLL.Project();
     projects.LoadAll();
     uiGridViewProjects.DataSource = projects.DefaultView;
     uiGridViewProjects.DataBind();
 }
Пример #4
0
        protected void uiGridViewProjects_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditProject")
            {
                EGEMech.BLL.Project project = new EGEMech.BLL.Project();
                project.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument));
                CurrentProject = project;

                uiTextBoxName.Text = project.Name;
                uiCheckBoxIsEPC.Checked = project.IsEPC;
                uiFCKeditorDescription.Value = Server.HtmlDecode(project.Description);
                uiPanelViewProjects.Visible = false;
                uiPanelEdit.Visible = true;
            }
            else if (e.CommandName == "DeleteProject")
            {
                try
                {
                    EGEMech.BLL.Project project = new EGEMech.BLL.Project();
                    project.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument));
                    project.MarkAsDeleted();
                    project.Save();
                    BindData();
                }
                catch (Exception ex)
                {
                    uiLabelError.Visible = true;
                }

            }
        }