示例#1
0
        public bool insertNewUserTypeSubClass(UserTypeSubClass u)
        {
            int rowsAffected = 0;

            SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@UserTypeID", SqlDbType.Int), new SqlParameter("@SubClassName", SqlDbType.NVarChar), new SqlParameter("@State", SqlDbType.NVarChar) };
            parameters[0].Value = u.UserTypeID;
            parameters[1].Value = u.SubClassName;
            parameters[2].Value = u.State;
            SQLHelper.RunProcedure("p_UserTypeSubClass_insertNewUserTypeSubClass", parameters, out rowsAffected);
            List <Products> list = new List <Products>();

            list = new ProductsDAL().getAllProducts();
            int           num2   = -1;
            SqlDataReader reader = SQLHelper.RunProcedure("p_UserTypeSubClass_getLastRecond", null);

            while (reader.Read())
            {
                num2 = reader.GetInt32(reader.GetOrdinal("SubClassID"));
            }
            for (int i = 0; i < list.Count; i++)
            {
                ProductsUserType p        = new ProductsUserType();
                Products         products = list[i];
                p.Price      = products.Price;
                p.ProductsID = products.ProductsID;
                p.SubClassID = num2;
                new ProductsUserTypeDAL().insertNewRecord(p);
            }
            return(1 == rowsAffected);
        }
示例#2
0
    /// <summary>
    ///  更新时
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void PriceList_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        string price = ((TextBox)PriceList.Rows[e.RowIndex].Cells[1].FindControl("TextBox1")).Text.ToString();
        // int typeid = int.Parse(PriceList.DataKeys[e.RowIndex]["SubClassID"].ToString());
        int    subID = int.Parse(PriceList.DataKeys[e.RowIndex]["SubClassID"].ToString());
        int    proID = int.Parse(PID.Text.ToString());
        double ps;

        try
        {
            ps = double.Parse(price);
        }
        catch
        {
            Jscript.AjaxAlert(this, "输入有误!");
            PriceList.EditIndex = -1;
            DataBand();
            return;
        }

        ProductsUserType p = new ProductsUserType();

        p.Price      = ps;
        p.ProductsID = proID;
        p.SubClassID = subID;

        Leyp.SQLServerDAL.Factory.getProductsUserTypeDAL().updateNodeupdate(p);

        addSystemLog("商品ID:" + proID + " 调价成功");

        PriceList.EditIndex = -1;
        DataBand();
    }
示例#3
0
    /// <summary>
    /// 根据用户类型得到商品的价格
    /// </summary>
    /// <param name="ProductsID"></param>
    private void getProductsPrice(int ProductsID)
    {
        int userType = getSubClassID();//用户类型

        ProductsUserType py = Leyp.SQLServerDAL.Factory.getProductsUserTypeDAL().getByProductsIDAndSubClassID(ProductsID, userType);

        Response.Write(py.Price.ToString());
        Response.End();
    }
示例#4
0
        public bool updateNodeupdate(ProductsUserType p)
        {
            int rowsAffected = 0;

            SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@ProductsID", SqlDbType.Int), new SqlParameter("@SubClassID", SqlDbType.Int), new SqlParameter("@Price", SqlDbType.Float) };
            parameters[0].Value = p.ProductsID;
            parameters[1].Value = p.SubClassID;
            parameters[2].Value = p.Price;
            SQLHelper.RunProcedure("p_ProductsUserType_updateNode", parameters, out rowsAffected);
            return(1 == rowsAffected);
        }
示例#5
0
文件: ProductsDAL.cs 项目: cfmis/cfw
        public bool insertNewProducts(Products pro)
        {
            int rowsAffected = 0;

            SqlParameter[] parameters = new SqlParameter[] {
                new SqlParameter("@ProductsName", SqlDbType.NVarChar), new SqlParameter("@TypeID", SqlDbType.Int), new SqlParameter("@BrandID", SqlDbType.Int), new SqlParameter("@Color", SqlDbType.NVarChar), new SqlParameter("@Weight", SqlDbType.NVarChar), new SqlParameter("@Spec", SqlDbType.NVarChar), new SqlParameter("@Cost", SqlDbType.Money), new SqlParameter("@ProductsUints", SqlDbType.NVarChar), new SqlParameter("@Material", SqlDbType.NVarChar), new SqlParameter("@UpperLimit", SqlDbType.Int), new SqlParameter("@LowerLimit", SqlDbType.Int), new SqlParameter("@BeginEnterDate", SqlDbType.NVarChar), new SqlParameter("@FinalEnterDate", SqlDbType.NVarChar), new SqlParameter("@LatelyOFSDate", SqlDbType.NVarChar), new SqlParameter("@UnshelveDate", SqlDbType.NVarChar), new SqlParameter("@LoadingDate", SqlDbType.NVarChar),
                new SqlParameter("@Description", SqlDbType.NVarChar), new SqlParameter("@Price", SqlDbType.Float)
            };
            parameters[0].Value    = pro.ProductsName;
            parameters[1].Value    = pro.TypeID;
            parameters[2].Value    = pro.BrandID;
            parameters[3].Value    = pro.Color;
            parameters[4].Value    = pro.Weight;
            parameters[5].Value    = pro.Spec;
            parameters[6].Value    = pro.Cost;
            parameters[7].Value    = pro.ProductsUints;
            parameters[8].Value    = pro.Material;
            parameters[9].Value    = pro.UpperLimit;
            parameters[10].Value   = pro.LowerLimit;
            parameters[11].Value   = pro.BeginEnterDate;
            parameters[12].Value   = pro.FinalEnterDate;
            parameters[13].Value   = pro.LatelyOFSDate;
            parameters[14].Value   = pro.UnshelveDate;
            parameters[15].Value   = pro.LoadingDate;
            parameters[0x10].Value = pro.Description;
            parameters[0x11].Value = pro.Price;
            SQLHelper.RunProcedure("p_Products_InsertNew", parameters, out rowsAffected);
            if (rowsAffected == 1)
            {
                List <UserTypeSubClass> list = new List <UserTypeSubClass>();
                list = new UserTypeSubClassDAL().getAllUserTypeSubClass();
                int           num2   = -1;
                SqlDataReader reader = SQLHelper.RunProcedure("p_Products_GetLastRecond", null);
                while (reader.Read())
                {
                    num2 = reader.GetInt32(reader.GetOrdinal("ProductsID"));
                }
                for (int i = 0; i < list.Count; i++)
                {
                    ProductsUserType p      = new ProductsUserType();
                    UserTypeSubClass class2 = list[i];
                    p.Price      = pro.Price;
                    p.ProductsID = num2;
                    p.SubClassID = class2.SubClassID;
                    new ProductsUserTypeDAL().insertNewRecord(p);
                }
            }
            return(1 == rowsAffected);
        }
示例#6
0
    protected void DataBand()
    {
        object PID        = Request.QueryString["ProductsID"];
        string ProductsID = PID.ToString();

        VProducts p = new VProducts();

        p = new VProductsDAL().getByID(int.Parse(ProductsID));

        if (p == null)
        {
            Response.Write("没有你要的数据");
            Response.End();
            return;
        }

        int          typeid = p.TypeID;
        ProductsType pt     = new ProductsTypeDAL().getByTypeID(typeid);

        if (getTypeID() != 0)
        {
            if (pt.State.Equals("NB"))
            {
                Response.Write("没有权限");
                Response.End();
                return;
            }
        }

        Label1.Text     = p.BrandName;
        Label2.Text     = p.TypeName;
        Label3.Text     = p.ProductsUints;
        Label4.Text     = p.Color;
        Label5.Text     = p.Spec;
        Label6.Text     = p.Weight;
        Label7.Text     = p.Material;
        Label8.Text     = ProductsID;
        Label9.Text     = p.ProductsName;
        Image1.ImageUrl = "~/UploadFiles/Images/" + p.PhotoUrl + "";

        ProductsUserType pu = Leyp.SQLServerDAL.Factory.getProductsUserTypeDAL().getByProductsIDAndSubClassID(int.Parse(ProductsID), 1);//按用户类型给出一个商品的标价

        Label10.Text = pu.Price.ToString();
        ListBand(int.Parse(ProductsID));
    }
示例#7
0
        public ProductsUserType getByProductsIDAndSubClassID(int ProductsID, int SubClassID)
        {
            string s = "";

            SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@ProductsID", SqlDbType.Int), new SqlParameter("@SubClassID", SqlDbType.Int) };
            parameters[0].Value = ProductsID;
            parameters[1].Value = SubClassID;
            ProductsUserType type   = new ProductsUserType();
            SqlDataReader    reader = SQLHelper.RunProcedure("p_ProductsUserType_getByProductsIDandSubClassID", parameters);

            while (reader.Read())
            {
                s               = reader.GetValue(reader.GetOrdinal("Price")).ToString();
                type.Price      = double.Parse(s);
                type.SubClassID = SubClassID;
                type.ProductsID = ProductsID;
            }
            return(type);
        }