Esempio n. 1
0
    protected void updateButton_Click(object sender, EventArgs e)
    {
        string sName = ShopName_edit.Text.ToString();
        string Destr = Description_edit.Text.ToString();
        string id    = EditID.Text.ToString();

        SalesPlatform s = new SalesPlatform();

        s.PlatformName = sName;
        s.Description  = Destr;
        s.PlatformID   = int.Parse(id);

        if (Leyp.SQLServerDAL.Sales.Factory.getSalesPlatformDAL().updateEitity(s))
        {
            HyperLink1.Visible = true;
            viewPanel.Visible  = false;
            editPanel.Visible  = false;
        }
        else
        {
            HyperLink1.Text    = "失败!你可以返回重新试试";
            HyperLink1.Visible = true;
            viewPanel.Visible  = false;
        }
    }
Esempio n. 2
0
        public bool insertNewEntity(SalesPlatform s)
        {
            int rowsAffected = 0;

            SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@PlatformName", SqlDbType.NVarChar), new SqlParameter("@Description", SqlDbType.NVarChar) };
            parameters[0].Value = s.PlatformName;
            parameters[1].Value = s.Description;
            SQLHelper.RunProcedure("p_SalesPlatform_insertNewEntity", parameters, out rowsAffected);
            return(1 == rowsAffected);
        }
Esempio n. 3
0
    /// <summary>
    /// 页面初始化
    /// </summary>
    public void initDataBand()
    {
        string action = Request.QueryString["action"];

        if (action == null)
        {
            CollectionPager1.DataSource    = Leyp.SQLServerDAL.Sales.Factory.getSalesPlatformDAL().getList();//BLL项目中List数据源
            CollectionPager1.BindToControl = GridView1;
            GridView1.DataSource           = CollectionPager1.DataSourcePaged;
            editPanel.Visible = false;
        }
        else if (action.Equals("edit"))
        {
            int PlatformID = 0;
            try
            {
                PlatformID = int.Parse(Request.QueryString["PlatformID"].ToString());
            }
            catch
            {
                Response.Write("参数有误");
                Response.End();
            }

            SalesPlatform s = new SalesPlatform();
            s = Leyp.SQLServerDAL.Sales.Factory.getSalesPlatformDAL().getByID(PlatformID);

            ShopName_edit.Text    = s.PlatformName;
            EditID.Text           = s.PlatformID.ToString();//保存编辑ID
            Description_edit.Text = s.Description;
            editPanel.Visible     = true;
            viewPanel.Visible     = false;
        }
        else if (action.Equals("del"))
        {
            int PlatformID = 0;
            try
            {
                PlatformID = int.Parse(Request.QueryString["PlatformID"].ToString());
            }
            catch
            {
                Response.Write("参数有误");
                Response.End();
            }
            Leyp.SQLServerDAL.Sales.Factory.getSalesPlatformDAL().deleteEitity(PlatformID);
            Jscript.AjaxAlert(this, "删除成功");
            viewPanel.Visible = false;
        }
    }
Esempio n. 4
0
        public List <SalesPlatform> getList()
        {
            List <SalesPlatform> list   = new List <SalesPlatform>();
            SqlDataReader        reader = SQLHelper.RunProcedure("p_SalesPlatform_getList", null);

            while (reader.Read())
            {
                SalesPlatform item = new SalesPlatform();
                item.PlatformID   = reader.GetInt32(reader.GetOrdinal("PlatformID"));
                item.PlatformName = reader.GetString(reader.GetOrdinal("PlatformName"));
                item.Description  = reader.GetString(reader.GetOrdinal("Description"));
                list.Add(item);
            }
            reader.Close();
            return(list);
        }
Esempio n. 5
0
        public SalesPlatform getByID(int PlatformID)
        {
            SalesPlatform platform = new SalesPlatform();

            SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@PlatformID", SqlDbType.NVarChar) };
            parameters[0].Value = PlatformID;
            SqlDataReader reader = SQLHelper.RunProcedure("p_SalesPlatform_getByID", parameters);

            if (reader.Read())
            {
                platform.PlatformID   = reader.GetInt32(reader.GetOrdinal("PlatformID"));
                platform.PlatformName = reader.GetString(reader.GetOrdinal("PlatformName"));
                platform.Description  = reader.GetString(reader.GetOrdinal("Description"));
            }
            reader.Close();
            return(platform);
        }
Esempio n. 6
0
    protected void submit_Click(object sender, EventArgs e)
    {
        string sName = ShopName_New.Text.ToString();
        string Destr = Description_new.Text.ToString();

        SalesPlatform s = new SalesPlatform();

        s.PlatformName = sName;
        s.Description  = Destr;

        if (Leyp.SQLServerDAL.Sales.Factory.getSalesPlatformDAL().insertNewEntity(s))
        {
            HyperLink1.Visible = true;
            viewPanel.Visible  = false;
        }
        else
        {
            HyperLink1.Text    = "添加失败!可能是名称重复了!你可以返回重新试试";
            HyperLink1.Visible = true;
            viewPanel.Visible  = false;
        }
    }