Ejemplo n.º 1
0
        public static int UpdateCarNumberStatus(Entity.CarNumber entity)
        {
            int                   iReturn   = 0;
            DBOperatorBase        db        = new DataBase();
            IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory();
            SqlTransactionHelper  thelper   = new SqlTransactionHelper(DAL.Config.con);
            IDbTransaction        trans     = thelper.StartTransaction();

            try
            {
                IDbDataParameter[] prams =
                {
                    dbFactory.MakeInParam("@ID",         DBTypeConverter.ConvertCsTypeToOriginDBType(entity.ID.GetType().ToString()),         entity.ID,         32),
                    dbFactory.MakeInParam("@UpdateUser", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.UpdateUser.GetType().ToString()), entity.UpdateUser, 50),
                    dbFactory.MakeInParam("@UpdateDate", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.UpdateDate.GetType().ToString()), entity.UpdateDate,  0),
                    dbFactory.MakeInParam("@IsStop",     DBTypeConverter.ConvertCsTypeToOriginDBType(entity.IsStop.GetType().ToString()),     entity.IsStop, 4)
                };
                iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_CarNumber_UpdateStatus", prams);
                thelper.CommitTransaction(trans);
                iReturn = 1;
            }
            catch (Exception ex)
            {
                thelper.RollTransaction(trans);
                iReturn = 0;
            }
            finally
            {
                db.Conn.Close();
            }
            return(iReturn);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ID">    </param>
        /// <returns></returns>
        public static Entity.CarNumber GetCarNumberByID(int ID)
        {
            Entity.CarNumber      entity    = null;
            DBOperatorBase        db        = new DataBase();
            IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory();

            try
            {
                IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "Select * from [CarNumber] where ID='" + ID + "'", null);
                while (dataReader.Read())
                {
                    entity        = new Entity.CarNumber();
                    entity.ID     = DataHelper.ParseToInt(dataReader["ID"].ToString());
                    entity.Number = dataReader["CarNumber"].ToString();
                    //entity.CreateUser = dataReader["CreateUser"].ToString();
                    //entity.CreateDate = DataHelper.ParseToDate(dataReader["CreateDate"].ToString());
                    //entity.UpdateUser = dataReader["UpdateUser"].ToString();
                    //entity.UpdateDate = DataHelper.ParseToDate(dataReader["UpdateDate"].ToString());
                    entity.IsStop = DataHelper.ParseToBoolean(dataReader["IsStop"].ToString());
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                db.Conn.Close();
            }
            return(entity);
        }
Ejemplo n.º 3
0
        private void LoadData(string sId)
        {
            if (sId != string.Empty)
            {
                Entity.CarNumber entity = DAL.CarNumber.GetCarNumberByID(int.Parse(sId));
                //txt_pwNO.Text = ds.Tables[0].Rows[0]["排污权证号"].ToString();
                txt_bm.Text = entity.Number;

                CheckStop.SelectedValue = entity.IsStop.ToString();
            }
        }
Ejemplo n.º 4
0
        protected void btn_save_Click(object sender, EventArgs e)
        {
            string msg = checkInput();

            if (msg != "")
            {
                Alert.Show(msg);
                return;
            }
            else
            {
                Entity.CarNumber entity = new Entity.CarNumber();
                entity.Number     = txt_bm.Text.Trim();
                entity.IsStop     = bool.Parse(CheckStop.SelectedValue.ToString());
                entity.CreateDate = DateTime.Now;
                entity.CreateUser = Request.Cookies["Cookies"].Values["UserName"].ToString();
                entity.UpdateDate = DateTime.Now;
                entity.UpdateUser = Request.Cookies["Cookies"].Values["UserName"].ToString();
                if (string.IsNullOrEmpty(sGuid))
                {
                    //Add
                    int success = DAL.CarNumber.AddCarNumber(entity);
                    if (success == 1)
                    {
                        Alert.ShowInTop(" 保存成功!", MessageBoxIcon.Information);
                        PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                    }
                    else
                    {
                        Alert.ShowInTop(" 保存失败!", MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    //Update
                    entity.ID = int.Parse(sGuid);

                    int success = DAL.CarNumber.UpdateCarNumber(entity);
                    if (success == 1)
                    {
                        Alert.ShowInTop(" 修改成功!", MessageBoxIcon.Information);
                        PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                    }
                    else
                    {
                        Alert.ShowInTop(" 修改失败!", MessageBoxIcon.Warning);
                    }
                }
            }
        }