コード例 #1
0
        public bool DeleteProduct(Product_Model product)
        {
            bool result = false;

            try
            {
                // delete Database
                if (DBHandler.deleteDataBase(ref conn,
                                             "`order_product`",
                                             "`product_id` = " + product.product_id))
                {
                    result = true;

                    //Delete Feature Image
                    FTPAction.deleteFile(AppConfig.FTPHost, AppConfig.FTPUser, AppConfig.FTPPassword,
                                         FTPAction.localPathFeaturedImage, product.linkFeaturedImage);
                    //Delete Design Image
                    foreach (var item in product.product_image_design.Split(','))
                    {
                        if (!item.Equals("None"))
                        {
                            FTPAction.deleteFile(AppConfig.FTPHost, AppConfig.FTPUser, AppConfig.FTPPassword,
                                                 FTPAction.localPathDesign, product.linkFeaturedImage);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogFile.writeLog(LogFile.DIR, "Exception" + LogFile.getTimeStringNow() + ".txt", LogFile.Filemode.GHIDE, ex.Message);
            }

            return(result);
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: hoangnguyen02081993/zeeping
        private void Update()
        {
            List <string> lstFile = null;

            lstFile = FTPAction.getListFiles(AppConfig.FTPHost, AppConfig.FTPUser, AppConfig.FTPPassword, AppConfig.releaseLocation, string.Empty);
            if (lstFile != null)
            {
                if (lstFile.Count > 0)
                {
                    //Backup các file cũ
                    if (!Directory.Exists(Application.StartupPath + "/tmp"))
                    {
                        Directory.CreateDirectory(Application.StartupPath + "/tmp");
                    }
                    int index = 0;
                    foreach (var item in lstFile)
                    {
                        SetStatustoLable(lb_process, "Backup file: " + item);
                        SetProcessBar(progress_update, 60 * ((index * 2) / (lstFile.Count * 2)));
                        //Backup các file cũ
                        try
                        {
                            File.Copy(Application.StartupPath + "/" + item, Application.StartupPath + "/tmp/" + item);
                            File.Delete(Application.StartupPath + "/" + item);
                        }
                        catch { }

                        SetStatustoLable(lb_process, "Get file: " + item);
                        SetProcessBar(progress_update, 60 * ((index * 2 + 1) / (lstFile.Count * 2)));
                        //Get các file mới
                        if (!FTPAction.getFile(AppConfig.FTPHost, AppConfig.FTPUser, AppConfig.FTPPassword, AppConfig.releaseLocation, item, Application.StartupPath, item))
                        {
                            SetStatustoLable(lb_process, "Rollback previous Version");
                            SetProcessBar(progress_update, 0);
                            //Rollback phiên bản cũ
                            Rollback();
                            SetStatustoLable(lb_process, "UpdateFail");
                            SetProcessBar(progress_update, 0);
                            throw new Exception("Lỗi trong quá trình lấy file");
                        }
                        index++;
                    }
                    SetStatustoLable(lb_process, "Delete tmp file");
                    SetProcessBar(progress_update, 60);
                    DeleteTmp();

                    SetStatustoLable(lb_process, "UpdateSucess");
                    SetProcessBar(progress_update, 100);
                }
                else
                {
                    throw new Exception("Không có file nào để update");
                }
            }
            else
            {
                throw new Exception("Không thể kết nối đến server FTP");
            }
        }
コード例 #3
0
        public void DeleteFileCollection(Web_Collections_Model Obj)
        {
            List <string> lstImage = FTPAction.getListFiles(AppConfig.FTPHost, AppConfig.FTPUser, AppConfig.FTPPassword, FTPAction.localSourceWeb + "/" + Common.AppConfig.PathImageCollections + "/" + Obj.id, string.Empty);

            foreach (var item in lstImage)
            {
                FTPAction.deleteFile(AppConfig.FTPHost, AppConfig.FTPUser, AppConfig.FTPPassword, FTPAction.localSourceWeb + "/" + Common.AppConfig.PathImageCollections + "/" + Obj.id, item);
            }
            FTPAction.deleteDirectory(AppConfig.FTPHost, AppConfig.FTPUser, AppConfig.FTPPassword, FTPAction.localSourceWeb + "/" + Common.AppConfig.PathImageCollections + "/" + Obj.id);
        }
コード例 #4
0
        public bool ChangeFeatureImage(Product_Model product, string NewImage)
        {
            bool result = false;

            result = FTPAction.sendFile(AppConfig.FTPHost, AppConfig.FTPUser, AppConfig.FTPPassword,
                                        FTPAction.localPathFeaturedImage, product.linkProduct + Functions.GetExtension(NewImage),
                                        Functions.GetPathFileName(NewImage), Functions.GetSafeFileName(NewImage)) &&
                     DBHandler.updateDataBase(ref conn,
                                              "`order_product`",
                                              "`linkFeaturedImage` = '" + product.linkProduct + Functions.GetExtension(NewImage) + "'",
                                              "`product_id` = " + product.product_id);
            return(result);
        }
コード例 #5
0
        private bool SendImage(ref Web_Collections_Model obj, ref List <ImageAttachModel> lstImage, ref List <ImageAttachModel> DeleteImageList)
        {
            bool result = true;

            if (FeatureImage.IsLocal)
            {
                if (!FTPAction.sendFile(AppConfig.FTPHost, AppConfig.FTPUser, AppConfig.FTPPassword,
                                        FTPAction.localSourceWeb + "/" + Common.AppConfig.PathImageCollections + "/" + obj.id, obj.name + Common.Functions.GetExtension(FeatureImage.Link),
                                        Common.Functions.GetPathFileName(FeatureImage.Link), Common.Functions.GetSafeFileName(FeatureImage.Link)))
                {
                    return(false);
                }
                FeatureImage.IsLocal = false;
                FeatureImage.Link    = AppConfig.WebUrl + "/" + Common.AppConfig.PathImageCollections + "/" + obj.id + "/" + obj.name + Common.Functions.GetExtension(FeatureImage.Link);
            }
            obj.featureimage = obj.name + Common.Functions.GetExtension(FeatureImage.Link);

            foreach (var item in lstImage)
            {
                if (item.IsLocal)
                {
                    if (!FTPAction.sendFile(AppConfig.FTPHost, AppConfig.FTPUser, AppConfig.FTPPassword,
                                            FTPAction.localSourceWeb + "/" + Common.AppConfig.PathImageCollections + "/" + obj.id, Common.Functions.GetSafeFileName(item.Link),
                                            Common.Functions.GetPathFileName(item.Link), Common.Functions.GetSafeFileName(item.Link)))
                    {
                        return(false);
                    }
                    item.IsLocal = false;
                    item.Link    = AppConfig.WebUrl + "/" + Common.AppConfig.PathImageCollections + "/" + obj.id + "/" + Common.Functions.GetSafeFileName(item.Link);
                }
                obj.content = obj.content.Replace("[~" + item.id.ToString() + "]", item.Link);
            }
            foreach (var item in DeleteImageList)
            {
                if (!item.IsLocal)
                {
                    FTPAction.deleteFile(AppConfig.FTPHost, AppConfig.FTPUser, AppConfig.FTPPassword,
                                         FTPAction.localSourceWeb + "/" + Common.AppConfig.PathImageCollections + "/" + obj.id, Common.Functions.GetSafeFileName(item.Link));
                }
            }
            return(result);
        }
コード例 #6
0
        private void LoadImageAttach()
        {
            List <string> lstImage = FTPAction.getListFiles(AppConfig.FTPHost, AppConfig.FTPUser, AppConfig.FTPPassword, FTPAction.localSourceWeb + "/" + Common.AppConfig.PathImageCollections + "/" + Obj.id, string.Empty);

            foreach (var item in lstImage)
            {
                if (item == Obj.featureimage)
                {
                    continue;
                }
                var ImageItem = new ImageAttachModel()
                {
                    IsLocal = false,
                    Link    = AppConfig.WebUrl + "/" + Common.AppConfig.PathImageCollections + "/" + Obj.id + "/" + item
                };
                pn_imageattach.AddImage(ImageItem);
                if (action != Resources.EnumClass.CollectionsAction.Detail)
                {
                    Obj.content = Obj.content.Replace(ImageItem.Link, "[~" + ImageItem.id.ToString() + "]");
                }
            }
        }
コード例 #7
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            if (tb_LinkSP_direct.Text.Equals(string.Empty))
            {
                // TODO
                Functions.ShowMessgeError("Chưa nhập thông tin \"link sản phẩm\"");
                return;
            }
            if (tb_title.Text.Equals(string.Empty))
            {
                // TODO
                Functions.ShowMessgeError("Chưa nhập thông tin \"title sản phẩm\"");
                return;
            }
            if (rtb_content.Text.Equals(string.Empty))
            {
                // TODO
                Functions.ShowMessgeError("Chưa nhập thông tin \"content sản phẩm\"");
                return;
            }
            if (clb_style.CheckedItems.Count == 0)
            {
                // TODO
                Functions.ShowMessgeError("Chưa chọn bất cứ style nào cho sản phẩm");
                return;
            }


            // Gui anh design lên thu muc
            if (FrontDesign.IsLocal && FrontDesign.Link != string.Empty)
            {
                if (!FTPAction.sendFile(AppConfig.FTPHost,
                                        AppConfig.FTPUser,
                                        AppConfig.FTPPassword,
                                        FTPAction.localPathDesign,
                                        Functions.GetSafeFileName(FrontDesign.Link).Replace(" ", ""),
                                        Functions.GetPathFileName(FrontDesign.Link),
                                        Functions.GetSafeFileName(FrontDesign.Link)))
                {
                    //TODO
                    Functions.ShowMessgeError("Có lỗi xảy ra trong quá trình gửi ảnh design lên web");
                    return;
                }
                if (product.product_image_design.Split(',')[0] != Functions.GetSafeFileName(FrontDesign.Link) && product.product_image_design.Split(',')[0] != "None")
                {
                    FTPAction.deleteFile(AppConfig.FTPHost,
                                         AppConfig.FTPUser,
                                         AppConfig.FTPPassword,
                                         FTPAction.localPathDesign,
                                         product.product_image_design.Split(',')[0]);
                }
            }
            if (BehideDesign.Link != string.Empty && BehideDesign.IsLocal)
            {
                if (!FTPAction.sendFile(AppConfig.FTPHost,
                                        AppConfig.FTPUser,
                                        AppConfig.FTPPassword,
                                        FTPAction.localPathDesign,
                                        Functions.GetSafeFileName(BehideDesign.Link).Replace(" ", ""),
                                        Functions.GetPathFileName(BehideDesign.Link),
                                        Functions.GetSafeFileName(BehideDesign.Link)))
                {
                    //TODO
                    Functions.ShowMessgeError("Có lỗi xảy ra trong quá trình gửi ảnh design lên web");
                    return;
                }
                if (product.product_image_design.Split(',')[1] != Functions.GetSafeFileName(BehideDesign.Link) && product.product_image_design.Split(',')[1] != "None")
                {
                    FTPAction.deleteFile(AppConfig.FTPHost,
                                         AppConfig.FTPUser,
                                         AppConfig.FTPPassword,
                                         FTPAction.localPathDesign,
                                         product.product_image_design.Split(',')[1]);
                }
            }

            // Luu database
            string product_image_design = string.Empty;

            product_image_design += (!FrontDesign.IsLocal) ? product.product_image_design.Split(',')[0] : ((FrontDesign.Link == string.Empty) ? "None" : Functions.GetSafeFileName(FrontDesign.Link).Replace(" ", ""));
            product_image_design += ",";
            product_image_design += (!BehideDesign.IsLocal) ? product.product_image_design.Split(',')[1] : ((BehideDesign.Link == string.Empty) ? "None" : Functions.GetSafeFileName(BehideDesign.Link).Replace(" ", ""));

            Product_Model pd = new Product_Model()
            {
                product_id           = product.product_id,
                product_image_design = product_image_design,
                product_link         = tb_LinkSP_direct.Text.Replace("\'", "\\\'"),
                product_title        = tb_title.Text.Replace("\'", "\\\'"),
                product_content      = rtb_content.Text.Replace("\'", "\\\'").Replace("\n", "<br/>"),
                color_list           = getColorList(),
                style_list           = pn_Image.getStyleList(),
                style_design         = pn_Image.getStyleDesign(),
                rangcost             = "$" + getMinCostStyle() + " - $" + getMaxCostStyle()
            };

            if (controller.EditProduct(pd))
            {
                Functions.ShowMessgeInfo("Edit success");
                IsChange = true;

                product.product_image_design = pd.product_image_design;
                product.product_link         = pd.product_link;
                product.product_title        = tb_title.Text;
                product.product_content      = rtb_content.Text;
                product.color_list           = pd.color_list;
                product.style_list           = pd.style_list;
                product.style_design         = pd.style_design;
                product.rangcost             = pd.rangcost;

                if (FrontDesign.IsLocal && product.product_image_design.Split(',')[0] != Functions.GetSafeFileName(FrontDesign.Link) && product.product_image_design.Split(',')[0] != "None")
                {
                    FTPAction.deleteFile(AppConfig.FTPHost,
                                         AppConfig.FTPUser,
                                         AppConfig.FTPPassword,
                                         FTPAction.localPathDesign,
                                         product.product_image_design.Split(',')[0]);
                }
                if (BehideDesign.IsLocal && product.product_image_design.Split(',')[1] != Functions.GetSafeFileName(BehideDesign.Link) && product.product_image_design.Split(',')[1] != "None")
                {
                    FTPAction.deleteFile(AppConfig.FTPHost,
                                         AppConfig.FTPUser,
                                         AppConfig.FTPPassword,
                                         FTPAction.localPathDesign,
                                         product.product_image_design.Split(',')[1]);
                }
            }
        }
コード例 #8
0
        public void InitData()
        {
            // Load Style
            clb_style.Items.Clear();
            clb_style.Items.AddRange(controller.getStyleList().ToArray());

            //Load Color
            lstColor = controller.getColorList();

            tb_TenSP.Text         = product.product_name;
            tb_LinkSP_direct.Text = product.product_link;
            tb_title.Text         = product.product_title;
            rtb_content.Text      = product.product_content.Replace("<br/>", "\n");

            //Fill Image design
            if (!product.product_image_design.Split(',')[0].Equals("None"))
            {
                byte[] data = null;
                if (FTPAction.getFile(AppConfig.FTPHost,
                                      AppConfig.FTPUser,
                                      AppConfig.FTPPassword,
                                      FTPAction.localPathDesign,
                                      product.product_image_design.Split(',')[0],
                                      ref data))
                {
                    Image i;
                    if ((i = Functions.getImage(data)) != null)
                    {
                        FrontDesign = new ImageAttachModel()
                        {
                            IsLocal = false,
                            bm      = (Bitmap)i,
                            Link    = string.Empty
                        };
                    }
                    else
                    {
                        FrontDesign = new ImageAttachModel()
                        {
                            IsLocal = true,
                            Link    = string.Empty
                        };
                    }
                }
                else
                {
                    FrontDesign = new ImageAttachModel()
                    {
                        IsLocal = true,
                        Link    = string.Empty
                    };
                }
            }
            else
            {
                FrontDesign = new ImageAttachModel()
                {
                    IsLocal = true,
                    Link    = string.Empty
                };
            }
            if (!product.product_image_design.Split(',')[1].Equals("None"))
            {
                byte[] data = null;
                if (FTPAction.getFile(AppConfig.FTPHost,
                                      AppConfig.FTPUser,
                                      AppConfig.FTPPassword,
                                      FTPAction.localPathDesign,
                                      product.product_image_design.Split(',')[0],
                                      ref data))
                {
                    Image i;
                    if ((i = Functions.getImage(data)) != null)
                    {
                        BehideDesign = new ImageAttachModel()
                        {
                            IsLocal = false,
                            bm      = (Bitmap)i,
                            Link    = string.Empty
                        };
                    }
                    else
                    {
                        BehideDesign = new ImageAttachModel()
                        {
                            IsLocal = true,
                            Link    = string.Empty
                        };
                    }
                }
                else
                {
                    BehideDesign = new ImageAttachModel()
                    {
                        IsLocal = true,
                        Link    = string.Empty
                    };
                }
            }
            else
            {
                BehideDesign = new ImageAttachModel()
                {
                    IsLocal = true,
                    Link    = string.Empty
                };
            }

            // Fill style and color
            var serializer = new JavaScriptSerializer();

            serializer.RegisterConverters(new[] { new DynamicJsonConverter() });

            string json = "{" + product.style_design.Substring(19, product.style_design.Length - 21).Replace(", }", "}") + "}";
            var    obj  = serializer.Deserialize <Dictionary <string, object> >(json);

            foreach (var kv in obj)
            {
                int style = Int32.Parse(kv.Key.Substring(1));
                for (int i = 0; i < clb_style.Items.Count; i++)
                {
                    if ((clb_style.Items[i] as Product_Style_Model).Id == style)
                    {
                        clb_style.SetItemChecked(i, true);
                        break;
                    }
                }

                foreach (var item in kv.Value as Dictionary <string, object> )
                {
                    if (item.Key.Equals("cl"))
                    {
                        pn_Image.setChoosenColorListbyId(Functions.GetList(item.Value.ToString(), ','), style);
                    }
                    if (item.Key.Equals("t"))
                    {
                        pn_Image.setLocationandSizeFrontDesignbyId(new Point(Int32.Parse(item.Value.ToString().Split('@')[0].Split('!')[0]),
                                                                             Int32.Parse(item.Value.ToString().Split('@')[0].Split('!')[1])),
                                                                   new Size(Int32.Parse(item.Value.ToString().Split('@')[1].Split('!')[0]),
                                                                            Int32.Parse(item.Value.ToString().Split('@')[1].Split('!')[1])),
                                                                   style);
                    }
                    if (item.Key.Equals("s"))
                    {
                        pn_Image.setLocationandSizeBehindDesignbyId(new Point(Int32.Parse(item.Value.ToString().Split('@')[0].Split('!')[0]),
                                                                              Int32.Parse(item.Value.ToString().Split('@')[0].Split('!')[1])),
                                                                    new Size(Int32.Parse(item.Value.ToString().Split('@')[1].Split('!')[0]),
                                                                             Int32.Parse(item.Value.ToString().Split('@')[1].Split('!')[1])),
                                                                    style);
                    }
                }
            }
        }
コード例 #9
0
        private void InitData()
        {
            pn_color.BackColor       = product_color.Colors;
            pn_style.BackgroundImage = Image.FromFile(Application.StartupPath + "/ImageModel/s" + order.style_id + ".png");
            if (!product.product_image_design.Split(',')[0].Equals("None"))
            {
                byte[] data = null;
                if (FTPAction.getFile(AppConfig.FTPHost,
                                      AppConfig.FTPUser,
                                      AppConfig.FTPPassword,
                                      FTPAction.localPathDesign,
                                      product.product_image_design.Split(',')[0],
                                      ref data))
                {
                    Image i;
                    if ((i = Functions.getImage(data)) != null)
                    {
                        pic_design.Image = i;
                        string style_desgn = Functions.getValueinJoin(product.style_design, "t");
                        if (style_desgn.Equals(string.Empty))
                        {
                            pic_design.Visible = false;
                        }
                        else
                        {
                            pic_design.Location = new Point(Int32.Parse(style_desgn.Split('@')[0].Split('!')[0]) / 2,
                                                            Int32.Parse(style_desgn.Split('@')[0].Split('!')[1]) / 2);
                            pic_design.Size = new Size(Int32.Parse(style_desgn.Split('@')[1].Split('!')[0]) / 2,
                                                       Int32.Parse(style_desgn.Split('@')[1].Split('!')[1]) / 2);
                        }
                    }
                    else
                    {
                        pic_design.Visible = false;
                    }
                }
                else
                {
                    pic_design.Visible = false;
                }
            }
            else
            {
                pic_design.Visible = false;
            }


            llb_product_link.Text         = product.product_link;
            llb_product_link.LinkClicked += Llb_product_link_LinkClicked;
            lb_quantity.Text              = "Số lượng: " + order.quantity;
            lb_user.Text          = "User: "******"Thời gian: " + order.createDate.ToString("yyyy-MM-dd HH:mm:ss");
            lb_email.Text         = "Email: " + order.email;
            lb_firstname.Text     = "Họ: " + order.firstname;
            lb_lastname.Text      = "Tên: " + order.lastname;
            lb_streetaddress.Text = "địa chỉ: " + order.street_address;
            lb_optional.Text      = "Địa chỉ (optional): " + order.apt_suite_other;
            lb_city.Text          = "Thành phố: " + order.city;
            lb_postcode.Text      = "Mã bưu chính: " + order.postal_code;
            lb_country.Text       = "Quốc gia: " + ((controller.getCountrybyId(order.country_id) == null) ? string.Empty : controller.getCountrybyId(order.country_id).country_name);
            lb_phonenum.Text      = "Số điện thoại: " + order.phone_number;
            lb_provine.Text       = "Bang: " + order.province;
        }
コード例 #10
0
        private void Btn_Addproduct_Click(object sender, EventArgs e)
        {
            if (pn_Image != null)
            {
                if (tb_TenSP.Text.Equals(string.Empty))
                {
                    // TODO
                    Functions.ShowMessgeError("Chưa nhập thông tin \"tên sản phẩm\"");
                    return;
                }
                if (tb_LinkSP_direct.Text.Equals(string.Empty))
                {
                    // TODO
                    Functions.ShowMessgeError("Chưa nhập thông tin \"link sản phẩm\"");
                    return;
                }
                if (tb_title.Text.Equals(string.Empty))
                {
                    // TODO
                    Functions.ShowMessgeError("Chưa nhập thông tin \"title sản phẩm\"");
                    return;
                }
                if (rtb_content.Text.Equals(string.Empty))
                {
                    // TODO
                    Functions.ShowMessgeError("Chưa nhập thông tin \"content sản phẩm\"");
                    return;
                }
                if (clb_style.CheckedItems.Count == 0)
                {
                    // TODO
                    Functions.ShowMessgeError("Chưa chọn bất cứ style nào cho sản phẩm");
                    return;
                }
                string FeaturedImage          = string.Empty;
                bool   IsFeaturedProduct      = false;
                string ExtensionFeaturedImage = string.Empty;
                string Catogarys     = string.Empty;
                string HashTagString = string.Empty;
                bool   IsFront;
                using (AdditionalProductView view = new AdditionalProductView(getParent().controller))
                {
                    if (view.ShowDialog() == DialogResult.OK)
                    {
                        FeaturedImage          = view.ImageFileName;
                        IsFeaturedProduct      = view.IsFeaturedProduct;
                        ExtensionFeaturedImage = view.ExtensionImage;
                        Catogarys     = view.AllCatogary;
                        HashTagString = view.HashTagString;
                        IsFront       = view.IsFront;
                    }
                    else
                    {
                        return;
                    }
                }
                string ProductLink = CheckExistProductLink(Functions.getWebNameValid(tb_TenSP.Text));
                if (ProductLink == string.Empty)
                {
                    Functions.ShowMessgeError("Không có kết nối DB");
                    return;
                }
                // Gui anh Feature lên thu muc
                if (FeaturedImage != string.Empty)
                {
                    if (!FTPAction.sendFile(AppConfig.FTPHost,
                                            AppConfig.FTPUser,
                                            AppConfig.FTPPassword,
                                            FTPAction.localPathFeaturedImage,
                                            ProductLink + ExtensionFeaturedImage,
                                            Functions.GetPathFileName(FeaturedImage),
                                            Functions.GetSafeFileName(FeaturedImage)))
                    {
                        //TODO
                        Functions.ShowMessgeError("Có lỗi xảy ra trong quá trình gửi ảnh Featured lên web");
                        return;
                    }
                }

                // Gui anh design lên thu muc
                if (FrontDesignFileName != string.Empty)
                {
                    if (!FTPAction.sendFile(AppConfig.FTPHost,
                                            AppConfig.FTPUser,
                                            AppConfig.FTPPassword,
                                            FTPAction.localPathDesign,
                                            Functions.GetSafeFileName(FrontDesignFileName).Replace(" ", ""),
                                            Functions.GetPathFileName(FrontDesignFileName),
                                            Functions.GetSafeFileName(FrontDesignFileName)))
                    {
                        //TODO
                        Functions.ShowMessgeError("Có lỗi xảy ra trong quá trình gửi ảnh design lên web");
                        return;
                    }
                }
                if (BehideDesignFileName != string.Empty)
                {
                    if (!FTPAction.sendFile(AppConfig.FTPHost,
                                            AppConfig.FTPUser,
                                            AppConfig.FTPPassword,
                                            FTPAction.localPathDesign,
                                            Functions.GetSafeFileName(BehideDesignFileName).Replace(" ", ""),
                                            Functions.GetPathFileName(BehideDesignFileName),
                                            Functions.GetSafeFileName(BehideDesignFileName)))
                    {
                        //TODO
                        Functions.ShowMessgeError("Có lỗi xảy ra trong quá trình gửi ảnh design lên web");
                        return;
                    }
                }



                // Luu database
                string product_image_design = string.Empty;
                product_image_design += (FrontDesignFileName == string.Empty) ? "None" : Functions.GetSafeFileName(FrontDesignFileName).Replace(" ", "");
                product_image_design += ",";
                product_image_design += (BehideDesignFileName == string.Empty) ? "None" : Functions.GetSafeFileName(BehideDesignFileName).Replace(" ", "");

                Product_Model pd = new Product_Model()
                {
                    product_name         = tb_TenSP.Text.Replace("\'", "\\\'"),
                    product_image_design = product_image_design,
                    product_link         = tb_LinkSP_direct.Text.Replace("\'", "\\\'"),
                    product_title        = tb_title.Text.Replace("\'", "\\\'"),
                    product_content      = rtb_content.Text.Replace("\'", "\\\'").Replace("\n", "<br/>"),
                    color_list           = getColorList(),
                    style_list           = pn_Image.getStyleList(),
                    style_design         = pn_Image.getStyleDesign(),
                    linkFeaturedImage    = ProductLink + ExtensionFeaturedImage,
                    linkProduct          = ProductLink,
                    isFeaturedProduct    = IsFeaturedProduct,
                    Catogarys            = Catogarys,
                    rangcost             = "$" + getMinCostStyle() + " - $" + getMaxCostStyle(),
                    hashtag       = HashTagString,
                    isFrontVision = IsFront
                };
                if (!getParent().controller.Addproduct(pd))
                {
                    //TODO
                    Functions.ShowMessgeError("Có lỗi xảy ra trong quá trình ghi Database");
                    return;
                }

                //TODO Info
                Functions.ShowMessgeInfo("Add product thành công");
                Functions.ShowMaiQuynhAnh();
            }
        }
コード例 #11
0
ファイル: MainForm.cs プロジェクト: ChristopherY5/HP-PUS
 private void radioResetSerial_CheckedChanged(object sender, EventArgs e)
 {
     if (radioResetSerial.Checked)
         currentFTPAction = FTPAction.RESET_SERIAL;
     else if (radioResetPage.Checked)
         currentFTPAction = FTPAction.RESET_PAGE;
     else if (radioMaint.Checked)
         currentFTPAction = FTPAction.RESET_MAIN;
 }