/// <summary>
 /// Delete ProductInventoy By InventoryID
 /// </summary>
 /// <param name="InventoryID"></param>
 public void DelProductInventoy(long InventoryID)
 {
     using (CostarDataContext linq = new CostarDataContext())
     {
         linq.StoreProductInventories.DeleteAllOnSubmit(linq.StoreProductInventories.Where(c => c.InventoryID == InventoryID));
         linq.SubmitChanges();
     }
 }
 public void DelProductColor(long productID)
 {
     using (CostarDataContext linq = new CostarDataContext())
     {
         linq.StoreProductColors.DeleteOnSubmit(linq.StoreProductColors.Where(c => c.ProductID == productID).Single());
         linq.SubmitChanges();
     }
 }
        protected void btn_save_Click(object sender, EventArgs e)
        {
            using (CostarDataContext linq = new CostarDataContext())
            {
                int ShippingOptionID = MyCommon.ToInt(Request["ShippingOptionID"]);

                StoreShippingOption shipping;
                if (this.HiddenField1.Value == "add") shipping = new StoreShippingOption();
                else shipping = linq.StoreShippingOptions.Where(c => c.ShippingOptionID == ShippingOptionID).SingleOrDefault();

                shipping.Name = this.txt_Name.Text;
                shipping.Instruction = this.txt_Description.Text;
                shipping.IsActive = this.CheckBox_Active.Checked;

                decimal price = 0;
                decimal.TryParse(this.txt_Price.Text, out price);

                switch (this.ddl_Per.SelectedValue)
                {
                    case "0":
                        shipping.PerItemFlatRate = price;
                        shipping.PerKGRate = null;
                        shipping.PerOrderFlatRate = null;
                        break;
                    case "1":
                        shipping.PerItemFlatRate = null;
                        shipping.PerKGRate = null;
                        shipping.PerOrderFlatRate = price;
                        break;
                    case "2":
                        shipping.PerItemFlatRate = null;
                        shipping.PerKGRate = price;
                        shipping.PerOrderFlatRate = null;
                        break;
                }

                if (this.HiddenField1.Value == "add")
                    linq.StoreShippingOptions.InsertOnSubmit(shipping);

                linq.SubmitChanges();

                MyCommon.Alert("保存成功.", "StoreShippingManage.aspx");
            }
        }