예제 #1
0
        public void InsertBOC(int?projectID, int?projectRepositoryID, int developerID, int fileID, int?filetypeID, string fileURL, long bocs, long revision, string action, DateTime lTime)
        {
            using (var ctx = new ProManEntities())
            {
                var oldboc = ctx.BOCs.Where(o =>

                                            o.DeveloperID == developerID &&
                                            o.FileID == fileID &&
                                            o.RevisionNumber == revision
                                            ).FirstOrDefault();

                if (oldboc != null)
                {
                    ctx.BOCs.Remove(oldboc);
                    ctx.SaveChanges();
                }

                var boc = new ProManService.BOC();
                boc.ProjectID           = projectID;
                boc.ProjectRepositoryID = projectRepositoryID;
                boc.DeveloperID         = developerID;
                boc.FileTypeID          = filetypeID;
                boc.DT             = lTime;
                boc.RevisionNumber = revision;
                boc.Bytes          = bocs;
                boc.Type           = action;
                boc.FileID         = fileID;


                ctx.BOCs.Add(boc);

                ctx.SaveChanges();
            }
        }
예제 #2
0
 public void UpdateRepositoryRevision(long revision, int repositoryID)
 {
     using (var ctx = new ProManEntities())
     {
         var repo = ctx.Repositories.Where(o => o.ID == repositoryID).First();
         repo.LastRevision = revision;
         ctx.SaveChanges();
     }
 }
예제 #3
0
 public Developer InsertDeveloper(string devName)
 {
     using (var ctx = new ProManEntities())
     {
         var ctx_d = new Developer();
         ctx_d.SvnUser = devName;
         ctx.Developers.Add(ctx_d);
         ctx.SaveChanges();
         return(ctx.Developers.Where(x => x.SvnUser == devName).FirstOrDefault());
     }
 }
예제 #4
0
 public File InsertFile(string fileUrl)
 {
     using (var ctxFile = new ProManEntities())
     {
         var file = new ProManService.File();
         file.Filename = fileUrl;
         ctxFile.Files.Add(file);
         ctxFile.SaveChanges();
         return(ctxFile.Files.Where(fl => fl.Filename == fileUrl).FirstOrDefault());
     }
 }
예제 #5
0
        public ActionResult Login(LoginModel model, string returnUrl)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View(model));
            }

            /******************************************************************************************/
            //Convert password to ecrypted password
            using (var ctx = new ProManEntities()) {
                var user = ctx.Users.Where(x => x.Username == model.UserName).FirstOrDefault();
                if (user != null)
                {
                    if (user.Password.StartsWith("#!#"))
                    {
                        user.Password = base.Encrypt(user.Password.Substring(3, user.Password.Length - 3).ToString());
                    }
                }
                ctx.SaveChanges();
            }
            /******************************************************************************************/

            var  modelPassword   = base.Encrypt(model.Password);
            bool validateSqlUser = proMan.Users.Any(x => x.Username == model.UserName && x.Password == modelPassword);

            if (Membership.ValidateUser(model.UserName, model.Password) || validateSqlUser)
            {
                FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
                if (this.Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") &&
                    !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
                {
                    return(this.Redirect(returnUrl));
                }

                return(this.RedirectToAction("Index", "Home"));
            }

            this.ModelState.AddModelError(string.Empty, Helper.GetResStr("lblLoginError", "Site"));

            return(this.View(model));
        }