Inheritance: System.Web.UI.Page
示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        project project = new project();
        DataSet dt = project.GetList("");
        StringBuilder stringBuilder = new StringBuilder();
        string strProjectDetail = "";
        if (dt.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < dt.Tables[0].Rows.Count; i++)
            {
                stringBuilder.Append("<li><img src = \"Images/Img.jpg\" ><a href = \"projectDetail.aspx?docid=" + dt.Tables[0].Rows[i]["id"].ToString() + "&rend =" + System.Guid.NewGuid().ToString() + "\">");
                stringBuilder.Append("<span> " + dt.Tables[0].Rows[i]["projectNmae"].ToString() + " </span></a><br>");
                stringBuilder.Append(" <i> " + Convert.ToDateTime(dt.Tables[0].Rows[i]["publishTime"].ToString()).ToString("yyyy.MM.dd") + "");
                string[] strArray = dt.Tables[0].Rows[i]["industry"].ToString().Split('#');
                for (int j = 0; j < strArray.Length; j++)
                {
                    if (j != strArray.Length - 1)
                    {
                        stringBuilder.Append("&nbsp;" + strArray[j] + "&nbsp;");
                    }
                }
                stringBuilder.Append("</i>");
                strProjectDetail = dt.Tables[0].Rows[i]["projectDetail"].ToString();
                if (strProjectDetail.Length > 400)
                {
                    strProjectDetail = strProjectDetail.Substring(0, 400) + "...";
                }
                stringBuilder.Append("<p>" + strProjectDetail + "</p>");
                stringBuilder.Append("<a href =\"projectDetail.aspx?docid=" + dt.Tables[0].Rows[i]["id"] + "&rend=" + System.Guid.NewGuid().ToString() + "\"><em> 了解更多 </em></a>\"");
                stringBuilder.Append("</li>\"");
            }
        }

        this.lb_show.Text = stringBuilder.ToString();
    }
示例#2
0
    private void dataShow()
    {
        string strDocid = "";
        if (this.Request.QueryString["docid"] != null)
        {
            strDocid = this.Request.QueryString["docid"].ToString();
            project project = new project();
            project.GetModel(" and id='" + strDocid + "' ");
            this.lb_projectName.Text = project.projectNmae;
            this.lb_projectNet.Text = project.projectAdress;
            this.lb_projectSummary.Text = project.projcetSummary;
            this.lb_projectKey.Text = project.projcetKeyword;
            this.lb_industry.Text = project.industry.Replace("#", " ");
            this.lb_projectDetail.Text = project.projectDetail;
            this.lb_financing.Text = project.financing.ToString();
            this.lb_phone.Text = project.phoneNumber;
            this.lb_email.Text = project.eamil;
            this.lb_movice.Text = project.video;
            this.lb_teamDetail.Text = project.teamDetail;
            projectMessage projectMessage = new projectMessage();
            DataSet dtSet = projectMessage.GetList(" and  projectId ='" + strDocid + "' ");
            string strMessage = "";
            if (dtSet.Tables[0].Rows.Count > 0)
            {
                for (int i=0;i<dtSet.Tables[0].Rows.Count;i++)
                {
                    strMessage = dtSet.Tables[0].Rows[i]["projectMessages"].ToString();
                    for (int j=0;j<((strMessage.Length/30)+1);j++)
                    {

                    }
                }
            }
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.Request.QueryString["docid"] != null)
     {
         this.txtDocid.Text = this.Request.QueryString["docid"].ToString();
     }
     DataSet dt = new DataSet();
     project project = new project();
     dt = project.GetList(" id='" + this.txtDocid.Text + "' ");
     if (dt.Tables[0].Rows.Count > 0)
     {
         StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.Append("<span> " + dt.Tables[0].Rows[0]["projectNmae"].ToString() + " </span><br>");
         stringBuilder.Append(" <i> " + Convert.ToDateTime(dt.Tables[0].Rows[0]["publishTime"].ToString()).ToString("yyyy.MM.dd") + "");
         string[] strArray = dt.Tables[0].Rows[0]["industry"].ToString().Split('#');
         for (int j = 0; j < strArray.Length; j++)
         {
             if (j != strArray.Length - 1)
             {
                 stringBuilder.Append("&nbsp;" + strArray[j] + "&nbsp;");
             }
         }
         stringBuilder.Append("</i>");
         stringBuilder.Append("<img src =\"Images/Img.jpg\" >");
         stringBuilder.Append("<p> " + dt.Tables[0].Rows[0]["projectDetail"].ToString() + "</p>");
         this.lb_show.Text = stringBuilder.ToString();
     }
 }
示例#4
0
 public Projects(project input)
 {
     this.ID = int.Parse(input.id.First().Value);
     this.Name = input.name;
     this.Status = input.status;
     this.CompanyID = int.Parse(input.company.First().id.First().Value);
     this.Company = input.company.First().name;
     this.TodoLists = new List<TodoLists>();
 }
示例#5
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     DataClassesDataContext da = new DataClassesDataContext();
     project p = new project();
     p.project_num = TextBox1.Text;
     p.title = TextBox2.Text;
     p.type = TextBox3.Text;
     p.major = TextBox4.Text;
     p.detail = TextBox5.Text;
     da.project.InsertOnSubmit(p);
     da.SubmitChanges();
     Binder();
 }
示例#6
0
 //批量删除
 protected void btndelinfo_Click(object sender, EventArgs e)
 {
     HyCommon HyCommon = new HyCommon();
     project project = new project();
     String[] v_uids = this.txtuids.Value.Split(',');
     for (int i = 0; i < v_uids.Length; i++)
     {
         project.id = v_uids[i];
         project.Delete();
     }
     string pageUrl = HyCommon.CombUrlTxt("exportList.aspx", "page={0}&rnd={1}", "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "");
     ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>tip('数据已经被成功删除!','" + pageUrl + "');</script>");
 }
示例#7
0
        public static int get_routing_method_index(project current_project)
        {
            switch (current_project.run_options.routing_method)
            //    Channel, Landscape Unit, Hydrologic Response Unit, All Basin
            {
            case "Variable Storage":
                return(0);

            case "Muskingum":
                return(1);

            default:
                return(1);
            }
        }
        public async Task <ActionResult> PatchProject(int id, ProjectDTO patchDoc)
        {
            try
            {
                var getProject = await _projectSvc.GetProjectByIdAsNoTracking(id);

                if (getProject == null)
                {
                    return(NotFound());
                }

                if (patchDoc.sdlcSystem != null)
                {
                    if (patchDoc.sdlcSystem.id != 0)
                    {
                        var sdlcSys = await _sdlSvc.GetSdlcSystemByIdAsNoTracking(patchDoc.sdlcSystem.id);

                        if (sdlcSys == null)
                        {
                            return(NotFound());
                        }
                    }
                }

                if (patchDoc.name == null && patchDoc.external_id == null && patchDoc.sdlcSystem == null)
                {
                    return(NotFound());
                }

                var project = new project();

                var toUpdate = _mapper.Map(patchDoc, project);

                var newUpdate = await _projectSvc.UpdateProject(id, toUpdate);

                if (newUpdate == null)
                {
                    return(Conflict());
                }

                return(Ok(newUpdate));
            }
            catch (Exception ex)
            {
                Log.Error("An error occurred " + ex);
                return(BadRequest());
            }
        }
示例#9
0
        /// <summary>
        /// Modifie un enregistrement sélectionner dans une liste d'un onglet sélectionner
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MIT_Open_Click(object sender, EventArgs e)
        {
            // ouvrir la liste des projets
            if (TBC_Project.SelectedTab == TBP_ListProject && DTG_Project.SelectedRows[0].DataBoundItem != null)
            {
                project selectedProject = DTG_Project.SelectedRows[0].DataBoundItem as project;


                EditProject editProject = new EditProject(selectedProject);
                editProject.StartPosition = FormStartPosition.CenterParent;
                if (editProject.ShowDialog() == DialogResult.OK)
                {
                    _ProjectManagement.ListProject.Remove(selectedProject);
                    _ProjectManagement.ListProject.Add(selectedProject);
                    hasChanges = true;
                }
            }

            // ouvrir la liste des types de tâches
            else if (TBC_Project.SelectedTab == TBP_ListTypeTask && DTG_ListeTaskType.SelectedRows[0].DataBoundItem != null)
            {
                taskType selectedTaskType = DTG_ListeTaskType.SelectedRows[0].DataBoundItem as taskType;

                EditTaskType editTaskType = new EditTaskType(selectedTaskType);
                editTaskType.StartPosition = FormStartPosition.CenterParent;
                if (editTaskType.ShowDialog() == DialogResult.OK)
                {
                    _ProjectManagement.ListTaskType.Remove(selectedTaskType);
                    _ProjectManagement.ListTaskType.Add(selectedTaskType);
                    hasChanges = true;
                }
            }

            // ouvrir la liste des tâches
            else if (TBC_Project.SelectedTab == TBP_ListTask && DTG_ListTask.SelectedRows[0].DataBoundItem != null)
            {
                task selectedTask = DTG_ListTask.SelectedRows[0].DataBoundItem as task;

                EditTask editTask = new EditTask(_ProjectManagement.ListProject, _ProjectManagement.ListTaskType, selectedTask);
                editTask.StartPosition = FormStartPosition.CenterParent;
                if (editTask.ShowDialog() == DialogResult.OK)
                {
                    _ProjectManagement.ListTask.Remove(selectedTask);
                    _ProjectManagement.ListTask.Add(selectedTask);
                    hasChanges = true;
                }
            }
        }
        /// <summary>
        /// 添加部门信息
        /// </summary>
        /// <param name="info">部门对象</param>
        /// <returns>若成功返回true</returns>
        public bool AddDepartmentWithParameter(DepartmentInfo info)
        {
            List <DepartmentInfo> infos = new List <DepartmentInfo>();

            infos.Add(info);
            project data = new project();

            data.Field       = JsonConvert.SerializeObject(infos);
            data.Type        = "1";
            data.Search_type = "5";

            String JSON = JsonConvert.SerializeObject(data);

            data = DBTool.JSONStringToObject(DBTool.Send(JSON));
            return(DBTool.isTrue(data.Field));
        }
示例#11
0
 public ActionResult GetProject(int id)
 {
     using (PMEntities context = new PMEntities())
     {
         if (context.projects.Any(p => p.Id == id))
         {
             project pj = context.projects.Find(id);
             pj.project_manager = context.Users.Find(pj.project_manager_id);
             return(Json(new { status = "200", data = pj, displaySweetAlert = false }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(new { status = "404", data = "", message = "project not found", displaySweetAlert = false }, JsonRequestBehavior.AllowGet));
         }
     }
 }
        public ActionResult Create([Bind(Include = "projectID,createrID,arrival,installation,rehearsal,start,finish,deinstallation,departure,placeID,worktype,executorID,type,showmanID,managerID,clientID,content,note,receipts_cash,receipts_noncash,expenditure_cash,expenditure_noncash,profit_cash,profit_noncash,profit_total")] project project)
        {
            if (ModelState.IsValid)
            {
                db.projects.Add(project);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.executorID = new SelectList(db.contacts, "contactID", "name", project.executorID);
            ViewBag.clientID   = new SelectList(db.contacts, "contactID", "name", project.clientID);
            ViewBag.managerID  = new SelectList(db.contacts, "contactID", "name", project.managerID);
            ViewBag.showmanID  = new SelectList(db.contacts, "contactID", "name", project.showmanID);
            ViewBag.placeID    = new SelectList(db.places, "placeID", "name", project.placeID);
            return(View(project));
        }
        public ActionResult Edit(int id)
        {
            project project = db.projects
                              .Include("tags")
                              .Include("project_photo")
                              .Include("updates")
                              .Include("donations")
                              .Include("achievements")
                              .Single(p => p.ProjectID == id);

            ViewBag.Supporters = new SelectList(db.users.Where(x => x.Role == "admin" || x.Role == "supporter"), "UserID", "UserName");
            ViewBag.CountryID  = new SelectList(db.countries, "CountryID", "Name", project.CountryID);
            ViewBag.UserID     = new SelectList(db.users.Where(x => x.Role == "admin" || x.Role == "publisher"), "UserID", "UserName", project.UserID);
            ViewBag.Tags       = db.tags;
            return(View(project));
        }
示例#14
0
        /// <summary>
        /// 修改用户个人信息
        /// </summary>
        /// <param name="info">用户对象</param>
        /// <returns>若成功返回true</returns>
        public bool Update(UserInfo info)
        {
            List <UserInfo> infos = new List <UserInfo>();

            infos.Add(info);
            project data = new project();

            data.Field       = JsonConvert.SerializeObject(infos);
            data.Type        = "5";
            data.Search_type = "3";

            String JSON = JsonConvert.SerializeObject(data);

            data = DBTool.JSONStringToObject(DBTool.Send(JSON));
            return(DBTool.isTrue(data.Field));
        }
示例#15
0
        // GET: projects/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            project project = db.projects.Find(id);

            if (project == null)
            {
                return(HttpNotFound());
            }
            ViewBag.projectStatusID = new SelectList(db.projectStatus, "projectStatusID", "projectStatusName", project.projectStatusID);
            ViewBag.userID          = new SelectList(db.proUsers, "userID", "firstname", project.userID);
            return(View(project));
        }
        public ActionResult index(String describtion, String projectname, String pramter)
        {
            int     i = Int32.Parse(WelcomeController.Tempid);
            project p = new project();
            user    u = db.usertable.Find(Int32.Parse(WelcomeController.Tempid));

            p.Customer    = u;
            p.describtion = describtion;
            p.projectname = projectname;
            p.status      = "unsigned";
            db.projecttable.Add(p);
            db.SaveChanges();


            return(RedirectToAction("Index"));
        }
        public ActionResult Create()
        {
            ViewBag.CountryID = new SelectList(db.countries, "CountryID", "Name");
            ViewBag.UserID    = new SelectList(db.users.Where(x => x.Role == "admin" || x.Role == "publisher"), "UserID", "UserName");
            var model = new project();

            model.Date       = DateTime.Now;
            model.DateStart  = DateTime.Now;
            model.DateEnd    = DateTime.Now.AddDays(60);
            model.DateUpdate = DateTime.Now;
            model.Target     = 1000;
            model.Approved   = true;
            model.Enabled    = false;
            model.Image      = "https://s3-eu-west-1.amazonaws.com/localactors-webapp/projects/placeholder_project.png";
            return(View(model));
        }
示例#18
0
        // POST api/Projectsapi
        public HttpResponseMessage Postproject(project project)
        {
            if (ModelState.IsValid)
            {
                db.projects.Add(project);
                db.SaveChanges();

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, project);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = project.id }));
                return(response);
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }
        }
        public ActionResult EditNotDelivered(int id, String describtion, String projectname)
        {
            int     i = Int32.Parse(WelcomeController.Tempid);
            project x = db.projecttable.Find(id);

            x.describtion = describtion;
            x.projectname = projectname;
            if (TryUpdateModel(x))
            {
                db.SaveChanges();
            }



            return(RedirectToAction("CustomerProfile"));
        }
        public ActionResult Create()
        {
            ViewBag.CountryID = new SelectList(db.countries, "CountryID", "Name");

            var model = new project();

            model.UserID     = CurrentUser.UserID;
            model.Date       = DateTime.Now;
            model.DateStart  = DateTime.Now;
            model.DateEnd    = DateTime.Now.AddDays(60);
            model.DateUpdate = DateTime.Now;
            model.Target     = 1000;
            model.Image      = "https://s3-eu-west-1.amazonaws.com/localactors-webapp/projects/placeholder_project.png";

            return(View(model));
        }
        // GET: project/Details/5
        public ActionResult Details(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            project p = Pservice.GetById(id);



            if (p == null)
            {
                return(HttpNotFound());
            }
            return(View(p));
        }
示例#22
0
        // GET: projects/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            project project = db.projects.Find(id);

            if (project == null)
            {
                return(HttpNotFound());
            }
            ViewBag.categoryid = new SelectList(db.categories, "catid", "name", project.categoryid);
            ViewBag.clientid   = new SelectList(db.userdetails, "userid", "name", project.clientid);
            return(View(project));
        }
示例#23
0
        public ActionResult Addproject(project project)
        {
            if (ModelState.IsValid)
            {
                int id     = Convert.ToInt32(Session["ID"]);
                var writer = db.users.Where(model => model.Id == id).FirstOrDefault();
                project.user_id     = writer.Id;
                project.Post_Status = 0;
                db.projects.Add(project);
                db.SaveChanges();


                return(RedirectToAction("Index"));
            }
            return(View());
        }
示例#24
0
 public void ProcessRequest(HttpContext context)
 {
     if (context.Session["tea_id"] == null)
     {
         context.Response.Write("nologin");
     }
     else
     {
         if (context.Request["status"] == "del")
         {
             project project = new project()
             {
                 teacher_num  = context.Request["tea_num"],
                 project_name = context.Request["project_name"],
             };
             if (BLL.stuBll.tea_del_project(project) == true)
             {
                 context.Response.ContentType = "text/plain";
                 context.Response.Write("true");
             }
             else
             {
                 context.Response.ContentType = "text/plain";
                 context.Response.Write("false");
             }
         }
         else
         {
             project project = new project()
             {
                 teacher_num  = context.Request["tea_num"],
                 project_name = context.Request["project_name"],
                 project_info = context.Request["project_info"]
             };
             if (BLL.stuBll.tea_update_project(project) == true)
             {
                 context.Response.ContentType = "text/plain";
                 context.Response.Write("true");
             }
             else
             {
                 context.Response.ContentType = "text/plain";
                 context.Response.Write("false");
             }
         }
     }
 }
示例#25
0
        public JsonResult Add_Project(string name, string[] pics, string[] pic_ext)
        {
            mikroklimat.Classes.Db_Connection db_c = new Classes.Db_Connection();
            project pr = new project();

            pr.name     = name;
            pr.add_date = DateTime.Now;
            user add_us = db_c.mde.user.ToList().FirstOrDefault(x => x.username == User.Identity.Name);

            pr.add_user = add_us.id;

            db_c.mde.project.Add(pr);
            db_c.mde.SaveChanges();

            if (pics != null)
            {
                for (int i = 0; i < pics.Length; i++)
                {
                    string data       = @pics[i];
                    var    base64Data = Regex.Match(data, @"data:image/(?<type>.+?),(?<data>.+)").Groups["data"].Value;
                    var    binData    = Convert.FromBase64String(base64Data);

                    using (var stream = new MemoryStream(binData))
                    {
                        Bitmap img       = new Bitmap(stream);
                        string name_path = "/Content/img/large_" + pr.id + "_" + Guid.NewGuid() + pic_ext[i];
                        img.Save(Server.MapPath(name_path));

                        //Bitmap bm = new Bitmap(stream);
                        img = new Bitmap(stream);
                        mikroklimat.Classes.imgCrop icrop = new mikroklimat.Classes.imgCrop(ref img);
                        string s_name_path = "/Content/img/small_" + pr.id + "_" + Guid.NewGuid() + pic_ext[i];
                        //Image new_img = bm;
                        img.Save(Server.MapPath(s_name_path));

                        image db_img = new image();
                        db_img.path           = name_path;
                        db_img.small_img_path = s_name_path;
                        db_img.project_id     = pr.id;

                        db_c.mde.image.Add(db_img);
                        db_c.mde.SaveChanges();
                    }
                }
            }
            return(Json(new EmptyResult(), JsonRequestBehavior.AllowGet));
        }
    /// <summary>
    /// Creates a new project with given properties.
    /// Adds the new project to the database and sets it as active project.
    /// </summary>
    protected void CreateNewProject(string projectName, string projectDesc, string githubUser, string githubRepo)
    {
        try
        {
            project newProject = new project
            {
                name            = projectName,
                description     = projectDesc,
                github_username = githubUser,
                github_reponame = githubRepo
            };

            // Add project to DB
            if (!Database.AddProject(newProject))
            {
                lblMessages.Text = "Project named '" + newProject.name + "' already exists!";
            }

            // Add project to currently logged in user
            if (Session["LoggedUser"] != null)
            {
                string loggedUser = Session["LoggedUser"].ToString();
                Database.AddProjectToUser(loggedUser, newProject.id);
            }

            // Make the user admin of the project
            if (Session["LoggedUserId"] != null)
            {
                int userId = Convert.ToInt32(Session["LoggedUserId"]);
                Database.AddRoleForUserToProject("admin", userId, newProject.id);
            }

            // User wants project to be public -> add it to default-user
            if (!cbPrivateProject.Checked)
            {
                Database.AddProjectToUser("Default", newProject.id);
            }

            Session["ActiveProject"] = newProject.id;
            Response.Redirect("Home.aspx", true);
        }
        catch (Exception ex)
        {
            lblMessages.Text = ex.Message;
        }
    }
        // delete
        public project delete(int id)
        {
            if (!(checkRight(main.Enums.rights.deleteProject)))
            {
                throw new serviceException("Bu projeyi silmeye yetkiniz bulunmamaktadır.");
            }
            project project = get(id);

            if (project == null)
            {
                throw new serviceException("Boyle bir proje bulunamadı");
            }
            project.isdeleted             = true;
            _context.Entry(project).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            _context.SaveChanges();
            return(project);
        }
示例#28
0
        public ActionResult Index(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var project_equipment = db.project_equipment.Include(pe => pe.project).Include(pe => pe.equipment).Where(pe => pe.projectID == id).ToList();

            if (project_equipment == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ID = id;
            project pr = db.projects.Find(id);

            if (pr.executorID != null)
            {
                ViewBag.ExecutorName     = pr.contact1.name;
                ViewBag.ExecutorLastname = pr.contact1.lastname;
            }
            if (pr.placeID != null)
            {
                ViewBag.Place = pr.place.name;
            }
            if (pr.start != null)
            {
                ViewBag.Start = @Convert.ToDateTime(pr.start).ToString("dd.MM.yyyy hh:mm");
            }
            if (Request.Cookies.Get("id") != null)
            {
                if (((FormsIdentity)User.Identity).Ticket.UserData == "admin" || pr.createrID == null || pr.createrID.ToString() == Request.Cookies.Get("id").Value)
                {
                    ViewBag.Hide = "no";
                }
                else
                {
                    ViewBag.Hide = "yes";
                }
            }
            else
            {
                ViewBag.Hide = "yes";
            }

            return(View(project_equipment));
        }
        public ActionResult Edit(int id, project p)
        {
            if (!ModelState.IsValid)
            {
                return(EditDetails());
            }

            if (ModelState.IsValid)
            {
                Pservice.Update(p);
                Pservice.commit();
                Pservice.Dispose();

                return(RedirectToAction("Index"));
            }
            return(View(p));
        }
示例#30
0
        public project Save(project project)
        {
            Project proj = new Project();

            proj = _itemRepository.GetById((int)project.ProjectId);
            if (proj == null)
            {
                Project newProject = new Project();
                newProject.Name                 = project.Name;
                newProject.Code                 = project.Code;
                newProject.CreatedByUserId      = 2;
                newProject.CreatedDateTime      = DateTime.UtcNow;
                newProject.CustomerId           = project.CustomerId;
                newProject.Description          = project.Description;
                newProject.EndDate              = DateTime.Parse(project.EndDate);
                newProject.LastModifiedByUserId = 2;
                newProject.LastModifiedDateTime = DateTime.UtcNow;
                newProject.ModelId              = project.ModelId;
                newProject.State                = project.State;
                newProject.Status               = 1;
                newProject.TechnologyId         = project.TechnologyId;
                newProject.ProposalId           = project.ProposalId;
                newProject.StartDate            = DateTime.Parse(project.StartDate);
                _itemRepository.Add(newProject);
            }
            else
            {
                proj.Name            = project.Name;
                proj.Code            = project.Code;
                proj.CreatedByUserId = project.CreatedByUserId;

                proj.CustomerId           = project.CustomerId;
                proj.Description          = project.Description;
                proj.EndDate              = DateTime.Parse(project.EndDate);
                proj.LastModifiedByUserId = project.LastModifiedByUserId;
                proj.LastModifiedDateTime = DateTime.UtcNow;
                proj.ModelId              = project.ModelId;
                proj.State        = project.State;
                proj.Status       = 1;
                proj.TechnologyId = project.TechnologyId;
                proj.ProposalId   = project.ProposalId;
                proj.StartDate    = DateTime.Parse(project.StartDate);
                _itemRepository.Update(proj);
            }
            return(project);
        }
示例#31
0
        public ActionResult Edit(int id)
        {
            project cls = null;

            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://localhost:18080");

            HttpResponseMessage response = client.GetAsync("http://localhost:18080/MapLevio-web/rest/projets/" + id.ToString()).Result;

            if (response.IsSuccessStatusCode)
            {
                cls = response.Content.ReadAsAsync <project>().Result;
            }

            return(View(cls));
        }
示例#32
0
        public void ProcessRequest(HttpContext context)
        {
            //string tea= context.Response[""]
            project project = new project()
            {
                teacher_num = context.Request["tea_num"]
            };
            StringBuilder jsonStr = new StringBuilder();

            jsonStr.Append("[");
            DataSet ds = BLL.stuBll.tea_select_project(project);

            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    jsonStr.Append("{");
                    for (int j = 0; j < ds.Tables[0].Columns.Count; j++)
                    {
                        if (j != ds.Tables[0].Columns.Count - 1)
                        {
                            jsonStr.Append("\"" + ds.Tables[0].Columns[j].ToString() + "\":\"" + ds.Tables[0].Rows[i][j].ToString() + "\",");
                        }
                        else
                        {
                            if (i == ds.Tables[0].Rows.Count - 1)
                            {
                                jsonStr.Append("\"" + ds.Tables[0].Columns[j].ToString() + "\":\"" + ds.Tables[0].Rows[i][j].ToString() + "\"}");
                            }
                            else
                            {
                                jsonStr.Append("\"" + ds.Tables[0].Columns[j].ToString() + "\":\"" + ds.Tables[0].Rows[i][j].ToString() + "\"},");
                            }
                        }
                    }
                }
                jsonStr.Append("]");
                context.Response.ContentType = "text/plain";
                context.Response.Write(jsonStr.ToString());
            }
            else
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write("");
            }
        }
示例#33
0
        public static List <MembershipUser> GetProjectManagers(project this_project)
        {
            List <MembershipUser> managers         = new List <MembershipUser>();
            List <projects_user>  project_managers = (from project_user in bug_tracker.projects_users
                                                      join user in bug_tracker.aspnet_Users on project_user.user_id equals user.UserId
                                                      join user_role in bug_tracker.aspnet_UsersInRoles on user.UserId equals user_role.UserId
                                                      join roles in bug_tracker.aspnet_Roles on user_role.RoleId equals roles.RoleId
                                                      where project_user.project_id == this_project.id && roles.RoleName == "Project Manager"
                                                      select project_user).Distinct().ToList();

            foreach (projects_user manager in project_managers)
            {
                managers.Add(Membership.GetUser(manager.user_id));
            }

            return(managers);
        }
示例#34
0
 private void btnDelete_Click(object sender)
 {
     try
     {
         if (MessageBox.Show("Are you sure want to Delete?", "Cognitivo", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
         {
             project project = (project)ProjectDataGrid.SelectedItem;
             project.is_head    = false;
             project.State      = EntityState.Deleted;
             project.IsSelected = true;
         }
     }
     catch (Exception ex)
     {
         toolBar.msgError(ex);
     }
 }
 public string DelProject(ProjectDto projectDto) //Aldığı projectDto yla eşleşen projeyi silen servis.
 {
     using (UnitOfWorkPattern unitOf = new UnitOfWorkPattern())
     {
         project pr = unitOf.RepositoryPattern <project>().Get(projectDto.Id); // Id ile eşleşen project tipinde dönen veri
         if (pr != null)                                                       //eğer yukarıdaki satırda uygun eşleşme bulunamazsa delete işlemi yapılmaz.Else satırına düşer.
         {
             unitOf.RepositoryPattern <project>().Delete(pr);                  //Delete işlemi.
             unitOf.Save();                                                    //Delete işlemi kayıt kısmı.
             return("Kayıt silindi");
         }
         else
         {
             return("Kayıt bulunamadı");
         }
     }
 }
示例#36
0
        private static List <projectDetails> getProjects(inputs theInputs)
        {
            // get all the projects in the org
            string url = $"https://dev.azure.com/{theInputs.Org}/_apis/projects?api-version=5.1";

            string response = RunGetAPI(theInputs.Pat, url);

            if (!string.IsNullOrEmpty(response))
            {
                project ret = JsonConvert.DeserializeObject <project>(response);
                return(ret.value);
            }
            else
            {
                return(null);
            }
        }
示例#37
0
        public void test_NewProjectPostShouldReturnProjectResource()
        {
            project project = new project {
                name = "test",
                active = true,
                bill_by = "none",
                client_id = 0,
                code = "999",
                notes = "test notes",
                budget = 100,
                budget_by = "none"
            };

            var result = harvest.CreateNewProject(project);
            Assert.IsNotNull(result);
            Assert.IsTrue(result);
            Assert.IsInstanceOfType(result, typeof(bool));
        }
示例#38
0
 partial void Insertproject(project instance);
示例#39
0
 // 数据绑定
 private void RptBind()
 {
     HyCommon HyCommon = new HyCommon();
     //获取当前页数
     if (this.Request.QueryString["page"] != null)
     {
         this.page = int.Parse(HyCommon.Filter(this.Request.QueryString["page"].ToString()));
     }
     this.txtPageNum.Text = this.pageSize.ToString();
     project dtExpert = new project();
     string strWhere = "";
     if (this.txtNmae.Text.Trim() != "")
     {
         strWhere += "  and projectNmae like '%" + this.txtNmae.Text.Trim() + "%'";
     }
     //获取数据
     DataSet dt = dtExpert.GetDataPage(this.pageSize, this.page, strWhere);
     //获取数据条数
     this.totalCount = dtExpert.GetList(strWhere).Tables[0].Rows.Count;
     this.lblcount.Text = totalCount.ToString();
     rptList.DataSource = dt;
     rptList.DataBind();
     //地址传递数据
     string pageUrl = HyCommon.CombUrlTxt(ls_url, "page={0}&rnd={1}&txtNmae={2}", "__id__", System.Guid.NewGuid().ToString(), this.txtNmae.Text);
     PageContent.InnerHtml = HyCommon.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
 }
示例#40
0
        private void butSave_Click_1(object sender, EventArgs e)
        {
            //http://207.46.16.248/en-us/library/MySql.Data.MySqlClient.sqlclientmetadatacollectionnames_fields%28VS.100%29.aspx

            //return DialogResult.OK;

            // search metadata...
            Thread t = new Thread(new ParameterizedThreadStart(search));
            // we need to pass data through object
            //project pro = new project();
            if (pr == null)
                pr = new project();

            pr.name = txtName.Text;
            pr.host = txtHost.Text;
            pr.database = txtDatabase.Text;
            pr.user = txtUser.Text;
            pr.password = txtPassword.Text;
            pr.dbDataType = (project.databaseType)cmbDataType.SelectedItem;

            //project.databaseType tipo = new project.databaseType();
            //tipo = (project.databaseType)cmbDataType.SelectedItem;

            //pro.dbDataType = cmbDataType.SelectedItem;

            // clear data
            pr.tables.Clear();
            pr.relations.Clear();

            t.Start(pr);

            // this.DialogResult = DialogResult.Yes;

            //MessageBox.Show("Hand message", "Hand title", MessageBoxButtons.OK, MessageBoxIcon.Hand);
        }
示例#41
0
 /// <summary>
 /// Loads a project into the tree view
 /// </summary>
 /// <param name="Dir"></param>
 private void LoadProject(DirectoryInfo Dir)
 {
     // Create new listItem
     SPListItem d = AddItem(Dir.Name,new Uri( "spotdev:project:"+Dir.Name+":overview"));
     d.Icon = Resources.spotifyapp;
     String path = "";
     ListDirectory(Dir.Name, Dir, d, ref path);
     project c = new project();
     c.title = Dir.Name;
     c.identifier = Dir.Name;
     projects.Add(c);
 }
示例#42
0
    public void saveProject(string filename)
    {
        try
        {
            // Create an instance of the XmlSerializer class;
            // specify the type of object to serialize.
            XmlSerializer serializer = new XmlSerializer(typeof(project));
            TextWriter writer = new StreamWriter(filename);
            project po = new project();
            po = this;

            // Serialize and close the TextWriter.
            serializer.Serialize(writer, po);
            writer.Close();
        }
        catch (Exception ex)
        {

            throw;
        }
    }
示例#43
0
        private void Form1_FormClosed(object sender, FormClosedEventArgs e)
        {
            try
            {
                project pr = new project();
                pr = general.actualProject;
                pr.templateSelectedFullUri = general.templateSelectedFullUri;

                String tableSelected = cmbTablesx.Text;
                foreach (table item in general.actualProject.tables)
                {
                    string numberoffields = item.fields.Count.ToString();
                    if (item.Name.Equals(tableSelected))
                        pr.actualTable = item;
                }
                //confi.actualTable = actualTable;

                pr.templateSelected = general.templateSelected;
                pr.templateSelectedFullUri = general.templateSelectedFullUri;

                pr.targetDirectory = general.targetDirectory;

                // save the project template from the listbox
                if (lbProjectTemplate.Items.Count != 0 )
                {
                    string pt = lbProjectTemplate.SelectedItem.ToString();
                    foreach (projectconfigfiles item in ctes.listaProjectConfigFiles)
                    {
                        if (item.Name == pt)
                        {
                            pr.projectTemplatesDirectory = item.Directory;
                        }
                    }

                    pr.projectTemplatesDirectorySmall = pt;

                }
                //pr.projectTemplatesDirectory = general.projectTemplateSelectedFullUri;
                //pr.projectTemplatesDirectorySmall = general.projectTemplateSelected;

                pr.saveProject(Path.Combine(util.conf_dir, "conf.xml"));
                pr.saveProject(Path.Combine(util.projects_dir, general.actualProject.name) + ".xml");

            }
            catch (Exception)
            {

                //throw;
            }
        }
示例#44
0
 partial void Deleteproject(project instance);
示例#45
0
 partial void Updateproject(project instance);
    protected void btn_save_Click(object sender, EventArgs e)
    {
        project project = new project();
        project.id = System.Guid.NewGuid().ToString();
        project.projectNmae = this.txtName.Value;
        project.investorID = "";
        project.inveestorNmae = "";
        project.publishID = "";
        project.publishName = "";
        project.publishTime = DateTime.Now;
        project.projectAdress = this.txtPath.Value;
        project.projcetSummary = this.txtDetail.Value;
        project.projcetKeyword = this.txtKeyWords.Value;
        string strCheckValue = "";
        if (getCheckBox(this.ck_net) != "")
        {
            strCheckValue += getCheckBox(this.ck_net) + "#";
        }
        if (getCheckBox(this.ck_move) != "")
        {
            strCheckValue += getCheckBox(this.ck_move) + "#";
        }
        if (getCheckBox(this.ck_medicene) != "")
        {
            strCheckValue += getCheckBox(this.ck_medicene) + "#";
        }
        if (getCheckBox(this.ck_finance) != "")
        {
            strCheckValue += getCheckBox(this.ck_finance) + "#";
        }
        if (getCheckBox(this.ck_education) != "")
        {
            strCheckValue += getCheckBox(this.ck_education) + "#";
        }
        if (getCheckBox(this.ck_equipment) != "")
        {
            strCheckValue += getCheckBox(this.ck_equipment) + "#";
        }
        if (getCheckBox(this.ck_furniture) != "")
        {
            strCheckValue += getCheckBox(this.ck_furniture) + "#";
        }
        if (getCheckBox(this.ck_energy) != "")
        {
            strCheckValue += getCheckBox(this.ck_energy) + "#";
        }
        if (getCheckBox(this.ck_agriculture) != "")
        {
            strCheckValue += getCheckBox(this.ck_agriculture) + "#";
        }
        if (getCheckBox(this.ck_others) != "")
        {
            strCheckValue += getCheckBox(this.ck_others) + "#";
        }

        project.industry = strCheckValue;
        project.projectDetail = this.txtProjectDetail.Value;
        project.financing = Convert.ToDecimal(this.txtAmount.Value);
        project.phoneNumber = this.txtPhone.Value;
        project.eamil = this.txtEmail.Value;
        project.video = this.txtMoviePath.Value;
        project.teamDetail = this.txtdt_summary.Value;
        project.ifHot = false;
        project.projectState = "发布";
        project.Add();
        Response.Write("<script>alert('发布项目成功!');</script>");
    }
示例#47
0
 private void newProject_Load(object sender, EventArgs e)
 {
     pr = new project();
 }
示例#48
0
 private void launcher_Load(object sender, EventArgs e)
 {
     // vemos si existe un conf.xml o ultimo proyecto utilizado...
     project pr = new project();
     pr = project.loadProject(Path.Combine(util.conf_dir, "conf.xml"));
     if (pr != null)
     {
         general.actualProject = pr;
         this.Text = "myWay " + pr.name;
     }
     loadControls();
 }
示例#49
0
 // return the name of the keyField of the parent table from a foreign key
 public table getFTByFK(project pr, string fieldName)
 {
     foreach (table item in pr.GetTables)
     {
         if (item.GetKey.ToLower().Equals(fieldName.ToLower()))
             return item;
     }
     return null;
 }
示例#50
0
        public IHttpActionResult Postproject(project project)
        {
            project.pdate = DateTime.Now;
            project.employee_eid = q.GetUserId();

            db.projects.Add(project);

            db.SaveChanges();

            project_messages pm = new project_messages();

            pm.project_pid = project.pid;
            pm.projectmessage = "*** Verkefni stofnað ***";
            pm.messagetimestamp = DateTime.Now;
            pm.employee_eid = q.GetUserId();

            db.project_messages.Add(pm);
            db.SaveChanges();

            return CreatedAtRoute("DefaultApi", new { id = project.pid }, project);
        }
示例#51
0
        private void search(object file)
        {
            bool right = false;
            string errorMessage = "";
            AsyncEnableButton(false);
            try
            {
                project pro = new project();
                pro = (project)file;

                Cursor.Current = Cursors.WaitCursor;

                switch (pro.dbDataType)
                {
                    case project.databaseType.mySql:
                        String connectionString = null;

                        connectionString = "Server=" + pr.host + ";Database=" + pr.database + ";Uid=" + pr.user + ";Pwd=" + pr.password + ";";

                        dbMySql db = new dbMySql();
                        errorMessage = db.test(connectionString);
                        if (errorMessage.Equals(""))
                        {
                            AsyncWrite("");
                            AsyncWriteLine("Success connection \n");
                            //pr = new project();
                            //pr.name = pr.name;

                            // lets get the tables...
                            List<table> lista = new List<table>();
                            lista = db.getTables(connectionString, pr.database);
                            //lista.Sort();
                            pr.tables.Clear();
                            foreach (table item in lista)
                            {
                                AsyncWriteLine("Found table... " + item.Name + "\n");

                                // now lets get the fields for each table...
                                List<field> listaField = new List<field>();
                                listaField = db.getFields(connectionString, pr.database, item.Name);

                                if (listaField != null)
                                {
                                    foreach (field fi in listaField)
                                    {
                                        item.fields.Add(fi);
                                        AsyncWriteLine("Found field... " + fi.Name + "\n");
                                    }

                                    // the descriptionField its the first string field of table...
                                    foreach (field campito in listaField)
                                    {
                                        if (campito.type.ToString().Equals("_string") || campito.type.ToString().Equals("_text"))
                                        {
                                            item.fieldDescription = campito.Name;
                                            break;
                                        }
                                    }
                                    if (item.fieldDescription == null)
                                        item.fieldDescription = listaField[0].Name;
                                }

                                // lets get primary keys and foreign keys for the table...
                                db.getKeys(connectionString, item, pr.database);

                                // lets sort the fields in the table...
                                // we order but put first key fields
                                if (general.orderFields)
                                {
                                    item.fields.Sort(new compareFields(compareFields.CompareByOptions.name));
                                    item.fields.Sort(new compareFields(compareFields.CompareByOptions.key));
                                }

                                pr.tables.Add(item);

                            }

                            pr.tables.Sort();

                            //// now lets get the relations ...
                            pr.relations.Clear();
                            List<relation> listarelation = new List<relation>();
                            listarelation = db.getRelations(connectionString, pr.database);
                            if (listarelation != null)
                            {

                                foreach (relation re in listarelation)
                                {
                                    // found description of fields...
                                    foreach (table item in pr.tables)
                                    {
                                        if (item.Name.ToLower().Equals(re.childTable.ToLower()))
                                        {
                                            re.childDescription = item.fieldDescription;
                                            // we put the field as keyfield...
                                            foreach (field fi in item.fields)
                                            {
                                                if (fi.Name.ToLower().Equals(re.childField.ToLower()))
                                                    fi.isForeignKey = true;
                                            }
                                        }

                                        if (item.Name.ToLower().Equals(re.parentTable.ToLower()))
                                            re.parentDescription = item.fieldDescription;
                                    }

                                    if (!pr.existsRelation(re.parentTable, re.childTable))
                                    {
                                        pr.relations.Add(re);
                                        AsyncWriteLine("Found relation... " + re.name + "\n");
                                    }

                                    // now if the relation has to do with the tables...
                                    foreach (table item in pr.tables)
                                    {
                                        // we put the relation in the child table...
                                        if (item.Name.ToLower().Equals(re.childTable.ToLower()))
                                            item.relations.Add(re);
                                    }

                                }

                            }

                            // also we can get relations about the field names
                            foreach (table tab in pr.tables)
                            {
                                foreach (field campo in tab.fields)
                                {
                                    if (campo.isKey)
                                    {
                                        foreach (table tab2 in pr.tables)
                                        {
                                            if (!tab.Name.ToLower().Equals(tab2.Name.ToLower()))
                                            {
                                                foreach (field campo2 in tab2.fields)
                                                {
                                                    if (campo.Name.ToLower().Equals(campo2.Name.ToLower()))
                                                    {
                                                        // check if relation exists..
                                                        if (!pr.existsRelation(tab.Name, tab2.Name))
                                                        {
                                                            campo2.isForeignKey = true;
                                                            relation rel = new relation();
                                                            rel.name = tab2.Name + "_" + tab.Name;

                                                            bool found = false;
                                                            foreach (relation relax in pr.relations)
                                                            {
                                                                if (relax.name.Equals(rel.name))
                                                                    found = true;
                                                            }
                                                            if (!found)
                                                            {
                                                                rel.parentTable = tab.Name;
                                                                rel.parentField = campo.Name;

                                                                rel.childTable = tab2.Name;
                                                                rel.childField = campo2.Name;

                                                                // found description of fields...
                                                                foreach (table item in pr.tables)
                                                                {
                                                                    if (item.Name.ToLower().Equals(rel.childTable.ToLower()))
                                                                        rel.childDescription = item.fieldDescription;

                                                                    if (item.Name.ToLower().Equals(rel.parentTable.ToLower()))
                                                                        rel.parentDescription = item.fieldDescription;
                                                                }

                                                                pr.relations.Add(rel);

                                                                // now if the relation has to do with the tables...
                                                                foreach (table item in pr.tables)
                                                                {
                                                                    if (item.Name.Equals(tab2.Name))
                                                                        item.relations.Add(rel);
                                                                }
                                                            }

                                                        }

                                                    }
                                                }
                                            }

                                        }
                                    }
                                }
                            }

                            right = true;
                            pr.host = pro.host;
                            pr.database = pro.database;
                            pr.user = pro.user;
                            pr.password = pro.password;
                            pr.dbDataType = pro.dbDataType;

                            //pr.saveProject(Path.Combine(util.projects_dir, pro.name + ".xml"));

                            // lets save it for next load of application...
                            // pr.saveProject(Path.Combine(util.projects_dir, "conf.xml"));
                            //  AsyncWriteLine("Project saved... \n");

                        }
                        else
                        {
                            AsyncWrite(errorMessage);
                        }
                        break;

                    case project.databaseType.SqlServer:

                        connectionString = "Data Source=" + pro.host + ";Network Library=DBMSSOCN;Initial Catalog=" + pro.database + ";User ID=" + pro.user + ";Password="******";";
                        // connectionStringOleDb = "Provider=SQLNCLI;Server=" + txtHost.Text + ";Database=" + txtDatabase.Text + ";Uid=" + txtUser.Text + ";Pwd=" + txtPassword.Text + ";";

                        dbSql2005 dbSqlServer = new dbSql2005();
                        errorMessage = dbSqlServer.test(connectionString);
                        if (errorMessage.Equals(""))
                        {
                            AsyncWrite("");
                            AsyncWriteLine("Success connection \n");
                            //pr = new project();
                            //pr.name = pro.name;

                            // lets get the tables...
                            List<table> lista = new List<table>();
                            lista = dbSqlServer.getTables(connectionString, pro.database);
                            //lista.Sort();
                            foreach (table item in lista)
                            {
                                AsyncWriteLine("Found table... " + item.Name + "\n");

                                // now lets get the fields for each table...
                                List<field> listaField = new List<field>();
                                listaField = dbSqlServer.getFields(connectionString, item.Name);
                                if (listaField != null)
                                {
                                    foreach (field fi in listaField)
                                    {
                                        item.fields.Add(fi);
                                        AsyncWriteLine("Found field... " + fi.Name + "\n");
                                    }

                                    // the descriptionField its the first string field of table...
                                    foreach (field campito in listaField)
                                    {
                                        if (campito.type.ToString().Equals("_string") || campito.type.ToString().Equals("_text"))
                                        {
                                            item.fieldDescription = campito.Name;
                                            break;
                                        }
                                    }
                                    if (item.fieldDescription == null)
                                        item.fieldDescription = listaField[0].Name;

                                }

                                // lets get primary keys and foreign keys for the table...
                                dbSqlServer.getKeys(connectionString, item);
                                // lets get not primary keys
                                foreach (field campito in item.fields)
                                {
                                    if (!campito.isKey)
                                        item.getNotKeyFields.Add(campito);
                                }

                                // lets sort the fields in the table...
                                // we order but put first key fields
                                if (general.orderFields)
                                {
                                    item.fields.Sort(new compareFields(compareFields.CompareByOptions.name));
                                    item.fields.Sort(new compareFields(compareFields.CompareByOptions.key));
                                }
                                pr.tables.Add(item);

                                // lets get description of table
                                string DescriptionOfTable = "";
                                DescriptionOfTable = dbSqlServer.getCommentsFromTable(connectionString, item.Name);
                                if (DescriptionOfTable.IndexOf("#exclude#") != -1)
                                {
                                    item.excludeFromGeneration = true;
                                    DescriptionOfTable.Replace("#exclude#", "");
                                }
                                if (!DescriptionOfTable.Equals(""))
                                    item.TargetName = DescriptionOfTable;

                                // end of description for table

                            }

                            pr.tables.Sort();
                            // now lets get the relations ...
                            List<relation> listarelation = new List<relation>();
                            listarelation = dbSqlServer.getRelations(connectionString);
                            if (listarelation != null)
                            {
                                foreach (relation re in listarelation)
                                {
                                    //  item.fields.Add(re);
                                    pr.relations.Add(re);
                                    AsyncWriteLine("Found relation... " + re.name + "\n");

                                    // now if the relation has to do with the tables...
                                    foreach (table item in pr.tables)
                                    {
                                        // we put the relation in the parent table...
                                        if (item.Name.ToLower().Equals(re.parentTable.ToLower()))
                                        {
                                            // le añadimos la descripcion
                                            re.parentDescription = item.fieldDescription;

                                            foreach (table taby in pr.tables)
                                            {
                                                if (taby.Name.Equals(re.childTable))
                                                    re.childDescription = taby.fieldDescription;
                                            }
                                            item.relations.Add(re);
                                        }
                                    }

                                }

                            }

                            // also we can get relations about the field names
                            foreach (table tab in pr.tables)
                            {
                                foreach (field campo in tab.fields)
                                {
                                    if (campo.isKey)
                                    {
                                        foreach (table tab2 in pr.tables)
                                        {
                                            if (!tab.Name.ToLower().Equals(tab2.Name.ToLower()))
                                            {
                                                foreach (field campo2 in tab2.fields)
                                                {
                                                    if (campo.Name.ToLower().Equals(campo2.Name.ToLower()))
                                                    {
                                                        campo2.isForeignKey = true;
                                                        relation rel = new relation();
                                                        rel.name = tab.Name + "_" + tab2.Name;
                                                        if (!pr.relations.Contains(rel.name))
                                                        {
                                                            rel.parentTable = tab2.Name;
                                                            rel.parentField = campo2.Name;

                                                            rel.childTable = tab.Name;
                                                            rel.childField = campo.Name;

                                                            // found description of fields...
                                                            foreach (table item in pr.tables)
                                                            {
                                                                if (item.Name.ToLower().Equals(rel.childTable.ToLower()))
                                                                    rel.childDescription = item.fieldDescription;

                                                                if (item.Name.ToLower().Equals(rel.parentTable.ToLower()))
                                                                    rel.parentDescription = item.fieldDescription;
                                                            }

                                                            pr.relations.Add(rel);

                                                            // now if the relation has to do with the tables...
                                                            foreach (table item in pr.tables)
                                                            {
                                                                if (item.Name.Equals(tab2.Name))
                                                                {
                                                                    // see if the relation exists..
                                                                    bool seguir = true;
                                                                    foreach (relation rel2 in tab2.relations)
                                                                    {
                                                                        if (rel2.name.ToLower().Equals(rel.name.ToLower()))
                                                                            seguir = false;
                                                                    }
                                                                    if (seguir)
                                                                        item.relations.Add(rel);
                                                                }

                                                            }
                                                        }

                                                    }
                                                }
                                            }

                                        }
                                    }
                                }
                            }

                            right = true;
                            pr.host = pro.host;
                            pr.database = pro.database;
                            pr.user = pro.user;
                            pr.password = pro.password;
                            pr.dbDataType = pro.dbDataType;

                            //pr.saveProject(Path.Combine(util.projects_dir, pro.name + ".xml"));

                            // lets save it for next load of application...
                            // pr.saveProject(Path.Combine(util.projects_dir, "conf.xml"));
                            //AsyncWriteLine("Project saved... \n");

                        }
                        else
                        {
                            AsyncWrite(errorMessage);
                        }

                        break;

                    case project.databaseType.dbf:

                           connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pro.database + ";Extended Properties=dBASE IV;User ID=" + pro.user + ";Password="******";";

                        dbDbf dbf = new dbDbf();
                        errorMessage = dbf.test(connectionString);
                        if (errorMessage.Equals(""))
                        {
                            AsyncWrite("");
                            AsyncWriteLine("Success connection \n");
                            //pr = new project();
                            //pr.name = pro.name;

                            // lets get the tables...
                            List<table> lista = new List<table>();
                            lista = dbf.getTables(connectionString, pro.database);
                            //lista.Sort();
                            foreach (table item in lista)
                            {
                                AsyncWriteLine("Found table... " + item.Name + "\n");

                                // now lets get the fields for each table...
                                List<field> listaField = new List<field>();
                                listaField = dbf.getFields(connectionString, item.Name);
                                if (listaField != null)
                                {
                                    foreach (field fi in listaField)
                                    {
                                        item.fields.Add(fi);
                                        AsyncWriteLine("Found field... " + fi.Name + "\n");
                                    }

                                    // the descriptionField its the first string field of table...
                                    foreach (field campito in listaField)
                                    {
                                        if (campito.type.ToString().Equals("_string") || campito.type.ToString().Equals("_text"))
                                        {
                                            item.fieldDescription = campito.Name;
                                            break;
                                        }
                                    }
                                    if (item.fieldDescription == null)
                                        item.fieldDescription = listaField[0].Name;

                                }

                                // lets get primary keys and foreign keys for the table...
                                dbf.getKeys(connectionString, item);

                                // lets sort the fields in the table...
                                // we order but put first key fields
                                if (general.orderFields)
                                {
                                    item.fields.Sort(new compareFields(compareFields.CompareByOptions.name));
                                    item.fields.Sort(new compareFields(compareFields.CompareByOptions.key));
                                }
                                pr.tables.Add(item);

                            }

                            pr.tables.Sort();
                            // now lets get the relations ...
                            List<relation> listarelation = new List<relation>();
                            listarelation = dbf.getRelations(connectionString);
                            if (listarelation != null)
                            {
                                foreach (relation re in listarelation)
                                {
                                    //  item.fields.Add(re);
                                    pr.relations.Add(re);
                                    AsyncWriteLine("Found relation... " + re.name + "\n");

                                    // now if the relation has to do with the tables...
                                    foreach (table item in pr.tables)
                                    {
                                        // we put the relation in the parent table...
                                        if (item.Name.ToLower().Equals(re.parentTable.ToLower()))
                                        {
                                            // le añadimos la descripcion
                                            re.parentDescription = item.fieldDescription;

                                            foreach (table taby in pr.tables)
                                            {
                                                if (taby.Name.Equals(re.childTable))
                                                    re.childDescription = taby.fieldDescription;
                                            }
                                            item.relations.Add(re);
                                        }
                                    }

                                }

                            }

                            // also we can get relations about the field names
                            foreach (table tab in pr.tables)
                            {
                                foreach (field campo in tab.fields)
                                {
                                    if (campo.isKey)
                                    {
                                        foreach (table tab2 in pr.tables)
                                        {
                                            if (!tab.Name.ToLower().Equals(tab2.Name.ToLower()))
                                            {
                                                foreach (field campo2 in tab2.fields)
                                                {
                                                    if (campo.Name.ToLower().Equals(campo2.Name.ToLower()))
                                                    {
                                                        campo2.isForeignKey = true;
                                                        relation rel = new relation();
                                                        rel.name = tab.Name + "_" + tab2.Name;
                                                        if (!pr.relations.Contains(rel.name))
                                                        {
                                                            rel.parentTable = tab2.Name;
                                                            rel.parentField = campo2.Name;

                                                            rel.childTable = tab.Name;
                                                            rel.childField = campo.Name;

                                                            // found description of fields...
                                                            foreach (table item in pr.tables)
                                                            {
                                                                if (item.Name.ToLower().Equals(rel.childTable.ToLower()))
                                                                    rel.childDescription = item.fieldDescription;

                                                                if (item.Name.ToLower().Equals(rel.parentTable.ToLower()))
                                                                    rel.parentDescription = item.fieldDescription;
                                                            }

                                                            pr.relations.Add(rel);

                                                            // now if the relation has to do with the tables...
                                                            foreach (table item in pr.tables)
                                                            {
                                                                if (item.Name.Equals(tab2.Name))
                                                                {
                                                                    // see if the relation exists..
                                                                    bool seguir = true;
                                                                    foreach (relation rel2 in tab2.relations)
                                                                    {
                                                                        if (rel2.name.ToLower().Equals(rel.name.ToLower()))
                                                                            seguir = false;
                                                                    }
                                                                    if (seguir)
                                                                        item.relations.Add(rel);
                                                                }

                                                            }
                                                        }

                                                    }
                                                }
                                            }

                                        }
                                    }
                                }
                            }

                            right = true;
                            pr.host = pro.host;
                            pr.database = pro.database;
                            pr.user = pro.user;
                            pr.password = pro.password;
                            pr.dbDataType = pro.dbDataType;

                        }
                        else
                        {
                            AsyncWriteLine(errorMessage);
                        }
                        break;

                    case project.databaseType.access2003:

                        connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pro.database + ";User ID=" + pro.user + ";Password="******";";

                        dbAccess dba2003 = new dbAccess();
                        errorMessage = dba2003.test(connectionString);
                        if (errorMessage.Equals(""))
                        {
                            AsyncWrite("");
                            AsyncWriteLine("Success connection \n");
                            //pr = new project();
                            //pr.name = pro.name;

                            // lets get the tables...
                            List<table> lista = new List<table>();
                            lista = dba2003.getTables(connectionString, pro.database);
                            //lista.Sort();
                            foreach (table item in lista)
                            {
                                AsyncWriteLine("Found table... " + item.Name + "\n");

                                // now lets get the fields for each table...
                                List<field> listaField = new List<field>();
                                listaField = dba2003.getFields(connectionString, item.Name);
                                if (listaField != null)
                                {
                                    foreach (field fi in listaField)
                                    {
                                        item.fields.Add(fi);
                                        AsyncWriteLine("Found field... " + fi.Name + "\n");

                                    }

                                }

                                // lets get primary keys and foreign keys for the table...
                                dba2003.getKeys(connectionString, item);

                                // now we search a text field that is not key
                                if (listaField != null)
                                {
                                    // the descriptionField its the first string field of table...
                                    foreach (field campito in listaField)
                                    {
                                        if (campito.type.ToString().Equals("_string") && !campito.isKey)
                                        {
                                            item.fieldDescription = campito.Name;
                                            break;
                                        }

                                    }

                                }
                                if (item.fieldDescription == null)
                                    item.fieldDescription = item.GetKey;

                                // lets sort the fields in the table...
                                // we order but put first key fields
                                if (general.orderFields)
                                {
                                    item.fields.Sort(new compareFields(compareFields.CompareByOptions.name));
                                    item.fields.Sort(new compareFields(compareFields.CompareByOptions.key));
                                }
                                pr.tables.Add(item);

                            }

                            pr.tables.Sort();
                            // now lets get the relations ...
                            List<relation> listarelation = new List<relation>();
                            listarelation = dba2003.getRelations(connectionString);
                            if (listarelation != null)
                            {
                                foreach (relation re in listarelation)
                                {
                                    //  item.fields.Add(re);
                                    pr.relations.Add(re);
                                    AsyncWriteLine("Found relation... " + re.name + "\n");

                                    // now if the relation has to do with the tables...
                                    foreach (table item in pr.tables)
                                    {
                                        // we put the relation in the parent table...
                                        if (item.Name.ToLower().Equals(re.parentTable.ToLower()))
                                        {
                                            // le añadimos la descripcion
                                            re.parentDescription = item.fieldDescription;

                                            foreach (table taby in pr.tables)
                                            {
                                                if (taby.Name.Equals(re.childTable))
                                                    re.childDescription = taby.fieldDescription;
                                            }
                                            item.relations.Add(re);
                                        }
                                    }

                                }

                            }

                            // also we can get relations about the field names
                            foreach (table tab in pr.tables)
                            {
                                foreach (field campo in tab.fields)
                                {
                                    if (campo.isKey)
                                    {
                                        foreach (table tab2 in pr.tables)
                                        {
                                            if (!tab.Name.ToLower().Equals(tab2.Name.ToLower()))
                                            {
                                                foreach (field campo2 in tab2.fields)
                                                {
                                                    if (campo.Name.ToLower().Equals(campo2.Name.ToLower()))
                                                    {
                                                        campo2.isForeignKey = true;
                                                        relation rel = new relation();
                                                        rel.name = tab.Name + "_" + tab2.Name;
                                                        if (!pr.relations.Contains(rel.name))
                                                        {
                                                            rel.parentTable = tab2.Name;
                                                            rel.parentField = campo2.Name;

                                                            rel.childTable = tab.Name;
                                                            rel.childField = campo.Name;

                                                            // found description of fields...
                                                            foreach (table item in pr.tables)
                                                            {
                                                                if (item.Name.ToLower().Equals(rel.childTable.ToLower()))
                                                                    rel.childDescription = item.fieldDescription;

                                                                if (item.Name.ToLower().Equals(rel.parentTable.ToLower()))
                                                                    rel.parentDescription = item.fieldDescription;
                                                            }

                                                            pr.relations.Add(rel);

                                                            // now if the relation has to do with the tables...
                                                            foreach (table item in pr.tables)
                                                            {
                                                                if (item.Name.Equals(tab2.Name))
                                                                {
                                                                    // see if the relation exists..
                                                                    bool seguir = true;
                                                                    foreach (relation rel2 in tab2.relations)
                                                                    {
                                                                        if (rel2.name.ToLower().Equals(rel.name.ToLower()))
                                                                            seguir = false;
                                                                    }
                                                                    if (seguir)
                                                                        item.relations.Add(rel);
                                                                }

                                                            }
                                                        }

                                                    }
                                                }
                                            }

                                        }
                                    }
                                }
                            }

                            right = true;
                            pr.host = pro.host;
                            pr.database = pro.database;
                            pr.user = pro.user;
                            pr.password = pro.password;
                            pr.dbDataType = pro.dbDataType;

                        }
                        else
                        {
                            AsyncWriteLine(errorMessage);
                        }
                        break;

                        case   project.databaseType.access2007:

                        connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + pro.database + ";Persist Security Info=False;";
                                            //Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + pro.database + ";Jet OLEDB:Database Password=MyDbPassword;
                        dbAccess dba2007 = new dbAccess();
                        errorMessage = dba2007.test(connectionString);
                        if (errorMessage.Equals(""))
                        {
                            AsyncWrite("");
                            AsyncWriteLine("Success connection \n");
                            //pr = new project();
                            //pr.name = pro.name;

                            // lets get the tables...
                            List<table> lista = new List<table>();
                            lista = dba2007.getTables(connectionString, pro.database);
                            //lista.Sort();
                            foreach (table item in lista)
                            {
                                AsyncWriteLine("Found table... " + item.Name + "\n");

                                // now lets get the fields for each table...
                                List<field> listaField = new List<field>();
                                listaField = dba2007.getFields(connectionString, item.Name);
                                if (listaField != null)
                                {
                                    foreach (field fi in listaField)
                                    {
                                        item.fields.Add(fi);
                                        AsyncWriteLine("Found field... " + fi.Name + "\n");

                                    }

                                }

                                // lets get primary keys and foreign keys for the table...
                                dba2007.getKeys(connectionString, item);

                                // now we search a text field that is not key
                                if (listaField != null)
                                {
                                    // the descriptionField its the first string field of table...
                                    foreach (field campito in listaField)
                                    {
                                        if (campito.type.ToString().Equals("_string") || campito.type.ToString().Equals("_text") )
                                        {
                                            item.fieldDescription = campito.Name;
                                            break;
                                        }
                                    }

                                }
                                if (item.fieldDescription == null)
                                    item.fieldDescription = item.GetKey;

                                // lets sort the fields in the table...
                                // we order but put first key fields
                                if (general.orderFields)
                                {
                                    item.fields.Sort(new compareFields(compareFields.CompareByOptions.name));
                                    item.fields.Sort(new compareFields(compareFields.CompareByOptions.key));
                                }
                                pr.tables.Add(item);

                            }

                            pr.tables.Sort();
                            // now lets get the relations ...
                            List<relation> listarelation = new List<relation>();
                            listarelation = dba2007.getRelations(connectionString);
                            if (listarelation != null)
                            {
                                foreach (relation re in listarelation)
                                {
                                    //  item.fields.Add(re);
                                    pr.relations.Add(re);
                                    AsyncWriteLine("Found relation... " + re.name + "\n");

                                    // now if the relation has to do with the tables...
                                    foreach (table item in pr.tables)
                                    {
                                        // we put the relation in the parent table...
                                        if (item.Name.ToLower().Equals(re.parentTable.ToLower()))
                                        {
                                            // le añadimos la descripcion
                                            re.parentDescription = item.fieldDescription;

                                            foreach (table taby in pr.tables)
                                            {
                                                if (taby.Name.Equals(re.childTable))
                                                    re.childDescription = taby.fieldDescription;
                                            }
                                            item.relations.Add(re);
                                        }
                                    }

                                }

                            }

                            // also we can get relations about the field names
                            foreach (table tab in pr.tables)
                            {
                                foreach (field campo in tab.fields)
                                {
                                    if (campo.isKey)
                                    {
                                        foreach (table tab2 in pr.tables)
                                        {
                                            if (!tab.Name.ToLower().Equals(tab2.Name.ToLower()))
                                            {
                                                foreach (field campo2 in tab2.fields)
                                                {
                                                    if (campo.Name.ToLower().Equals(campo2.Name.ToLower()))
                                                    {
                                                        campo2.isForeignKey = true;
                                                        relation rel = new relation();
                                                        rel.name = tab.Name + "_" + tab2.Name;
                                                        if (!pr.relations.Contains(rel.name))
                                                        {
                                                            rel.parentTable = tab2.Name;
                                                            rel.parentField = campo2.Name;

                                                            rel.childTable = tab.Name;
                                                            rel.childField = campo.Name;

                                                            // found description of fields...
                                                            foreach (table item in pr.tables)
                                                            {
                                                                if (item.Name.ToLower().Equals(rel.childTable.ToLower()))
                                                                    rel.childDescription = item.fieldDescription;

                                                                if (item.Name.ToLower().Equals(rel.parentTable.ToLower()))
                                                                    rel.parentDescription = item.fieldDescription;
                                                            }

                                                            pr.relations.Add(rel);

                                                            // now if the relation has to do with the tables...
                                                            foreach (table item in pr.tables)
                                                            {
                                                                if (item.Name.Equals(tab2.Name))
                                                                {
                                                                    // see if the relation exists..
                                                                    bool seguir = true;
                                                                    foreach (relation rel2 in tab2.relations)
                                                                    {
                                                                        if (rel2.name.ToLower().Equals(rel.name.ToLower()))
                                                                            seguir = false;
                                                                    }
                                                                    if (seguir)
                                                                        item.relations.Add(rel);
                                                                }

                                                            }
                                                        }

                                                    }
                                                }
                                            }

                                        }
                                    }
                                }
                            }

                            right = true;
                            pr.host = pro.host;
                            pr.database = pro.database;
                            pr.user = pro.user;
                            pr.password = pro.password;
                            pr.dbDataType = pro.dbDataType;

                        }
                        else
                        {
                            AsyncWriteLine(errorMessage);
                        }
                        break;
                        // end of access2007
                        case project.databaseType.excelOrCsv:

                        if (pr.database.Contains("xls"))
                            connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pr.database + ";Extended Properties=\"text;HDR=Yes;FMT=Delimited\"";
                        else
                            connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pr.database + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\"";

                        dbExcelOrCsv dbaODBC = new dbExcelOrCsv();
                        errorMessage = dbaODBC.test(connectionString);
                        if (errorMessage.Equals(""))
                        {
                            AsyncWrite("");
                            AsyncWriteLine("Success connection \n");
                            //pr = new project();
                            //pr.name = pro.name;9

                            // lets get the tables...
                            List<table> lista = new List<table>();
                            lista = dbaODBC.getTables(connectionString, pr.database);
                            //lista.Sort();
                            foreach (table item in lista)
                            {
                                AsyncWriteLine("Found table... " + item.Name + "\n");

                                // now lets get the fields for each table...
                                List<field> listaField = new List<field>();
                                listaField = dbaODBC.getFields(connectionString, item.Name);

                                if (listaField != null)
                                {
                                    foreach (field fi in listaField)
                                    {
                                        item.fields.Add(fi);
                                        AsyncWriteLine("Found field... " + fi.Name + "\n");

                                    }

                                }

                                // lets get primary keys and foreign keys for the table...
                                dbaODBC.getKeys(connectionString, item);

                                // now we search a text field that is not key
                                if (listaField != null)
                                {
                                    // the descriptionField its the first string field of table...
                                    foreach (field campito in listaField)
                                    {
                                        if (campito.type.ToString().Equals("_string") || campito.type.ToString().Equals("_text"))
                                        {
                                            item.fieldDescription = campito.Name;
                                            break;
                                        }

                                    }

                                }
                                if (item.fieldDescription == null)
                                    item.fieldDescription = item.GetKey;

                                // lets sort the fields in the table...
                                // we order but put first key fields
                                if (general.orderFields)
                                {
                                    item.fields.Sort(new compareFields(compareFields.CompareByOptions.name));
                                    item.fields.Sort(new compareFields(compareFields.CompareByOptions.key));
                                }
                                pr.tables.Add(item);

                            }

                            pr.tables.Sort();
                            // now lets get the relations ...
                            List<relation> listarelation = new List<relation>();
                            listarelation = dbaODBC.getRelations(connectionString);
                            if (listarelation != null)
                            {
                                foreach (relation re in listarelation)
                                {
                                    //  item.fields.Add(re);
                                    pr.relations.Add(re);
                                    AsyncWriteLine("Found relation... " + re.name + "\n");

                                    // now if the relation has to do with the tables...
                                    foreach (table item in pr.tables)
                                    {
                                        // we put the relation in the parent table...
                                        if (item.Name.ToLower().Equals(re.parentTable.ToLower()))
                                        {
                                            // le añadimos la descripcion
                                            re.parentDescription = item.fieldDescription;

                                            foreach (table taby in pr.tables)
                                            {
                                                if (taby.Name.Equals(re.childTable))
                                                    re.childDescription = taby.fieldDescription;
                                            }
                                            item.relations.Add(re);
                                        }
                                    }

                                }

                            }

                            // also we can get relations about the field names
                            foreach (table tab in pr.tables)
                            {
                                foreach (field campo in tab.fields)
                                {
                                    if (campo.isKey)
                                    {
                                        foreach (table tab2 in pr.tables)
                                        {
                                            if (!tab.Name.ToLower().Equals(tab2.Name.ToLower()))
                                            {
                                                foreach (field campo2 in tab2.fields)
                                                {
                                                    if (campo.Name.ToLower().Equals(campo2.Name.ToLower()))
                                                    {
                                                        campo2.isForeignKey = true;
                                                        relation rel = new relation();
                                                        rel.name = tab.Name + "_" + tab2.Name;
                                                        if (!pr.relations.Contains(rel.name))
                                                        {
                                                            rel.parentTable = tab2.Name;
                                                            rel.parentField = campo2.Name;

                                                            rel.childTable = tab.Name;
                                                            rel.childField = campo.Name;

                                                            // found description of fields...
                                                            foreach (table item in pr.tables)
                                                            {
                                                                if (item.Name.ToLower().Equals(rel.childTable.ToLower()))
                                                                    rel.childDescription = item.fieldDescription;

                                                                if (item.Name.ToLower().Equals(rel.parentTable.ToLower()))
                                                                    rel.parentDescription = item.fieldDescription;
                                                            }

                                                            pr.relations.Add(rel);

                                                            // now if the relation has to do with the tables...
                                                            foreach (table item in pr.tables)
                                                            {
                                                                if (item.Name.Equals(tab2.Name))
                                                                {
                                                                    // see if the relation exists..
                                                                    bool seguir = true;
                                                                    foreach (relation rel2 in tab2.relations)
                                                                    {
                                                                        if (rel2.name.ToLower().Equals(rel.name.ToLower()))
                                                                            seguir = false;
                                                                    }
                                                                    if (seguir)
                                                                        item.relations.Add(rel);
                                                                }

                                                            }
                                                        }

                                                    }
                                                }
                                            }

                                        }
                                    }
                                }
                            }

                            right = true;
                            pr.host = pr.host;
                            pr.database = pr.database;
                            pr.user = pr.user;
                            pr.password = pr.password;
                            pr.dbDataType = pr.dbDataType;

                        }
                        else
                        {
                            AsyncWriteLine(errorMessage);
                        }
                        break;

                    // end of excelOrCsv

                }

                Cursor.Current = Cursors.Default;

                switch (right)
                {
                    case true:
                            AsyncWriteLine("All right. Now you can save the project...");
                            AsyncEnableButton(true);
                            SystemSounds.Exclamation.Play();
                            break;

                    case false:

                            AsyncWriteLine("Error, review the configuration.");
                            AsyncEnableButton(false);
                            //util.playSimpleSound(Path.Combine(util.sound_dir, "zasentodalaboca.wav"));
                            SystemSounds.Asterisk.Play();
                            break;

                }

                // we have finished with new project
                Cursor.Current = Cursors.Default;

            }
            catch (Exception ex)
            {

                AsyncWrite(ex.Message);
            }
        }
示例#52
0
        public IHttpActionResult Putproject(int id, project project)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != project.pid)
            {
                return BadRequest();
            }

            db.Entry(project).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!projectExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
示例#53
0
    // return the name of the parent table of a foreign key
    public String getTableNameByForeignKey(project pr, string fieldName)
    {
        try
        {
            foreach (table item in pr.GetTables)
            {
                if (item.GetKey.ToLower().Equals(fieldName.ToLower()))
                    return item.Name;
            }
        }
        catch (Exception ex)
        {

            throw;
        }

        return "";
    }
示例#54
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //diagram di = new diagram();
            //di.ShowDialog();

            //model ed = new model();
            //ed.actualProject = actualProject;
            //ed.ShowDialog();

            //// para apañar templates antiguos...
            //myWay.classes.fixTemplate fi = new myWay.classes.fixTemplate();
            //fi.traverseDirectory("I:\\proyectos\\desktop\\myWay\\templates\\vb");

            // para crear el control avalonEdit
            // son necesarias las siguientes dll (copiadas del framework 3.0 la mayoria)
            // ICSharpCode.AvalonEdit - PresentationCore - PresentationFramework - WindowsBase - WindowsFormsIntegration

            ElementHost host = new ElementHost();
            host.Name = "editor";
            host.Dock = DockStyle.Fill;
            TextEditor uc = new TextEditor();
            uc.Options.IndentationSize = 4;
            uc.Background = System.Windows.Media.Brushes.White;
            uc.ShowLineNumbers = true;
            uc.WordWrap = true;

            IHighlightingDefinition highlightDefinition = HighlightingManager.Instance.GetDefinition("C#");
            uc.SyntaxHighlighting = highlightDefinition;
            host.Child = uc;

            // in the constructor:
            uc.TextArea.TextEntering += textEditor_TextArea_TextEntering;
            uc.TextArea.TextEntered += textEditor_TextArea_TextEntered;

            panel1.Controls.Add(host);
            //this.Controls.Add(host);

            // if there is a template selected early we load it..
            if (general.templateSelectedFullUri != null)
            {
                //  rt1.Text = util.loadFile(templateSelectedFullUri);
                writeText(util.loadFile(general.templateSelectedFullUri));
            }

            string numberOfLinesWrittenBefore = sf.toLong(System.Configuration.ConfigurationManager.AppSettings["numberOfLinesWritten"]).ToString();
            labNumberOfLinesWritten.Values.Text = sf.cadena(numberOfLinesWrittenBefore) + " lines written with myWay";

            string labNumberOfAppsBefore = sf.toLong(System.Configuration.ConfigurationManager.AppSettings["labNumberOfAppsWritten"]).ToString();
            labNumberOfApps.Values.Text = sf.cadena(labNumberOfAppsBefore) + " apps written with myWay";

            // lets load config files of project templates ...
            traverseDirectorySearchProjectConfigFiles(util.projectTemplates_dir);
            foreach (projectconfigfiles item in ctes.listaProjectConfigFiles)
            {
                lbProjectTemplate.Items.Add(item.Name);
            }

            // vemos si existe un conf.xml o ultimo proyecto utilizado...
            project pr = new project();
            pr = project.loadProject(Path.Combine(util.conf_dir, "conf.xml"));
            if (pr != null)
            {
                this.Text = "myWay " + pr.name;
                groupBox1.Text = pr.name;
                this.Text = "myWay " + pr.name;
                general.actualProject = pr;

                refreshDataWithActualProject();

            }
        }
示例#55
0
    //done button to insert values in database
    protected void Btndone_Click(object sender, EventArgs e)
    {
        //here we are getting follow people values(asptokeninput) from ItemList.aspx page,it can be multiple so we are entering multiple values by '/'
        for (int i = 0; i <= lbList2.Items.Count - 1; i++)
        {
            listid = lbList2.Items[i].Value.Split('-');
            string name = listid[0];
            eco += listid[0] + "/";
        }
        if (eco != "")
        {
            eco = eco.Remove(eco.Length - 1);
        }
         namesplit = LblFLName.Text.Split(' ');
            if (p)
            {
                var pp = new product
                  {

                      FirstName = namesplit[0],
                      LastName=namesplit[1],
                      Password = Hiddpass.Value,
                      University = LblUni.Text,
                      Course = LblCourse.Text,
                      Year = LblYear.Text,
                      Location = LblCity.Text,
                      SuaveID =  Label2.Text + TxtSuaveid.Text,
                      About = TxtAbout.Text,
                      FollowPpl = eco,
                      Project = TxtCreateproj.Text,
                     Emailid=TxtEmailid.Text
                  };
                //inserting user details in table admin
                var hh = a1.GetCollection<product>("admin");
                hh.Insert(pp);
                //here we are creating projectid,it is a combination of suaveid+first 3 letters of project name
                proid = TxtCreateproj.Text.Substring(0,3);
                  var pp2 = new project
                  {
                       Project = TxtCreateproj.Text,
                       ProjectId=Label2.Text + TxtSuaveid.Text+proid,
                       SuaveID = Label2.Text + TxtSuaveid.Text
                  };
                //inserting project details in table ProjectDet
                var hh2 = a1.GetCollection<project>("ProjectDet");
                hh2.Insert(pp2);

                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Alert", "alert('Inserted ');", true);
                //here we move forward for dash board page by passing suaveid as a parameter
                string su=Label2.Text + TxtSuaveid.Text;
                Session["SuaveID"] = su;
                Response.Redirect("Default.aspx");

                TxtFirstname.Text = "";
                Txtlastname.Text = "";
                txtPwd.Text = "";
                txtRePwd.Text = "";
                TxtUniversity.Text = "";
                TxtCourse.Text = "";
                DdlYear.Items.Clear();
                TxtLocation.Text = "";
                TxtSuaveid.Text = "";
                TxtAbout.Text = "";
                tiTest2.Items.Clear();
                TxtCreateproj.Text = "";

        }
    }
示例#56
0
 // return the name of the keyField of the parent table from a foreign key
 public String getKeyFieldByForeignKey(project pr, string fieldName)
 {
     foreach (table item in pr.GetTables)
     {
         if (item.GetKey.ToLower().Equals(fieldName.ToLower()))
             return item.GetKey;
     }
     return "";
 }
示例#57
0
        private void saveData()
        {
            try
            {
                project pr = new project();
                pr = general.actualProject;
                //pr.templateSelectedFullUri = general.templateSelectedFullUri;

                pr.targetDirectory = general.actualProject.targetDirectory;

                // save the project template from the listbox
                if (lbProjectTemplate.Items.Count != 0)
                {
                    string pt = lbProjectTemplate.SelectedItem.ToString();
                    foreach (projectconfigfiles item in ctes.listaProjectConfigFiles)
                    {
                        if (item.Name == pt)
                        {
                            pr.projectTemplatesDirectory = item.Directory;
                        }
                    }

                    pr.projectTemplatesDirectorySmall = pt;
                }

                pr.saveProject(Path.Combine(util.conf_dir, "conf.xml"));
                pr.saveProject(Path.Combine(util.projects_dir, general.actualProject.name) + ".xml");

            }
            catch (Exception)
            {

                //throw;
            }
        }
示例#58
0
        //private void cmbGoToCode_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //    string st = "";
        //    int numLinea = 0;
        //    st = cmbGoToCode.SelectedItem.ToString().Trim();
        //    // get the control of editor
        //    ElementHost pp = new ElementHost();
        //    TextEditor te = new TextEditor();
        //    pp = (ElementHost)panel1.Controls.Find("editor", true)[0];
        //    te = (TextEditor)pp.Child;
        //    foreach (ICSharpCode.AvalonEdit.Document.DocumentLine item in te.Document.Lines)
        //    {
        //        if (item.Text.IndexOf(st) != -1)
        //        {
        //            numLinea = item.LineNumber;
        //        }
        //    }
        //    te.ScrollTo(numLinea, 0);
        //} // cmbGoToCode_SelectedIndexChanged
        private void txtNameSpace_TextChanged(object sender, EventArgs e)
        {
            project pr = new project();
            pr = general.actualProject;

            pr.nameSpace = txtNameSpace.Text;
            pr.saveProject(Path.Combine(util.conf_dir, "conf.xml"));
            pr.saveProject(Path.Combine(util.projects_dir, general.actualProject.name) + ".xml");
        }