コード例 #1
0
 protected Category LoadCategoryItem(category cat, Category dataItem)
 {
     dataItem.CategoryID = cat.id;
     dataItem.CategoryName = cat.name;
     dataItem.Url = Regex.Replace(cat.name.Trim().ToLower(), @"[^\p{L}\-\!\$\(\)\=\@\d_\'\.]+", "-");
     return dataItem;
 }
コード例 #2
0
ファイル: Dish.cs プロジェクト: chaimMili/myProject1
 public Dish(int dishNumber, string dishName, category dishCategory, float dishPrice, kosherLevel kosherLevel)
 {
     DishNumber = dishNumber;
     DishName = dishName;
     DishCategory = dishCategory;           
     DishPrice = dishPrice;
     this.kosherLevel = kosherLevel;
 }
コード例 #3
0
ファイル: Service.cs プロジェクト: MShah890/Eventica
 public bool InsertCategory(category obj)
 {
     try
     {
         dbcontext.categories.InsertOnSubmit(obj);
         dbcontext.SubmitChanges();
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }
コード例 #4
0
 protected Category GetCategory(category cat, out bool isNew)
 {
     Category category;
     isNew = false;
     var result = from c in objectScope.Extent<Category>()
                  where c.CategoryID == cat.id
                  select c;
     if (result.Count() <= 0)
     {
         category = new Category();
         isNew = true;
     }
     else
         category = (Category)result.First();
     return category;
 }
コード例 #5
0
ファイル: NewCategoryForm.cs プロジェクト: cadore/TruckSystem
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!validator.Validate())
                return;

            try
            {
                category c = new category()
                {
                    name = tfCategoryName.EditValue.ToString(),
                    type = (int)CategoryT
                };
                c.Save();
                this.DialogResult = DialogResult.OK;
                XtraMessageBox.Show("Categoria cadastrada com sucesso!");
            }
            catch (Exception ex)
            {
                this.DialogResult = DialogResult.Cancel;
                XtraMessageBox.Show(String.Format("Ocorreu um erro:\n\n{0}\n{1}", ex.Message, ex.InnerException));
            }
            this.Close();
        }
コード例 #6
0
 public void deleteJob(category o)
 {
     utOfWork.CategoryRepository.Delete(o);
     utOfWork.Commit();
 }
コード例 #7
0
 public void addElement(int year, String title, category categori)
 {
     int sizeOfArray = ob.Length;
     ob[sizeOfArray++] = new HistoricalEvent(year, title, categori);
 }
コード例 #8
0
 public void AddService(category o)
 {
     utOfWork.CategoryRepository.Add(o);
     utOfWork.Commit();
 }
コード例 #9
0
 public category GetCategoryByID(int categoryID)
 {
     record = myRecords.FirstOrDefault(e => e.categoryID == categoryID);
     return(record);
 }
コード例 #10
0
 public void DeleteCategory(category record)
 {
     myRecords.Remove(record);
     context.categories.Remove(record);
     context.SaveChanges();
 }
コード例 #11
0
        private void determineCaseIdItemList(Panel panel, string comboBoxName, category Category)
        {
            foreach (Control c in panel.Controls)
            {
                if (c is ComboBox)
                {
                    if (c.Name.ToString().Equals(comboBoxName))
                    {
                        ComboBox C = new ComboBox();
                        C = (ComboBox)c;

                        switch (Category)
                        {
                            case category.Distribution:
                                SetDistribuctionItemList(((ComboBox)c));
                                C.TextChanged += new System.EventHandler(ComboBoxDistributionTextSelected);
                                C.SelectedIndexChanged += new System.EventHandler(ComboBoxIndexChanged);
                                break;
                            case category.Transmission:
                                SetTransmissionItemList(((ComboBox)c));
                                C.TextChanged += new System.EventHandler(ComboBoxTransmissionTextSelected);
                                C.SelectedIndexChanged += new System.EventHandler(ComboBoxIndexChanged);
                                break;
                        }
                    }
                }
            }
        }
コード例 #12
0
    public void order_detail_inner(HtmlGenericControl divcollapse_inner, string order_id, string sendprice, string totalprice)
    {
        orderlist          orlist        = new orderlist();
        category           cat           = new category();
        brand              brnd          = new brand();
        DataTable          product_order = orlist.get_product_order(order_id);
        products           pro           = new products();
        HtmlGenericControl table_order   = new HtmlGenericControl("table");

        table_order.Attributes.Add("class", "table table-items");
        HtmlGenericControl table_head    = new HtmlGenericControl("thead");
        HtmlGenericControl tr_table_head = new HtmlGenericControl("tr");

        HtmlGenericControl th_name_tr_table_head = new HtmlGenericControl("th");

        th_name_tr_table_head.Attributes.Add("colspan", "2");
        th_name_tr_table_head.InnerHtml = "مشخصات محصول";
        tr_table_head.Controls.Add(th_name_tr_table_head);

        HtmlGenericControl th_number_tr_table_head     = new HtmlGenericControl("th");
        HtmlGenericControl div_th_number_tr_table_head = new HtmlGenericControl("div");

        div_th_number_tr_table_head.Attributes.Add("class", "align-center");
        div_th_number_tr_table_head.InnerText = "تعداد";
        th_number_tr_table_head.Controls.Add(div_th_number_tr_table_head);
        tr_table_head.Controls.Add(th_number_tr_table_head);

        HtmlGenericControl th_unitprice_tr_table_head     = new HtmlGenericControl("th");
        HtmlGenericControl div_th_unitprice_tr_table_head = new HtmlGenericControl("div");

        div_th_unitprice_tr_table_head.Attributes.Add("class", "align-right");
        div_th_unitprice_tr_table_head.InnerText = "قیمت واحد";
        th_unitprice_tr_table_head.Controls.Add(div_th_unitprice_tr_table_head);
        tr_table_head.Controls.Add(th_unitprice_tr_table_head);

        HtmlGenericControl th_price_tr_table_head     = new HtmlGenericControl("th");
        HtmlGenericControl div_th_price_tr_table_head = new HtmlGenericControl("div");

        div_th_price_tr_table_head.Attributes.Add("class", "align-right");
        div_th_price_tr_table_head.InnerText = "قیمت کل";
        th_price_tr_table_head.Controls.Add(div_th_price_tr_table_head);
        tr_table_head.Controls.Add(th_price_tr_table_head);


        table_head.Controls.Add(tr_table_head);
        table_order.Controls.Add(table_head);


        HtmlGenericControl table_body_order = new HtmlGenericControl("tbody");
        int total_price = 0;

        foreach (DataRow dr in product_order.Rows)
        {
            string             catname   = cat.getcategory(dr["cat_id"].ToString()).Rows[0]["name"].ToString();
            string             brandname = brnd.getbrandbyid(dr["brand_id"].ToString()).Rows[0]["name"].ToString();
            DataTable          pic       = pro.getonepic(int.Parse(dr["product_id"].ToString()));
            HtmlGenericControl tr        = new HtmlGenericControl("tr");
            HtmlGenericControl tdimg     = new HtmlGenericControl("td");
            tdimg.Attributes.Add("class", "image");
            HtmlGenericControl img = new HtmlGenericControl("img");
            img.Attributes.Add("src", "images/Ppic/" + pic.Rows[0]["name"].ToString() + ".jpg");
            img.Attributes.Add("alt", "");
            img.Attributes.Add("width", "50");
            img.Attributes.Add("height", "50");
            tdimg.Controls.Add(img);
            tr.Controls.Add(tdimg);//finish td img

            HtmlGenericControl tddesc = new HtmlGenericControl("td");
            tddesc.Attributes.Add("class", "desc");
            tddesc.InnerText = catname + "-" + brandname + " - " + dr["name"].ToString();


            tr.Controls.Add(tddesc);//finish td by class desc

            HtmlGenericControl tdqty = new HtmlGenericControl("td");
            tdqty.Attributes.Add("class", "qty");
            HtmlGenericControl divnumber = new HtmlGenericControl("div");
            divnumber.Attributes.Add("class", "numbered");
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            //HtmlInputText input = new HtmlInputText();
            HtmlGenericControl input = new HtmlGenericControl("input");
            input.Attributes.Add("name", "input_number" + dr["id"].ToString());
            input.Attributes.Add("class", "tiny-size");
            input.Attributes.Add("value", dr["count"].ToString());
            input.Attributes.Add("type", "text");
            input.Attributes.Add("readonly", "readonly");
            input.Attributes.Add("id", "input_number" + dr["id"].ToString());
            divnumber.Controls.Add(input); //finish input
            tdqty.Controls.Add(divnumber);
            tr.Controls.Add(tdqty);        //finish td by class qty

            HtmlGenericControl td_unit_price = new HtmlGenericControl("td");
            td_unit_price.Attributes.Add("class", "price");
            td_unit_price.InnerText = dr["price"].ToString() + "  ریال  ";
            tr.Controls.Add(td_unit_price);//finish td price

            HtmlGenericControl tdprice = new HtmlGenericControl("td");
            tdprice.Attributes.Add("class", "price");
            tdprice.InnerText = ((Int32)dr["price"] * (Int16)dr["count"]).ToString() + "  ریال  ";
            tr.Controls.Add(tdprice);//finish td price
            table_body_order.Controls.Add(tr);
            total_price += (Int32)dr["price"] * (Int16)dr["count"];
        }


        HtmlGenericControl tr_send_price = new HtmlGenericControl("tr");
        HtmlGenericControl td_space      = new HtmlGenericControl("td");

        td_space.Attributes.Add("colspan", "3");
        td_space.Attributes.Add("rowspan", "3");
        td_space.Controls.Add(new LiteralControl("&nbsp;"));
        tr_send_price.Controls.Add(td_space);

        HtmlGenericControl td_stronger_lable = new HtmlGenericControl("td");

        td_stronger_lable.Attributes.Add("class", "stronger");
        td_stronger_lable.InnerText = "هزينه ارسال :";
        tr_send_price.Controls.Add(td_stronger_lable);


        HtmlGenericControl td_stronger_price = new HtmlGenericControl("td");

        td_stronger_price.Attributes.Add("class", "stronger");
        HtmlGenericControl div_td_stronger_price = new HtmlGenericControl("div");

        div_td_stronger_price.Attributes.Add("class", "align-right");
        div_td_stronger_price.InnerText = sendprice + " ریال";
        td_stronger_price.Controls.Add(div_td_stronger_price);
        tr_send_price.Controls.Add(td_stronger_price);
        table_body_order.Controls.Add(tr_send_price);

        HtmlGenericControl tr_total_price = new HtmlGenericControl("tr");
        HtmlGenericControl td_stronger_lable_totalprice = new HtmlGenericControl("td");

        td_stronger_lable_totalprice.Attributes.Add("class", "stronger");
        td_stronger_lable_totalprice.InnerText = "جمع کل :";
        tr_total_price.Controls.Add(td_stronger_lable_totalprice);


        HtmlGenericControl td_stronger_totalprice = new HtmlGenericControl("td");

        td_stronger_totalprice.Attributes.Add("class", "stronger");
        HtmlGenericControl div_td_stronger_totalprice = new HtmlGenericControl("div");

        div_td_stronger_totalprice.Attributes.Add("class", "size-16 align-right");
        div_td_stronger_totalprice.InnerText = total_price + " ریال";
        td_stronger_totalprice.Controls.Add(div_td_stronger_totalprice);
        tr_total_price.Controls.Add(td_stronger_totalprice);
        table_body_order.Controls.Add(tr_total_price);


        table_order.Controls.Add(table_body_order);
        divcollapse_inner.Controls.Add(table_order);
    }
コード例 #13
0
 partial void Deletecategory(category instance);
コード例 #14
0
 public ActionResult CategoryDetail(int ID)
 {
     var user = db.dt_user.FirstOrDefault();
     if (Session["personel_id"] == null)
         return RedirectToAction("Default", "Home");
     else
     {
         int personel_id = Convert.ToInt32(Session["personel_id"]);
         user = db.dt_user.Where(a => a.state == 1 && a.ID == personel_id).FirstOrDefault();
         if (user == null)
             return RedirectToAction("Default", "Home");
         ViewBag.userName = user.name + " " + user.surname;
     }
     var cat = db.dt_category.Where(a => a.ID == ID && a.state == 1 && a.company_id == user.company_id).FirstOrDefault();
     if (cat != null)
     {
         string upCategory = db.dt_category.Where(a => a.state == 1 && a.ID == cat.upCategoryID && a.company_id == cat.company_id).Select(a => a.name).FirstOrDefault();
         if (upCategory == "" || upCategory == null)
             upCategory = "Üst Kategori";
         category c = new category
         {
             upCategory = upCategory,
             name = cat.name,
             Id = cat.ID,
             summary = cat.summary
         };
         return View(c);
     }
     else
         return RedirectToAction("CategoryShow", "Category");
 }
コード例 #15
0
 partial void Insertcategory(category instance);
コード例 #16
0
 partial void Updatecategory(category instance);
コード例 #17
0
 public void Update(category CoverType)
 {
     throw new NotImplementedException();
 }
コード例 #18
0
 //cập nhật danh mục
 public void updateCategory(category category)
 {
     categoryDAO.updateCategory(category);
 }
コード例 #19
0
 public BOOK(int ISDN, string BookName, string Author ,string Publisher,category cate,int Price)
 {
     this.isdn = ISDN;
     this.name = BookName;
     this.auth = Author;
     this.pub = Publisher;
     this.cate = cate;
     this.pri = Price;
 }
コード例 #20
0
 public int  AddCategory(category category)
 {
     return(adminData.AddCategory(category));
 }
コード例 #21
0
 partial void Updatecategory(category instance);
コード例 #22
0
 public static category Createcategory(int category_id)
 {
     category category = new category();
     category.category_id = category_id;
     return category;
 }
コード例 #23
0
 partial void Deletecategory(category instance);
コード例 #24
0
 private void AddMessage(string message, category cat)
 {
     message = message.Insert(0, DateTime.Now.ToString() + ": ");
     log(message, cat);
 }
コード例 #25
0
 return(await _cache.GetOrUpdateAsync <T>(category, id, async() => await _bucket.ConsumeCompliant(updateFunc)).ConfigureAwait(false));
コード例 #26
0
 public void SetCategory(category cat)
 {
     this.Category = cat;
     this.Image    = Image.FromFile(imagePaths[(int)Category]);
 }
コード例 #27
0
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        using (category obj = new category())
        {
            obj._name = txtcname.Text.ToString();
            obj._rank = Convert.ToInt64(txtrank.Text.ToString());
            obj._pid  = Convert.ToInt16(ddlparentid.SelectedValue);
            obj._desc = txtdesc.Text.ToString();
            if (ckbactive.Checked == true)
            {
                obj._active = true;
            }
            else
            {
                obj._active = false;
            }
            if (fucimage.Visible == true)
            {
                if (fucimage.HasFile)
                {
                    // Bitmap bmp = new Bitmap(FileTest.PostedFile.InputStream);
                    Bitmap   bmp    = new Bitmap(fucimage.PostedFile.InputStream);
                    Graphics canvas = Graphics.FromImage(bmp);
                    try
                    {
                        Bitmap bmpNew = new Bitmap(bmp.Width, bmp.Height);
                        canvas = Graphics.FromImage(bmpNew);
                        canvas.DrawImage(bmp, new Rectangle(0, 0, bmpNew.Width, bmpNew.Height), 0, 0, bmp.Width, bmp.Height, GraphicsUnit.Pixel);
                        bmp = bmpNew;
                    }
                    catch (Exception ee)     // Catch exceptions
                    {
                        Response.Write(ee.Message);
                    }
                    // Here replace "Text" with your text and you also can assign Font Family, Color, Position Of Text etc.
                    canvas.DrawString("Dream Multimedia", new Font("Verdana", 20, FontStyle.Bold), new SolidBrush(Color.FromArgb(70, 255, 255, 255)), (20), (bmp.Height / 2));
                    // Save or display the image where you want.
                    bmp.Save(System.Web.HttpContext.Current.Server.MapPath("upload\\category\\") + fucimage.PostedFile.FileName, System.Drawing.Imaging.ImageFormat.Jpeg);

                    //fucimage.SaveAs(Server.MapPath("upload\\category\\") + fucimage.FileName);

                    obj._image = fucimage.FileName.ToString();
                }
            }
            else
            {
                obj._image = ViewState["image"].ToString();
            }
            if (btnsubmit.Text == "Update")
            {
                obj._id = Convert.ToInt64(Request.QueryString["id"].ToString());
                //if (!fucimage.HasFile)
                //{
                //    obj._image = ViewState["Image"].ToString();
                //}
                obj.category_update();
                Response.Redirect("Categoryrepeater.aspx?flag=edit");
            }
            else
            {
                obj.category_insert();
                Response.Redirect("Categoryrepeater.aspx?flag=add");
            }
        }
    }
コード例 #28
0
 public void AddRecord(category Record)
 {
     myRecords.Add(record);
 }
コード例 #29
0
 //ánh xạ update qa linq
 public void setUpdateCategory(category ctDB, category ctUpdate)
 {
     ctDB.categoryName = ctUpdate.categoryName;
 }
コード例 #30
0
 public int GetByCategoryName(string CategoryName)
 {
     record = myRecords.FirstOrDefault(e => e.CategoryName == CategoryName);
     return(record.categoryID);
 }
コード例 #31
0
        // GET: suppliers
        public ActionResult listado(string Error, string searchStr = "", int searchCategoryId = 0)
        {
            if (Session["USER_ID"] != null)
            {
                try
                {
                    long userId  = (long)Session["USER_ID"];
                    user curUser = entities.users.Find(userId);
                    List <ShowMessage>        pubMessageList = ep.GetChatMessages(userId);
                    List <supplier>           supplierList   = new List <supplier>();
                    Dictionary <long, string> categoryDict   = new Dictionary <long, string>();

                    long communityAct = Convert.ToInt64(Session["CURRENT_COMU"]);
                    if (searchStr == "" && searchCategoryId == 0)
                    {
                        var query = (from r in entities.suppliers where r.status == 1 select r);
                        supplierList = query.ToList();
                    }
                    else if (searchStr != "" && searchCategoryId == 0)
                    {
                        var query1 = (from r in entities.suppliers
                                      where r.contact_name.Contains(searchStr) == true && r.status == 1
                                      select r);
                        supplierList = query1.ToList();
                    }
                    else if (searchStr == "" && searchCategoryId != 0)
                    {
                        var query2 = (from r in entities.suppliers
                                      where r.category_id == searchCategoryId && r.status == 1
                                      select r
                                      );
                        supplierList = query2.ToList();
                    }
                    else
                    {
                        var query3 = (from r in entities.suppliers
                                      where r.contact_name.Contains(searchStr) == true &&
                                      r.category_id == searchCategoryId && r.status == 1
                                      select r);
                        supplierList = query3.ToList();
                    }


                    foreach (var item in supplierList)
                    {
                        category category = entities.categories.Find(item.category_id);
                        categoryDict.Add(item.id, category.name);
                    }
                    suppliersViewModel viewModel = new suppliersViewModel();

                    titulosList             = ep.GetTitulosByTitular(userId);
                    listComunities          = ep.GetCommunityListByTitular(titulosList);
                    viewModel.communityList = listComunities;

                    viewModel.side_menu              = "suppliers";
                    viewModel.supplierList           = supplierList;
                    viewModel.document_category_list = entities.document_type.Where(x => x.community_id == communityAct).ToList();
                    viewModel.categoryDict           = categoryDict;
                    viewModel.curUser          = curUser;
                    viewModel.categoryList     = entities.categories.ToList();
                    viewModel.searchCategoryId = searchCategoryId;
                    viewModel.searchStr        = searchStr;
                    viewModel.pubTaskList      = ep.GetNotifiTaskList(userId);
                    viewModel.pubMessageList   = pubMessageList;
                    viewModel.messageCount     = ep.GetUnreadMessageCount(pubMessageList);
                    ViewBag.msgError           = Error;
                    return(View(viewModel));
                }
                catch (Exception ex)
                {
                    return(Redirect(Url.Action("error", "control", new { Error = "Error al obtener listado de suplidores: " + ex })));
                }
            }
            else
            {
                return(Redirect(ep.GetLogoutUrl()));
            }
        }
コード例 #32
0
ファイル: Log.cs プロジェクト: plunch/sdlsharp
 set => SDL_LogSetPriority(category, value);
コード例 #33
0
        public ActionResult versuplidor(long?supplier_id)
        {
            if (Session["USER_ID"] != null)
            {
                if (supplier_id != null)
                {
                    supplier supplier = entities.suppliers.Find(supplier_id);
                    if (supplier != null)
                    {
                        if (supplier.status == 1)
                        {
                            try
                            {
                                long communityAct = Convert.ToInt64(Session["CURRENT_COMU"]);
                                long userId       = (long)Session["USER_ID"];
                                List <ShowMessage> pubMessageList = ep.GetChatMessages(userId);
                                user                 curUser      = entities.users.Find(userId);
                                category             category     = entities.categories.Find(supplier.category_id);
                                versuplidorViewModel viewModel    = new versuplidorViewModel();

                                titulosList             = ep.GetTitulosByTitular(userId);
                                listComunities          = ep.GetCommunityListByTitular(titulosList);
                                viewModel.communityList = listComunities;

                                viewModel.side_menu     = "suppliers";
                                viewModel.category_name = category.name;
                                viewModel.viewSupplier  = supplier;
                                List <comment> commentList = entities.comments.Where(m => m.supplier_id == supplier_id).ToList();
                                viewModel.commentList            = commentList;
                                viewModel.document_category_list = entities.document_type.Where(x => x.community_id == communityAct).ToList();
                                viewModel.curUser        = curUser;
                                viewModel.pubTaskList    = ep.GetNotifiTaskList(userId);
                                viewModel.pubMessageList = pubMessageList;
                                viewModel.messageCount   = ep.GetUnreadMessageCount(pubMessageList);
                                return(View(viewModel));
                            }
                            catch (Exception ex)
                            {
                                return(Redirect(Url.Action("listado", "suplidores", new { Error = "Problema interno " + ex.Message })));
                            }
                        }
                        else
                        {
                            return(Redirect(Url.Action("listado", "suplidores", new { area = "coadmin", Error = "El suplidor al que desea acceder fue desactivado" })));
                        }
                    }
                    else
                    {
                        return(Redirect(Url.Action("listado", "suplidores", new { area = "coadmin", Error = "No existe ese elemento" })));
                    }
                }
                else
                {
                    return(Redirect(Url.Action("listado", "suplidores")));
                }
            }
            else
            {
                return(Redirect(ep.GetLogoutUrl()));
            }
        }
コード例 #34
0
 public HistoricalEvent(int number) { Console.WriteLine("Параметров три: число, строка, строка"); }      //конструктор 2
 public HistoricalEvent(int year, String title, category categori)                                         //конструктор 3
 {
     this.year = year;
     this.title = title;
     this.categori = categori;
 }
コード例 #35
0
    private void Choseiav()
    {
        int tag;

        // throw new NotImplementedException();
        using (product obj = new product())
        {
            obj._id = Convert.ToInt64(Request.QueryString["sid"].ToString());
            DataSet ds = new DataSet();
            ds = obj.product_details();
            if (ds.Tables[0].Rows.Count > 0)
            {
                using (category objc = new category())
                {
                    objc._id = Convert.ToInt64(ds.Tables[0].Rows[0]["cid"].ToString());
                    DataSet dsr = new DataSet();
                    dsr = objc.category_selectbyid();
                    if (dsr.Tables[0].Rows.Count > 0)
                    {
                        tag = Convert.ToInt32(dsr.Tables[0].Rows[0]["ParentID"].ToString());
                        if (tag == 2)
                        {
                            imgpd.Src += ds.Tables[0].Rows[0]["image"].ToString();
                            using (productparameter objp = new productparameter())
                            {
                                objp._pdid = Convert.ToInt64(Request.QueryString["sid"].ToString());
                                objp._prid = Convert.ToInt64("2");
                                DataSet dsp = new DataSet();
                                dsp = objp.productparameter_select_byparameterid();
                                if (dsp.Tables[0].Rows.Count > 0)
                                {
                                    aimg.HRef += dsp.Tables[0].Rows[0]["OProduct"].ToString();
                                }
                            }

                            image.Visible   = true;
                            video.Visible   = false;
                            audio.Visible   = false;
                            lblrelated.Text = "Image";
                        }
                        if (tag == 3)
                        {
                            using (productparameter objp = new productparameter())
                            {
                                objp._pdid = Convert.ToInt64(Request.QueryString["sid"].ToString());
                                objp._prid = Convert.ToInt64("6");
                                DataSet dsp = new DataSet();
                                dsp = objp.productparameter_select_byparameterid();
                                if (dsp.Tables[0].Rows.Count > 0)
                                {
                                    //aimg.HRef += dsp.Tables[0].Rows[0]["OProduct"].ToString();
                                    flashvideo.VideoURL += dsp.Tables[0].Rows[0]["OProduct"].ToString();
                                }
                            }

                            image.Visible   = false;
                            video.Visible   = true;
                            audio.Visible   = false;
                            lblrelated.Text = "Video";
                        }
                        if (tag == 4)
                        {
                            img1.Src += ds.Tables[0].Rows[0]["image"].ToString();
                            using (productparameter objp = new productparameter())
                            {
                                objp._pdid = Convert.ToInt64(Request.QueryString["sid"].ToString());
                                objp._prid = Convert.ToInt64("10");
                                DataSet dsp = new DataSet();
                                dsp = objp.productparameter_select_byparameterid();
                                if (dsp.Tables[0].Rows.Count > 0)
                                {
                                    audio1.AudioURL += dsp.Tables[0].Rows[0]["OProduct"].ToString();
                                }
                            }

                            image.Visible   = false;
                            video.Visible   = false;
                            audio.Visible   = true;
                            lblrelated.Text = "Audio";
                        }
                    }
                }
            }
        }
    }
コード例 #36
0
 public void UpdateJob(category o)
 {
     utOfWork.CategoryRepository.Update(o);
     utOfWork.Commit();
 }
コード例 #37
0
    protected void ddlexcellst_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            if (ddlexcellst.SelectedIndex == 0)
            {
                Label2.Visible = true;
            }
            else
            {
                Label2.Visible = false;
                OAuth2Parameters      parameters_lst = oauthcredentials();
                GOAuth2RequestFactory requestFactory =
                    new GOAuth2RequestFactory(null, "Fusion-SpreadSheet", parameters_lst);
                SpreadsheetsService service = new SpreadsheetsService("Fusion-SpreadSheet");
                service.RequestFactory = requestFactory;


                service.RequestFactory = requestFactory;

                // TODO: Authorize the service object for a specific user (see other sections)

                // Instantiate a SpreadsheetQuery object to retrieve spreadsheets.
                SpreadsheetQuery query = new SpreadsheetQuery();

                // Make a request to the API and get all spreadsheets.
                SpreadsheetFeed feed = service.Query(query);

                if (feed.Entries.Count == 0)
                {
                    // TODO: There were no spreadsheets, act accordingly.
                }

                // TODO: Choose a spreadsheet more intelligently based on your
                // app's needs.
                SpreadsheetEntry spreadsheet = (SpreadsheetEntry)feed.Entries[Convert.ToInt32(ddlexcellst.SelectedIndex) - 1];
                //Response.Write(spreadsheet.Title.Text + "\n");

                // Get the first worksheet of the first spreadsheet.
                // TODO: Choose a worksheet more intelligently based on your
                // app's needs.
                WorksheetFeed  wsFeed    = spreadsheet.Worksheets;
                WorksheetEntry worksheet = (WorksheetEntry)wsFeed.Entries[0];

                // Define the URL to request the list feed of the worksheet.
                AtomLink listFeedLink = worksheet.Links.FindService(GDataSpreadsheetsNameTable.ListRel, null);

                // Fetch the list feed of the worksheet.

                ListQuery listQuery = new ListQuery(listFeedLink.HRef.ToString());
                listQuery.StartIndex = 0;
                ListFeed listFeed = service.Query(listQuery);

                // Iterate through each row, printing its cell values.

                List <category>   chart_categories = new List <category>();
                ChartModels       result           = new ChartModels();
                categories        final_categories = new categories();
                List <categories> list_categories  = new List <categories>();
                List <dataset>    collect_dataset  = new List <dataset>();
                foreach (ListEntry row in listFeed.Entries)
                {
                    // Print the first column's cell value
                    TableRow tr = new TableRow();
                    //  Response.Write(row.Title.Text + "\n");
                    // Iterate over the remaining columns, and print each cell value
                    dataset     final_dataset = new dataset();
                    List <data> collect_data  = new List <data>();
                    foreach (ListEntry.Custom element in row.Elements)
                    {
                        if (row.Title.Text == "Row: 2")
                        {
                            category chart_category = new category();
                            chart_category.label = element.Value.ToString();
                            chart_categories.Add(chart_category);
                        }
                        else
                        {
                            data data_value = new data();
                            final_dataset.seriesname = row.Title.Text;
                            int  n;
                            bool isNumeric = int.TryParse(element.Value, out n);
                            if (isNumeric)
                            {
                                data_value.value = element.Value.ToString();
                                collect_data.Add(data_value);
                            }
                        }
                        // Response.Write(element.Value + "\n");

                        TableCell tc = new TableCell();
                        if (row.Title.Text == "Row: 2")
                        {
                            tc.Text = "";
                        }
                        else
                        {
                            tc.Text = element.Value;
                        }
                        tr.Cells.Add(tc);
                    }
                    Table1.Rows.Add(tr);
                    if (collect_data.Count != 0)
                    {
                        final_dataset.data = collect_data;
                        collect_dataset.Add(final_dataset);
                    }
                }
                final_categories.category = chart_categories;
                result.dataset            = collect_dataset;
                list_categories.Add(final_categories);
                result.categories = list_categories;

                JavaScriptSerializer js = new JavaScriptSerializer();
                string res       = js.Serialize(result);
                string chartjson = JsonConvert.SerializeObject(result.categories);

                StringBuilder strJson = new StringBuilder();

                strJson.Append("{" +
                               "'chart': {" +
                               "'caption': 'Quarterly revenue'," +
                               "'subCaption':'Last year'," +
                               "'xAxisName':'Quarter (Click to drill down)'," +
                               "'subcaptionFontColor':'#0075c2'," +
                               "'numberPrefix': '$'," +
                               "'formatNumberScale': '1'," +
                               "'placeValuesInside': '1'," +
                               "'decimals': '0'" +
                               "},");
                strJson.Append("'categories':");

                strJson.Append(chartjson);
                strJson.Append(",");
                strJson.Append("'dataset':");
                string chartdatajson = JsonConvert.SerializeObject(result.dataset);
                strJson.Append(chartdatajson);
                strJson.Append("}");


                // Initialize the chart.
                Chart sales = new Chart("mscolumn3d", "myChart", "600", "350", "json", strJson.ToString());

                // Render the chart.
                Label1.Text = sales.Render();
            }
        }
        catch (Exception)
        {
            Response.Redirect("Default.aspx");
        }
    }
コード例 #38
0
 public void UpdateCategory(category o)
 {
     throw new NotImplementedException();
 }
コード例 #39
0
ファイル: Categorydto.cs プロジェクト: tamarpaley/everyBuy
 public void CastDallToDto(category category)
 {
     category_id      = category.category_id;
     category_name    = category.category_name;
     category_picture = category.category_picture;
 }
コード例 #40
0
        /// <summary>
        /// Parse ADMX Files
        /// </summary>
        /// <param name="FilePath">Admx File Path</param>
        /// <param name="Language">Subfolder of the Admx File with the corresponding Adml File</param>
        public AdmxParse(string FilePath, string Language)
        {
            categories = new List <category>();
            policies   = new List <policy>();
            xPathMapping.LoadXml(Properties.Settings.Default.DevicePathMapping);

            FileInfo fiAdmx = new FileInfo(FilePath);

            if (fiAdmx.Exists)
            {
                FileInfo fiAdml = new FileInfo(Path.Combine(fiAdmx.DirectoryName, Language, fiAdmx.Name.Replace(".admx", ".adml")));
                if (fiAdml.Exists)
                {
                    xAdml.Load(fiAdml.FullName);
                }

                xAdmx.Load(FilePath);
                XmlNamespaceManager ns = new XmlNamespaceManager(xAdmx.NameTable);
                ns.AddNamespace("pd", xAdmx.DocumentElement.NamespaceURI);

                //Get categories
                foreach (XmlNode xCat in xAdmx.SelectNodes("/pd:policyDefinitions/pd:categories/pd:category", ns))
                {
                    try
                    {
                        var oRes = new category();
                        oRes.displayName = sResourceStringLookup(xCat.Attributes["displayName"].InnerText.Replace("$(string.", "").TrimEnd(')'));
                        oRes.name        = xCat.Attributes["name"].InnerText;
                        if (xCat["parentCategory"] == null)
                        {
                            //oRes.parent = oRes.name; ???
                            oRes.parent = "";

                            categories.Add(oRes);

                            continue;
                        }

                        oRes.parent = xCat["parentCategory"].Attributes["ref"].InnerText;
                        if (categories.FirstOrDefault(t => t.name == oRes.parent) == null)
                        {
                            var xParent = xPathMapping.SelectSingleNode("//*[@name='" + oRes.parent + "']");
                            if (xParent != null)
                            {
                                XmlNode xPar = xParent;
                                while (xPar != null)
                                {
                                    if (xPar.Name != "#document")
                                    {
                                        if (xPar.Attributes["name"] != null)
                                        {
                                            string sPar = "";
                                            if (xPar.ParentNode.Attributes["name"] != null)
                                            {
                                                sPar = xPar.ParentNode.Attributes["name"].Value;
                                            }
                                            categories.Add(new category()
                                            {
                                                name = xPar.Attributes["name"].Value, displayName = xPar.Attributes["displayname"].Value, parent = sPar
                                            });
                                        }
                                    }
                                    xPar = xPar.ParentNode;
                                }
                            }
                            else
                            {
                                string sDispName = oRes.parent;
                                categories.Add(new category()
                                {
                                    name = sDispName, displayName = sDispName, parent = ""
                                });
                            }
                        }

                        categories.Add(oRes);
                    }
                    catch (Exception ex)
                    {
                        ex.Message.ToString();
                    }
                }

                //Get Policies
                foreach (XmlNode xPol in xAdmx.SelectNodes("/pd:policyDefinitions/pd:policies/pd:policy", ns))
                {
                    var oRes = new policy();
                    oRes.elements    = new List <element>();
                    oRes.displayName = sResourceStringLookup(xPol.Attributes["displayName"].InnerText.Replace("$(string.", "").TrimEnd(')'));
                    oRes.name        = xPol.Attributes["name"].InnerText;
                    oRes.state       = policyState.NotConfigured;

                    if (string.IsNullOrEmpty(oRes.displayName))
                    {
                        oRes.displayName = oRes.name;
                    }

                    if (xPol.Attributes["explainText"] != null)
                    {
                        oRes.explainText = sResourceStringLookup(xPol.Attributes["explainText"].InnerText.Replace("$(string.", "").TrimEnd(')'));
                    }

                    oRes.parentCategory = categories.FirstOrDefault(t => t.name == xPol["parentCategory"].Attributes["ref"].InnerText);
                    catLookup(xPol["parentCategory"].Attributes["ref"].InnerText);
                    oRes.path = GetPath(xPol["parentCategory"].Attributes["ref"].InnerText);
                    var pCat = categories.FirstOrDefault(t => t.name == xPol["parentCategory"].Attributes["ref"].InnerText);
                    if (pCat != null)
                    {
                        oRes.displaypath = GetDisplayPath(pCat.displayName);
                    }
                    else
                    {
                        var xParent = xPathMapping.SelectSingleNode("//*[@name='" + xPol["parentCategory"].Attributes["ref"].InnerText + "']");
                        if (xParent != null)
                        {
                            string sDispName = xParent.Attributes["displayname"].Value;
                            string sName     = xParent.Attributes["name"].Value;
                            string sParent   = "";
                            if (xParent.ParentNode.Attributes["name"] != null)
                            {
                                sParent = xParent.ParentNode.Attributes["name"].Value;
                            }
                            categories.Add(new category()
                            {
                                name = sName, displayName = sDispName, parent = sParent
                            });
                            oRes.displaypath = GetDisplayPath(sDispName);
                        }
                    }

                    oRes.key = xPol.Attributes["key"].InnerText;
                    if (xPol.Attributes["presentation"] != null)
                    {
                        oRes.presentation = sPresentationStringLookup(xPol.Attributes["presentation"].InnerText.Replace("$(presentation.", "").TrimEnd(')'));
                    }
                    switch (xPol.Attributes["class"].InnerText)
                    {
                    case "Machine":
                        oRes.policyType = classType.Machine;
                        break;

                    case "User":
                        oRes.policyType = classType.User;
                        break;
                    }

                    //oRes.innerXML = xPol.InnerXml;

                    if (xPol.Attributes["valueName"] != null)
                    {
                        if (xPol["enabledValue"] != null)
                        {
                            polEnableElement oElem = new polEnableElement();
                            oElem.ValueName = xPol.Attributes["valueName"].InnerText;
                            oElem.ValueType = valueType.PolicyEnable;

                            if (xPol["enabledValue"]["decimal"] != null)
                            {
                                try
                                {
                                    oElem.enabledValue = uint.Parse(xPol["enabledValue"]["decimal"].Attributes["value"].Value);
                                }
                                catch (Exception ex)
                                {
                                    Debug.WriteLine(ex.Message);
                                }
                            }

                            if (xPol["disabledValue"] != null)
                            {
                                if (xPol["disabledValue"]["decimal"] != null)
                                {
                                    try
                                    {
                                        oElem.disabledValue = uint.Parse(xPol["disabledValue"]["decimal"].Attributes["value"].Value);
                                    }
                                    catch (Exception ex)
                                    {
                                        Debug.WriteLine(ex.Message);
                                    }
                                }
                            }

                            oRes.elements.Add(oElem);
                        }
                        else
                        {
                            polEnableElement oElem = new polEnableElement();
                            oElem.ValueName     = xPol.Attributes["valueName"].InnerText;
                            oElem.ValueType     = valueType.PolicyEnable;
                            oElem.enabledValue  = 1;
                            oElem.disabledValue = 0;

                            oRes.elements.Add(oElem);
                        }
                    }

                    if (xPol["elements"] != null)
                    {
                        foreach (XmlNode xElem in xPol["elements"].ChildNodes)
                        {
                            if (xElem.Name == "#comment")
                            {
                                continue;
                            }
                            if (xElem.Name == "#text")
                            {
                                continue;
                            }

                            element oElem = new element();

                            switch (xElem.Name.ToLower())
                            {
                            case "decimal":
                                oElem           = new decimalElement();
                                oElem.ValueType = valueType.Decimal;
                                if (xElem.Attributes["minValue"] != null)
                                {
                                    uint iRes = 0;
                                    if (uint.TryParse(xElem.Attributes["minValue"].InnerText, out iRes))
                                    {
                                        ((decimalElement)oElem).minValue = iRes;
                                    }
                                }
                                if (xElem.Attributes["maxValue"] != null)
                                {
                                    uint iRes = 0;
                                    if (uint.TryParse(xElem.Attributes["maxValue"].InnerText, out iRes))
                                    {
                                        ((decimalElement)oElem).maxValue = iRes;
                                    }
                                }
                                break;

                            case "enum":
                                oElem           = new enumElement();
                                oElem.ValueType = valueType.Enum;
                                ((enumElement)oElem).valueList = new Dictionary <string, string>();
                                foreach (XmlNode xElemItem in xElem.SelectNodes("pd:item", ns))
                                {
                                    try
                                    {
                                        string sDisplayName = sResourceStringLookup(xElemItem.Attributes["displayName"].Value.Replace("$(string.", "").TrimEnd(')'));
                                        if (string.IsNullOrEmpty(sDisplayName))
                                        {
                                            sDisplayName = xElemItem.Attributes["displayName"].Value.Replace("$(string.", "").TrimEnd(')');
                                        }
                                        if (xElemItem["value"].FirstChild.Name == "decimal")
                                        {
                                            if (xElemItem["value"].FirstChild.Attributes.Count > 0)
                                            {
                                                ((enumElement)oElem).valueList.Add(sDisplayName, xElemItem["value"].FirstChild.Attributes["value"].Value);
                                            }
                                            else
                                            {
                                                ((enumElement)oElem).valueList.Add(sDisplayName, xElemItem["value"].FirstChild.InnerText);
                                            }
                                        }
                                        if (xElemItem["value"].FirstChild.Name == "string")
                                        {
                                            ((enumElement)oElem).valueList.Add(sDisplayName, xElemItem["value"].FirstChild.InnerText);
                                        }
                                        string sDefault = oRes.sPresentationdefaultValue(xElem.Attributes["id"].Value);
                                        if (!string.IsNullOrEmpty(sDefault))
                                        {
                                            int iDef = 0;
                                            int.TryParse(sDefault, out iDef);

                                            ((enumElement)oElem).defaultItem = iDef;
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        Debug.WriteLine(ex.Message);
                                    }
                                }
                                break;

                            case "boolean":
                                oElem           = new decimalElement();
                                oElem.ValueType = valueType.Boolean;
                                ((decimalElement)oElem).minValue = 0;
                                ((decimalElement)oElem).maxValue = 1;
                                oElem.value = oRes.sPresentationdefaultValue(xElem.Attributes["id"].Value);
                                break;

                            case "list":
                                oElem           = new listElement();
                                oElem.ValueType = valueType.List;
                                ((listElement)oElem).valueList = new Dictionary <string, string>();
                                if (xElem.Attributes["additive"] != null)
                                {
                                    bool bRes = false;
                                    if (bool.TryParse(xElem.Attributes["additive"].Value, out bRes))
                                    {
                                        ((listElement)oElem).additive = bRes;
                                    }
                                    else
                                    {
                                        ((listElement)oElem).additive = null;
                                    }
                                }
                                if (xElem.Attributes["explicitValue"] != null)
                                {
                                    bool bRes = false;
                                    if (bool.TryParse(xElem.Attributes["explicitValue"].Value, out bRes))
                                    {
                                        ((listElement)oElem).explicitValue = bRes;
                                    }
                                    else
                                    {
                                        ((listElement)oElem).explicitValue = null;
                                    }
                                }
                                break;

                            case "text":
                                oElem           = new textElement();
                                oElem.ValueType = valueType.Text;
                                break;

                            default:
                                xElem.Name.ToString();
                                break;
                            }

                            oElem.value = oRes.sPresentationdefaultValue(xElem.Attributes["id"].InnerText);
                            //oElem.innerXML = xElem.OuterXml;

                            //List do not have a Value, they have List of Valuenames and Values
                            if (oElem.ValueType != valueType.List)
                            {
                                oElem.ValueName = xElem.Attributes["valueName"].InnerText;
                            }

                            if (xElem.Attributes["required"] != null)
                            {
                                bool bReq = false;
                                if (bool.TryParse(xElem.Attributes["required"].InnerText, out bReq))
                                {
                                    oElem.required = bReq;
                                }
                            }

                            if (xElem.Attributes["key"] != null)
                            {
                                oElem.key = xElem.Attributes["key"].Value;
                            }


                            oRes.elements.Add(oElem);
                        }
                    }

                    if (xPol["enabledList"] != null)
                    {
                        EnableListElement oElem = new EnableListElement();

                        oElem.ValueType        = valueType.Enum;
                        oElem.enabledValueList = new List <enabledList>();

                        foreach (XmlNode xElem in xPol["enabledList"].SelectNodes("pd:item", ns))
                        {
                            try
                            {
                                enabledList oResList = new enabledList();

                                if (xElem["value"].FirstChild.Name == "decimal")
                                {
                                    oResList.type      = valueType.Decimal;
                                    oResList.key       = xElem.Attributes["key"].Value;
                                    oResList.valueName = xElem.Attributes["valueName"].Value;
                                    oResList.value     = xElem["value"].FirstChild.Attributes["value"].Value;
                                }
                                if (xElem["value"].FirstChild.Name == "string")
                                {
                                    oResList.type      = valueType.Text;
                                    oResList.key       = xElem.Attributes["key"].Value;
                                    oResList.valueName = xElem.Attributes["valueName"].Value;
                                    if (xElem["value"].FirstChild.Attributes.Count > 0)
                                    {
                                        oResList.value = xElem["value"].FirstChild.Attributes["value"].Value;
                                    }
                                    else
                                    {
                                        oResList.value = xElem["value"].FirstChild.InnerText;
                                    }
                                }

                                oElem.enabledValueList.Add(oResList);
                            }
                            catch (Exception ex)
                            {
                                Debug.WriteLine(ex.Message);
                            }
                        }


                        oRes.elements.Add(oElem);
                    }

                    if (xPol["disabledList"] != null)
                    {
                        EnableListElement oElem = new EnableListElement();

                        oElem.ValueType         = valueType.Enum;
                        oElem.disabledValueList = new List <enabledList>();

                        foreach (XmlNode xElem in xPol["disabledList"].SelectNodes("pd:item", ns))
                        {
                            try
                            {
                                enabledList oResList = new enabledList();

                                if (xElem["value"].FirstChild.Name == "decimal")
                                {
                                    oResList.type      = valueType.Decimal;
                                    oResList.key       = xElem.Attributes["key"].Value;
                                    oResList.valueName = xElem.Attributes["valueName"].Value;
                                    oResList.value     = xElem["value"].FirstChild.Attributes["value"].Value;
                                }
                                if (xElem["value"].FirstChild.Name == "string")
                                {
                                    oResList.type      = valueType.Text;
                                    oResList.key       = xElem.Attributes["key"].Value;
                                    oResList.valueName = xElem.Attributes["valueName"].Value;
                                    if (xElem["value"].FirstChild.Attributes.Count > 0)
                                    {
                                        oResList.value = xElem["value"].FirstChild.Attributes["value"].Value;
                                    }
                                    else
                                    {
                                        oResList.value = xElem["value"].FirstChild.InnerText;
                                    }
                                }

                                oElem.disabledValueList.Add(oResList);
                            }
                            catch (Exception ex)
                            {
                                Debug.WriteLine(ex.Message);
                            }
                        }


                        oRes.elements.Add(oElem);
                    }

                    policies.Add(oRes);
                }
            }
        }
コード例 #41
0
ファイル: Service.cs プロジェクト: MShah890/Eventica
    public bool DeleteCategory(category obj)
    {
        try
        {
            category objcategory = dbcontext.categories.Where(t => t.categoryid == obj.categoryid).FirstOrDefault();
            dbcontext.categories.DeleteOnSubmit(obj);
            dbcontext.SubmitChanges();

            return true;
        }
        catch (Exception)
        {

            return false;
        }

    }
コード例 #42
0
 public void AddTocategories(category category)
 {
     base.AddObject("categories", category);
 }
コード例 #43
0
ファイル: Service.cs プロジェクト: MShah890/Eventica
 public bool UpdateCategory(category obj)
 {
     try
     {
         category objcategory = dbcontext.categories.Where(t => t.categoryid == obj.categoryid).FirstOrDefault();
         objcategory.categoryname = obj.categoryname;
         objcategory.categoryimage = obj.categoryimage;
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }
コード例 #44
0
ファイル: NewCategoryForm.cs プロジェクト: cadore/TruckSystem
 public NewCategoryForm(category.Categorys ct)
 {
     InitializeComponent();
     ControlsUtil.SetBackColor(this.Controls);
     CategoryT = ct;
 }
コード例 #45
0
 private void logMessage(string message, category cat)
 {
     //Action del = delegate
     //{
     traceLogStore.Add(new Label { Content = message, ToolTip = cat });
     //};
     /*if (Thread.CurrentThread == Dispatcher.Thread)
         del();
     else
         Dispatcher.BeginInvoke(del);
     */
 }
コード例 #46
0
        private void CategoryTreeListDragDrop(object sender, DragEventArgs e)
        {
            TreeListHitInfo hi = categoryTreeList.CalcHitInfo(categoryTreeList.PointToClient(new Point(e.X, e.Y)));
            var categoryTypeInside = e.Data.GetData(typeof (category_type_inside)) as category_type_inside;
            if (categoryTypeInside != null)
            {
                TreeListNode parentNode = hi.Node;
                var parentCategory = categoryTreeList.GetDataRecordByNode(parentNode) as category;
                if (parentNode != null && parentCategory != null)
                {
                    var newCategory = new category
                                          {
                                              id_parent_category = parentCategory.id_category,
                                              id_category_type = categoryTypeInside.id_category_type,
                                              id_category_type_inside = categoryTypeInside.id_category_type_inside,
                                              name = categoryTypeInside.name,
                                              image_index = categoryTypeInside.image_index
                                          };

                    categoryBindingSource.Add(newCategory);
                    _objectContext.SaveChanges();
                }
            }
            SetDefaultCursor();
        }
コード例 #47
0
 partial void Insertcategory(category instance);
コード例 #48
0
 public void AddCategory(category newCategory)
 {
     _db.categories.Add(newCategory);
     _db.SaveChanges();
 }
コード例 #49
0
 public void NextCategory()
 {
     ++Category;
     Category   = (category)(((int)Category) % 3);
     this.Image = Image.FromFile(imagePaths[(int)Category]);
 }
コード例 #50
0
    protected void ddlexcellst_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            if (ddlexcellst.SelectedIndex == 0) {
                Label2.Visible = true;
            }
            else
            {
                Label2.Visible = false;
                OAuth2Parameters parameters_lst = oauthcredentials();
                GOAuth2RequestFactory requestFactory =
                     new GOAuth2RequestFactory(null, "Fusion-SpreadSheet", parameters_lst);
                SpreadsheetsService service = new SpreadsheetsService("Fusion-SpreadSheet");
                service.RequestFactory = requestFactory;

                service.RequestFactory = requestFactory;

                // TODO: Authorize the service object for a specific user (see other sections)

                // Instantiate a SpreadsheetQuery object to retrieve spreadsheets.
                SpreadsheetQuery query = new SpreadsheetQuery();

                // Make a request to the API and get all spreadsheets.
                SpreadsheetFeed feed = service.Query(query);

                if (feed.Entries.Count == 0)
                {
                    // TODO: There were no spreadsheets, act accordingly.
                }

                // TODO: Choose a spreadsheet more intelligently based on your
                // app's needs.
                SpreadsheetEntry spreadsheet = (SpreadsheetEntry)feed.Entries[Convert.ToInt32(ddlexcellst.SelectedIndex) - 1];
                //Response.Write(spreadsheet.Title.Text + "\n");

                // Get the first worksheet of the first spreadsheet.
                // TODO: Choose a worksheet more intelligently based on your
                // app's needs.
                WorksheetFeed wsFeed = spreadsheet.Worksheets;
                WorksheetEntry worksheet = (WorksheetEntry)wsFeed.Entries[0];

                // Define the URL to request the list feed of the worksheet.
                AtomLink listFeedLink = worksheet.Links.FindService(GDataSpreadsheetsNameTable.ListRel, null);

                // Fetch the list feed of the worksheet.

                ListQuery listQuery = new ListQuery(listFeedLink.HRef.ToString());
                listQuery.StartIndex = 0;
                ListFeed listFeed = service.Query(listQuery);

                // Iterate through each row, printing its cell values.

                List<category> chart_categories = new List<category>();
                ChartModels result = new ChartModels();
                categories final_categories = new categories();
                List<categories> list_categories = new List<categories>();
                List<dataset> collect_dataset = new List<dataset>();
                foreach (ListEntry row in listFeed.Entries)
                {
                    // Print the first column's cell value
                    TableRow tr = new TableRow();
                    //  Response.Write(row.Title.Text + "\n");
                    // Iterate over the remaining columns, and print each cell value
                    dataset final_dataset = new dataset();
                    List<data> collect_data = new List<data>();
                    foreach (ListEntry.Custom element in row.Elements)
                    {
                        if (row.Title.Text == "Row: 2")
                        {
                            category chart_category = new category();
                            chart_category.label = element.Value.ToString();
                            chart_categories.Add(chart_category);
                        }
                        else
                        {
                            data data_value = new data();
                            final_dataset.seriesname = row.Title.Text;
                            int n;
                            bool isNumeric = int.TryParse(element.Value, out n);
                            if (isNumeric)
                            {
                                data_value.value = element.Value.ToString();
                                collect_data.Add(data_value);
                            }
                        }
                        // Response.Write(element.Value + "\n");

                        TableCell tc = new TableCell();
                        if (row.Title.Text == "Row: 2")
                        {
                            tc.Text = "";
                        }
                        else
                            tc.Text = element.Value;
                        tr.Cells.Add(tc);
                    }
                    Table1.Rows.Add(tr);
                    if (collect_data.Count != 0)
                    {
                        final_dataset.data = collect_data;
                        collect_dataset.Add(final_dataset);
                    }
                }
                final_categories.category = chart_categories;
                result.dataset = collect_dataset;
                list_categories.Add(final_categories);
                result.categories = list_categories;

                JavaScriptSerializer js = new JavaScriptSerializer();
                string res = js.Serialize(result);
                string chartjson = JsonConvert.SerializeObject(result.categories);

                StringBuilder strJson = new StringBuilder();

                strJson.Append("{" +
                        "'chart': {" +
                              "'caption': 'Quarterly revenue'," +
                              "'subCaption':'Last year'," +
                              "'xAxisName':'Quarter (Click to drill down)'," +
                              "'subcaptionFontColor':'#0075c2'," +
                              "'numberPrefix': '$'," +
                              "'formatNumberScale': '1'," +
                              "'placeValuesInside': '1'," +
                              "'decimals': '0'" +
                                   "},");
                strJson.Append("'categories':");

                strJson.Append(chartjson);
                strJson.Append(",");
                strJson.Append("'dataset':");
                string chartdatajson = JsonConvert.SerializeObject(result.dataset);
                strJson.Append(chartdatajson);
                strJson.Append("}");

                // Initialize the chart.
                Chart sales = new Chart("mscolumn3d", "myChart", "600", "350", "json", strJson.ToString());

                // Render the chart.
                Label1.Text = sales.Render();
            }
        }
        catch (Exception)
        {
            Response.Redirect("Default.aspx");
        }
    }
コード例 #51
0
 private void doAffineLog(string message, category cat)
 {
     Dispatcher.BeginInvoke(new LogDelegate(logMessage), DispatcherPriority.Normal, new object[] { message, cat });
 }