protected override void PrepareSpecificControls(App_Code.Model.eControlMode state)
 {
     this.revDepartureDateFrom.Enabled = true;
     this.revDepartureDateTo.Enabled = true;
     this.revReceiptDateFrom.Enabled = true;
     this.revReceiptDateTo.Enabled = true;
 }
Ejemplo n.º 2
0
        // GET: Admin/Post/Create
        public async Task <ActionResult> Create()
        {
            Post newPost = new Post()
            {
                Title      = "Bản nháp bài viết BaiViet_Ticks" + DateTime.Now.Ticks.ToString(),
                Show       = false,
                CategoryID = db.Categories.First().ID
            };
            SubCategory subCategory = db.SubCategories.FirstOrDefault(m => m.CategoryID == newPost.CategoryID);

            if (subCategory != null)
            {
                newPost.SubCategoryID = subCategory.ID;
            }
            newPost.Image     = "nhap.png";
            newPost.UserID    = User.Identity.GetUserId();
            newPost.Views     = 0;
            newPost.Introduce = "...";
            newPost.Body      = "...";
            newPost.DatePost  = DateTime.Now;
            newPost.Alias     = App_Code.VietnameseSigns(newPost.Title);
            db.Posts.Add(newPost);
            await db.SaveChangesAsync();

            newPost.Title           = "Bài viết số " + newPost.PostID.ToString();
            db.Entry(newPost).State = EntityState.Modified;
            await db.SaveChangesAsync();

            return(RedirectToAction("Edit", new { id = newPost.PostID, create = true }));
        }
 protected override void PrepareSpecificControls(App_Code.Model.eControlMode state)
 {
     this.revOrderDateFrom.Enabled = true;
     this.revOrderDateTo.Enabled = true;
     this.revPaymentDateFrom.Enabled = true;
     this.revPaymentDateTo.Enabled = true;
 }
Ejemplo n.º 4
0
 protected override void PrepareSpecificControls(App_Code.Model.eControlMode state)
 {
     this.revDeliveryDateFrom.Enabled = true;
     this.revDeliveryDateTo.Enabled = true;
     this.revExpirationDatePromissoryFrom.Enabled = true;
     this.revExpirationDatePromissoryTo.Enabled = true;
     this.revReturnDateFrom.Enabled = true;
     this.revReturnDateTo.Enabled = true;
 }
Ejemplo n.º 5
0
 public ActionResult Edit([Bind(Include = "TagID,Name")] Tag tag)
 {
     if (ModelState.IsValid)
     {
         tag.Alias           = App_Code.VietnameseSigns(tag.Name);
         db.Entry(tag).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tag));
 }
Ejemplo n.º 6
0
        public ActionResult Create([Bind(Include = "TagID,Name")] Tag tag)
        {
            if (ModelState.IsValid)
            {
                tag.Alias = App_Code.VietnameseSigns(tag.Name);
                db.Tags.Add(tag);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tag));
        }
Ejemplo n.º 7
0
        public async Task <ActionResult> DangKyNhanTin(MailSubscribe mailSubscribe)
        {
            try
            {
                if (mailSubscribe.Email.Trim() == string.Empty || mailSubscribe.FullName.Trim() == string.Empty)
                {
                    ViewBag.Result       = 0;
                    ViewBag.ErrorMessage = "Vui lòng nhập đủ thông tin!";
                    ViewBag.Title        = "Lỗi";
                    return(View("SubscribeConfirmation"));
                }
                else if (mailSubscribe.FullName.Trim().Length > 200)
                {
                    ViewBag.Result       = 0;
                    ViewBag.ErrorMessage = "Họ tên quá dài!";
                    ViewBag.Title        = "Lỗi";
                    return(View("SubscribeConfirmation"));
                }
                else if (App_Code.IsValidEmail(mailSubscribe.Email) == false)
                {
                    ViewBag.Result       = 0;
                    ViewBag.ErrorMessage = "Địa chỉ email không hợp lệ!";
                    ViewBag.Title        = "Lỗi";
                    return(View("SubscribeConfirmation"));
                }
                mailSubscribe.DateSubscribe = DateTime.Now;
                if (await db.MailSubscribes.FindAsync(mailSubscribe.Email) == null)
                {
                    db.MailSubscribes.Add(mailSubscribe);
                    ViewBag.Result = 1;
                    ViewBag.Title  = "Thành công";
                    await db.SaveChangesAsync();
                }
                else
                {
                    ViewBag.Result = 2;
                    ViewBag.Title  = "Lỗi";
                }

                return(View("SubscribeConfirmation"));
            }
            catch
            {
                ViewBag.Result       = 0;
                ViewBag.ErrorMessage = "Xảy ra lỗi khi xử lý";
                ViewBag.Title        = "Lỗi";
                return(View("SubscribeConfirmation"));
            }
        }
Ejemplo n.º 8
0
        public async Task <ActionResult> Create(CreateUserViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser()
                {
                    FirstName = App_Code.XoaKhoangTrangThua(model.FirstName), LastName = App_Code.XoaKhoangTrangThua(model.LastName), Email = model.Email, UserName = model.Email, Image = "user.png", DateRegister = DateTime.Now, EmailConfirmed = true
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    AddErrors(result);
                }
            }
            return(View(model));
        }
Ejemplo n.º 9
0
    public HttpResponseMessage Get(string id)
    {
        if (id == "check1")
        {
            var result = string.Format("ASP.NET application Identity is: {0}", WindowsIdentity.GetCurrent().Name);
            return Request.CreateResponse(HttpStatusCode.OK, result);
        }
        else if (id == "trust")
        {
            var trust = GetCurrentTrustLevel();
            if (trust == AspNetHostingPermissionLevel.High || trust == AspNetHostingPermissionLevel.Unrestricted)
            {
                var data = new { success = true, msg = "Trust level: " + trust.ToString() };
                return Request.CreateResponse(HttpStatusCode.OK, data);
            }
            else
            {
                var data = new { success = false, msg = "Trust level: " + trust.ToString() };
                return Request.CreateResponse(HttpStatusCode.OK, data);
            }
        }
        else
        {
            string fileName = GetFileName(id);
            var processed = Process(fileName);

            if (string.IsNullOrEmpty(processed))
            {
                var data = new { success = true, msg = "Can create and delete file " + fileName };
                return Request.CreateResponse(HttpStatusCode.OK, data);
            }
            else
            {
                var data = new { success = false, msg = "Error creating file " + fileName };
                return Request.CreateResponse(HttpStatusCode.OK, data);
            }             
        }
    }
Ejemplo n.º 10
0
 protected override void PrepareSpecificControls(App_Code.Model.eControlMode state)
 {
     this.revExportDate.Enabled = true;
 }
Ejemplo n.º 11
0
 protected override void PrepareSpecificControls(App_Code.Model.eControlMode state)
 {
     this.rfvAccountGroup.Enabled = true;
     this.rfvYear.Enabled = true;
     this.revYear.Enabled = true;
 }
Ejemplo n.º 12
0
        public static void Main(string[] args)
        {
            DataTable dt = new DataTable();

            dt = dl.GetInfoProveedoresByEstatus(1);
            DataTable dt1 = new DataTable();

            dt1 = dl.GetInfoProveedoresByEstatus(2);

            AltaProveedores AP = new AltaProveedores();

            Console.WriteLine(AP.FechaUpdate);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                AP = new AltaProveedores();
                //se mapean los datos de cuenta.
                AP.vendorid    = dt.Rows[i]["VENDORID"].ToString();
                AP.vendname    = dt.Rows[i]["VENDNAME"].ToString();
                AP.vendcntct   = dt.Rows[i]["VNDCNTCT"].ToString();
                AP.phnumber1   = dt.Rows[i]["PHNUMBR1"].ToString();
                AP.phnumber2   = dt.Rows[i]["PHNUMBR2"].ToString();
                AP.phnumber3   = dt.Rows[i]["PHONE3"].ToString();
                AP.upszone     = dt.Rows[i]["UPSZONE"].ToString();
                AP.acnmvndr    = dt.Rows[i]["ACNMVNDR"].ToString();
                AP.curncyid    = dt.Rows[i]["CURNCYID"].ToString();
                AP.txrgnnum    = dt.Rows[i]["TXRGNNUM"].ToString();
                AP.estatus     = dt.Rows[i]["Estatus"].ToString();
                AP.email       = dt.Rows[i]["Email"].ToString();
                AP.FechaUpdate = dt.Rows[i]["FechaUpdate"].ToString();
                //se mapean los datos de ALTA.
                AP.ALTAvendorid  = dt.Rows[i]["VENDORID"].ToString();
                AP.ALTAvendname  = dt.Rows[i]["VENDNAME"].ToString();
                AP.ALTAvendcntct = dt.Rows[i]["VNDCNTCT"].ToString();
                AP.ALTAphnumber1 = dt.Rows[i]["PHNUMBR1"].ToString();
                AP.ALTAphnumber2 = dt.Rows[i]["PHNUMBR2"].ToString();
                AP.ALTAphnumber3 = dt.Rows[i]["PHONE3"].ToString();
                AP.ALTAupszone   = dt.Rows[i]["UPSZONE"].ToString();
                AP.ALTAacnmvndr  = dt.Rows[i]["ACNMVNDR"].ToString();
                AP.ALTAcurncyid  = dt.Rows[i]["CURNCYID"].ToString();
                AP.ALTAtxrgnnum  = dt.Rows[i]["TXRGNNUM"].ToString();
                AP.ALTAestatus   = dt.Rows[i]["Estatus"].ToString();
                AP.ALTAemail     = dt.Rows[i]["Email"].ToString();
                App_Code apz = new App_Code();
                apz.CreaArchivo(AP);
            }
            if (DateTime.Now.Hour == 10)
            {
                for (int i = 0; i < dt1.Rows.Count; i++)
                {
                    AP             = new AltaProveedores();
                    AP.vendorid    = dt1.Rows[i]["VENDORID"].ToString();
                    AP.vendname    = dt1.Rows[i]["VENDNAME"].ToString();
                    AP.vendcntct   = dt1.Rows[i]["VNDCNTCT"].ToString();
                    AP.phnumber1   = dt1.Rows[i]["PHNUMBR1"].ToString();
                    AP.phnumber2   = dt1.Rows[i]["PHNUMBR2"].ToString();
                    AP.phnumber3   = dt1.Rows[i]["PHONE3"].ToString();
                    AP.upszone     = dt1.Rows[i]["UPSZONE"].ToString();
                    AP.acnmvndr    = dt1.Rows[i]["ACNMVNDR"].ToString();
                    AP.curncyid    = dt1.Rows[i]["CURNCYID"].ToString();
                    AP.txrgnnum    = dt1.Rows[i]["TXRGNNUM"].ToString();
                    AP.estatus     = dt1.Rows[i]["Estatus"].ToString();
                    AP.email       = dt1.Rows[i]["Email"].ToString();
                    AP.FechaUpdate = dt1.Rows[i]["FechaUpdate"].ToString();

                    App_Code apz = new App_Code();
                    apz.CreaArchivo(AP);
                }
            }
            else
            {
                Console.WriteLine("Fuera de tiempo");
            }
        }
Ejemplo n.º 13
0
        protected override void PrepareSpecificControls(App_Code.Model.eControlMode state)
        {
            switch (state)
            {
                case Bubis.Andika.WebSite.App_Code.Model.eControlMode.Consulta:
                    if (this.Parent.FindControl("ucBotonera") != null)
                        this.Parent.FindControl("ucBotonera").Visible = true;
                    this.divSearch.Visible = this.ucCheckingAccountsSearch.Visible = true;
                    this.divABM.Visible = false;
                    break;
                case Bubis.Andika.WebSite.App_Code.Model.eControlMode.Ver:
                    if (this.Parent.FindControl("ucBotonera") != null)
                        this.Parent.FindControl("ucBotonera").Visible = false;
                    this.divSearch.Visible = this.ucCheckingAccountsSearch.Visible = false;
                    this.divABM.Visible = true;
                    break;
            }

            //this.ucCheckingAccountsSearch.ControlMode = state;
        }
Ejemplo n.º 14
0
 private void connectionControl_Connected(App_Code.Connector.ConnectionOptions obj)
 {
     Session["ConnectionOptions"] = obj;
     Response.Redirect("Working.aspx");
 }
Ejemplo n.º 15
0
        public async Task <ActionResult> Edit([Bind(Include = "PostID, Title, Introduce, UserID, CategoryID, SubCategoryID, Body, Image, ImageOpenGraph, Views,  Show, Views, DatePost, DateModified")] Post post, int?page, HttpPostedFileBase file, HttpPostedFileBase fileOpenGraph, string titleOld, bool?ShowOld)
        {
            try
            {
                if (titleOld.ToLower().Trim() != post.Title.ToLower().Trim())
                {
                    if (db.Posts.FirstOrDefault(m => m.Title.ToLower().Trim() == post.Title.ToLower().Trim() && m.Show == true) != null)
                    {
                        ModelState.AddModelError("", "Tiêu đề đã bị trùng bài viết khác. Bạn hãy đổi tiêu đề cho bài viết.");
                    }
                }

                if (post.Views < 0)
                {
                    ModelState.AddModelError("", "Lượt xem phải >= 0");
                }
                post.Alias        = App_Code.VietnameseSigns(post.Title.ToLower());
                post.DateModified = DateTime.Now;

                if (file != null && file.ContentLength > 0)
                {
                    string extendFile = System.IO.Path.GetExtension(file.FileName);
                    if (extendFile != ".jpg" && extendFile != ".jpeg" && extendFile != ".png")
                    {
                        ModelState.AddModelError("", "Hình ảnh phải có đuôi .jpg, .jpeg hoặc .png!");
                    }
                    if (file.ContentLength > 1000141)
                    {
                        ModelState.AddModelError("", "Hình ảnh phải có size < 1MB. Vui lòng cắt bớt hình hoặc chọn hình khác!");
                    }
                    post.Image = post.Alias + extendFile;
                    file.SaveAs(Server.MapPath("~/Photos/Posts/" + post.Image));
                    System.Drawing.Image image = System.Drawing.Image.FromFile(Server.MapPath("~/Photos/Posts/") + post.Image);
                    using (var resized = ImageUtilities.ResizeImage(image, 64, 54))
                    {
                        ImageUtilities.SaveJpeg(Server.MapPath("~/Photos/ImageSmall/") + post.Image, resized, 100);
                    }
                }

                if (fileOpenGraph != null && fileOpenGraph.ContentLength > 0)
                {
                    string extendFile = System.IO.Path.GetExtension(fileOpenGraph.FileName);
                    if (extendFile != ".jpg" && extendFile != ".jpeg" && extendFile != ".png")
                    {
                        ModelState.AddModelError("", "Hình ảnh open graph phải có đuôi .jpg, .jpeg hoặc .png!");
                    }
                    post.ImageOpenGraph = post.Alias + extendFile;
                    fileOpenGraph.SaveAs(Server.MapPath("~/Photos/ImageOpenGraph/" + post.ImageOpenGraph));
                }

                if (ModelState.IsValid)
                {
                    db.Entry(post).State = EntityState.Modified;
                    await db.SaveChangesAsync();

                    if (post.Show)
                    {
                        HttpResponse.RemoveOutputCacheItem(Url.Action("Detail", "Post", new { alias = post.Alias, area = "" }));
                    }
                    if (ShowOld != true && post.Show)
                    {
                        HttpResponse.RemoveOutputCacheItem(Url.Action("PostByCategory", "Post", new { alias = post.Category.Alias, area = "" }));
                        HttpResponse.RemoveOutputCacheItem(Url.Action("PostBySubCategory", "Post", new { alias = post.SubCategory.Alias, area = "" }));
                    }
                    return(RedirectToAction("Edit", new { id = post.PostID, page = page }));
                }
                ViewBag.UserID        = new SelectList(db.AspNetUsers.Where(m => m.AspNetRoles.Count > 0), "Id", "Email", post.UserID);
                ViewBag.CategoryID    = new SelectList(db.Categories, "ID", "Name", post.CategoryID);
                ViewBag.SubCategoryID = new SelectList(db.SubCategories.Where(m => m.CategoryID == post.CategoryID), "ID", "Name", post.SubCategoryID);

                return(View(post));
            }
            catch
            {
                ModelState.AddModelError("", "Xảy ra lỗi khi xử lý");
                ViewBag.UserID        = new SelectList(db.AspNetUsers.Where(m => m.AspNetRoles.Count > 0), "Id", "Email", post.UserID);
                ViewBag.CategoryID    = new SelectList(db.Categories, "ID", "Name", post.CategoryID);
                ViewBag.SubCategoryID = new SelectList(db.SubCategories.Where(m => m.CategoryID == post.CategoryID), "ID", "Name", post.SubCategoryID);
                return(View(post));
            }
        }
 protected override void PrepareSpecificControls(App_Code.Model.eControlMode state)
 {
 }
Ejemplo n.º 17
0
        public void AddGlyph(App_Code.Glyph G)
        {
            string GlyphFile = "";
            int GlyphWidth = 0;
            int GlyphHeight = 0;
            int GlyphScanSize = 0;
            byte[][] GlyphData;

            GlyphFile = db.DataDirectory + G.GetRandomImage();

            if (GlyphFile != "")
            {
                using (Tiff input = Tiff.Open(GlyphFile, "r"))
                {
                    GlyphWidth = input.GetField(TiffTag.IMAGEWIDTH)[0].ToInt();
                    GlyphHeight = input.GetField(TiffTag.IMAGELENGTH)[0].ToInt();
                    GlyphScanSize = input.ScanlineSize();
                    GlyphData = new byte[GlyphHeight][];

                    if ((GlyphScanSize * 8) < (GlyphWidth + 8))
                    {
                        for (int h = 0; h < GlyphHeight; h++)
                        {
                            GlyphData[h] = new byte[GlyphScanSize];
                            input.ReadScanline(GlyphData[h], h);
                        }

                        if (GlyphHeight > (CurrentLineBottomHeight - CurrentLineTopHeight))
                        {
                            CurrentLineBottomHeight = CurrentLineTopHeight + GlyphHeight;
                        }

                        GlyphWord.Add(new GlyphKeeper(GlyphWidth, GlyphHeight, (int)G.XOffset, (int)G.YOffset, GlyphScanSize, G.Unicode, GlyphData));
                    }
                }
            }
            else
            {
                UnaccountedFor.Add(G.Unicode);
            }
        }
Ejemplo n.º 18
0
 protected override void PrepareSpecificControls(App_Code.Model.eControlMode state)
 {
     this.revCollectionDateFrom.Enabled = true;
     this.revCollectionDateTo.Enabled = true;
 }
Ejemplo n.º 19
0
    private void UpdatePlayer(PlayerHelper helper, App_Code.Player player, App_Code.Player hisPlayer)
    {
        hisPlayer.IsCurrent = player.IsCurrent;
        helper.UpdateMySQLPlayer(hisPlayer);

        InfoLabel.Text += String.Format("Updating {0}'s IsCurrent to {1} {2}", player.Name, player.IsCurrent.ToString(), "<br />");
    }
Ejemplo n.º 20
0
 private void AddPlayer(PlayerHelper helper, App_Code.Player player)
 {
     helper.AddPlayerToMySQL(player);
     InfoLabel.Text += String.Format("Adding player {0} {1}", player.Name, "<br />");
 }
        private static int UpdateIncidentNoDateClosed(App_Code.Incidents incident, App_Code.Incidents incidentUpdated)
        {
            SqlConnection connection = new SqlConnection(GetConnectionString());

            string updateStament = "UPDATE Incidents "
                + " SET ProductCode = @ProductCode, Title = @Title, TechID = @TechID, Description = @Description, "
                + "DateOpened = @DateOpened, Status = @Status "
                + "WHERE IncidentID = " + incidentUpdated.IncidentID;

            SqlCommand command = new SqlCommand(updateStament, connection);

            command.Parameters.AddWithValue("@ProductCode", incidentUpdated.ProductCode);
            command.Parameters.AddWithValue("@Title", incidentUpdated.Title);
            command.Parameters.AddWithValue("@TechID", incidentUpdated.TechID);
            command.Parameters.AddWithValue("@Description", incidentUpdated.Description);
            command.Parameters.AddWithValue("@DateOpened", incidentUpdated.DateOpened);

            command.Parameters.AddWithValue("@Status", incidentUpdated.Status);

            connection.Open();
            int updateCount = command.ExecuteNonQuery();
            connection.Close();
            return updateCount;
        }