예제 #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.fapiao model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_fapiao set ");

            strSql.Append(" type = @type , ");
            strSql.Append(" companyname = @companyname , ");
            strSql.Append(" project = @project , ");
            strSql.Append(" aomunt = @aomunt , ");
            strSql.Append(" danweiname = @danweiname , ");
            strSql.Append(" shibiehao = @shibiehao , ");
            strSql.Append(" address = @address , ");
            strSql.Append(" tel = @tel , ");
            strSql.Append(" bankname = @bankname , ");
            strSql.Append(" bankaccount = @bankaccount , ");
            strSql.Append(" userid = @userid  ");
            strSql.Append(" where id=@id ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@id",          SqlDbType.Int,        4),
                new SqlParameter("@type",        SqlDbType.Int,        4),
                new SqlParameter("@companyname", SqlDbType.NVarChar, 100),
                new SqlParameter("@project",     SqlDbType.NVarChar, 100),
                new SqlParameter("@aomunt",      SqlDbType.Decimal,    9),
                new SqlParameter("@danweiname",  SqlDbType.NVarChar,  50),
                new SqlParameter("@shibiehao",   SqlDbType.NVarChar,  50),
                new SqlParameter("@address",     SqlDbType.NVarChar, 100),
                new SqlParameter("@tel",         SqlDbType.NVarChar, 100),
                new SqlParameter("@bankname",    SqlDbType.NVarChar, 100),
                new SqlParameter("@bankaccount", SqlDbType.NVarChar, 100),
                new SqlParameter("@userid",      SqlDbType.Int, 4)
            };

            parameters[0].Value  = model.id;
            parameters[1].Value  = model.type;
            parameters[2].Value  = model.companyname;
            parameters[3].Value  = model.project;
            parameters[4].Value  = model.aomunt;
            parameters[5].Value  = model.danweiname;
            parameters[6].Value  = model.shibiehao;
            parameters[7].Value  = model.address;
            parameters[8].Value  = model.tel;
            parameters[9].Value  = model.bankname;
            parameters[10].Value = model.bankaccount;
            parameters[11].Value = model.userid;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.fapiao GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select id, type, companyname, project, aomunt, danweiname, shibiehao, address, tel, bankname, bankaccount, userid  ");
            strSql.Append("  from tb_fapiao ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;


            Model.fapiao model = new Model.fapiao();
            DataSet      ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["type"].ToString() != "")
                {
                    model.type = int.Parse(ds.Tables[0].Rows[0]["type"].ToString());
                }
                model.companyname = ds.Tables[0].Rows[0]["companyname"].ToString();
                model.project     = ds.Tables[0].Rows[0]["project"].ToString();
                if (ds.Tables[0].Rows[0]["aomunt"].ToString() != "")
                {
                    model.aomunt = decimal.Parse(ds.Tables[0].Rows[0]["aomunt"].ToString());
                }
                model.danweiname  = ds.Tables[0].Rows[0]["danweiname"].ToString();
                model.shibiehao   = ds.Tables[0].Rows[0]["shibiehao"].ToString();
                model.address     = ds.Tables[0].Rows[0]["address"].ToString();
                model.tel         = ds.Tables[0].Rows[0]["tel"].ToString();
                model.bankname    = ds.Tables[0].Rows[0]["bankname"].ToString();
                model.bankaccount = ds.Tables[0].Rows[0]["bankaccount"].ToString();
                if (ds.Tables[0].Rows[0]["userid"].ToString() != "")
                {
                    model.userid = int.Parse(ds.Tables[0].Rows[0]["userid"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
예제 #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.fapiao model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_fapiao(");
            strSql.Append("type,companyname,project,aomunt,danweiname,shibiehao,address,tel,bankname,bankaccount,userid");
            strSql.Append(") values (");
            strSql.Append("@type,@companyname,@project,@aomunt,@danweiname,@shibiehao,@address,@tel,@bankname,@bankaccount,@userid");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@type",        SqlDbType.Int,        4),
                new SqlParameter("@companyname", SqlDbType.NVarChar, 100),
                new SqlParameter("@project",     SqlDbType.NVarChar, 100),
                new SqlParameter("@aomunt",      SqlDbType.Decimal,    9),
                new SqlParameter("@danweiname",  SqlDbType.NVarChar,  50),
                new SqlParameter("@shibiehao",   SqlDbType.NVarChar,  50),
                new SqlParameter("@address",     SqlDbType.NVarChar, 100),
                new SqlParameter("@tel",         SqlDbType.NVarChar, 100),
                new SqlParameter("@bankname",    SqlDbType.NVarChar, 100),
                new SqlParameter("@bankaccount", SqlDbType.NVarChar, 100),
                new SqlParameter("@userid",      SqlDbType.Int, 4)
            };

            parameters[0].Value  = model.type;
            parameters[1].Value  = model.companyname;
            parameters[2].Value  = model.project;
            parameters[3].Value  = model.aomunt;
            parameters[4].Value  = model.danweiname;
            parameters[5].Value  = model.shibiehao;
            parameters[6].Value  = model.address;
            parameters[7].Value  = model.tel;
            parameters[8].Value  = model.bankname;
            parameters[9].Value  = model.bankaccount;
            parameters[10].Value = model.userid;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
예제 #4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.fapiao model)
 {
     return(dal.Update(model));
 }
예제 #5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Model.fapiao model)
 {
     return(dal.Add(model));
 }
예제 #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.fapiao GetModel(int id)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select id, type, companyname, project, aomunt, danweiname, shibiehao, address, tel, bankname, bankaccount, userid  ");
            strSql.Append("  from tb_fapiao ");
            strSql.Append(" where id=@id");
                        SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int,4)
            };
            parameters[0].Value = id;

            Model.fapiao model=new Model.fapiao();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);

            if(ds.Tables[0].Rows.Count>0)
            {
                                                if(ds.Tables[0].Rows[0]["id"].ToString()!="")
                {
                    model.id=int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                                                                                                                                if(ds.Tables[0].Rows[0]["type"].ToString()!="")
                {
                    model.type=int.Parse(ds.Tables[0].Rows[0]["type"].ToString());
                }
                                                                                                                                                model.companyname= ds.Tables[0].Rows[0]["companyname"].ToString();
                                                                                                                                model.project= ds.Tables[0].Rows[0]["project"].ToString();
                                                                                                                if(ds.Tables[0].Rows[0]["aomunt"].ToString()!="")
                {
                    model.aomunt=decimal.Parse(ds.Tables[0].Rows[0]["aomunt"].ToString());
                }
                                                                                                                                                model.danweiname= ds.Tables[0].Rows[0]["danweiname"].ToString();
                                                                                                                                model.shibiehao= ds.Tables[0].Rows[0]["shibiehao"].ToString();
                                                                                                                                model.address= ds.Tables[0].Rows[0]["address"].ToString();
                                                                                                                                model.tel= ds.Tables[0].Rows[0]["tel"].ToString();
                                                                                                                                model.bankname= ds.Tables[0].Rows[0]["bankname"].ToString();
                                                                                                                                model.bankaccount= ds.Tables[0].Rows[0]["bankaccount"].ToString();
                                                                                                                if(ds.Tables[0].Rows[0]["userid"].ToString()!="")
                {
                    model.userid=int.Parse(ds.Tables[0].Rows[0]["userid"].ToString());
                }

                return model;
            }
            else
            {
                return null;
            }
        }
예제 #7
0
        private void save_fapiao_info_zengzhi(HttpContext context)
        {
            Model.users model_user = new BasePage().GetUserInfo();
            if (model_user == null)
            {
                context.Response.Write("{\"status\":\"0\", \"msg\":\"请先登录!\"}");
                return;
            }
            string danweiname = DTRequest.GetFormString("danwei");
            string shibiehao = DTRequest.GetFormString("shibiehao");
            string address = DTRequest.GetFormString("address");
            string tel = DTRequest.GetFormString("tel");
            string bankname = DTRequest.GetFormString("bank");
            string bankaccount = DTRequest.GetFormString("bankaccount");

            BLL.fapiao bll = new BLL.fapiao();
            Model.fapiao model = new Model.fapiao();

            model.type = 2;
            model.danweiname = danweiname;
            model.shibiehao = shibiehao;
            model.address = address;
            model.tel = tel;
            model.bankname = bankname;
            model.bankaccount = bankaccount;
            model.userid = model_user.id;
            if (bll.Add(model) != 0)
            {

                context.Response.Write("{\"status\":1, \"msg\":\"保存成功!\"}");
                return;
            }
            else
            {
                context.Response.Write("{\"status\":0, \"msg\":\"保存失败!\"}");
                return;
            }
        }
예제 #8
0
        private void save_fapiao_info_putong(HttpContext context)
        {
            Model.users model_user = new BasePage().GetUserInfo();
            if (model_user == null)
            {
                context.Response.Write("{\"status\":\"0\", \"msg\":\"请先登录!\"}");
                return;
            }
            string companyname = DTRequest.GetFormString("companyname");
            string project = DTRequest.GetFormString("project");
            string money = DTRequest.GetFormString("money");
            BLL.fapiao bll = new BLL.fapiao();
            Model.fapiao model = new Model.fapiao();

            model.type = 1;
            model.companyname = companyname;
            model.project = project;
            model.aomunt = decimal.Parse(money);
            model.userid = model_user.id;
            if (bll.Add(model) != 0)
            {

                context.Response.Write("{\"status\":1, \"msg\":\"保存成功!\"}");
                return;
            }
            else
            {
                context.Response.Write("{\"status\":0, \"msg\":\"保存失败!\"}");
                return;
            }
        }