Ejemplo n.º 1
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            DialogResult res = MessageBoxEx.Show("是否同时更新为已录入状态?", "确认", MessageBoxButtons.YesNoCancel);

            if (res == DialogResult.Cancel)
            {
                return;
            }
            CtrlsToModel();
            if (res == DialogResult.Yes)
            {
                _model.HasTypeIn = HasTypeIn.Yes;
            }
            if (!bll.Update(_model))
            {
                MessageBoxEx.Show("更新失败,请重试!");
                return;
            }

            //添加记录
            TravelAgency.Model.ActionRecords log = new ActionRecords();
            log.ActType     = Common.Enums.ActType._04校验;
            log.WorkId      = Common.GlobalUtils.LoginUser.WorkId;
            log.UserName    = Common.GlobalUtils.LoginUser.UserName;
            log.VisaInfo_id = _model.VisaInfo_id;
            //log.Visa_id = _model.Visa_id;
            log.Type      = _model.Types;
            log.EntryTime = DateTime.Now;
            _bllActionRecords.Add(log);

            _updateDel(_curPage);
            Close();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(TravelAgency.Model.ActionRecords model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ActionRecords set ");
            strSql.Append("ActType=@ActType,");
            strSql.Append("WorkId=@WorkId,");
            strSql.Append("UserName=@UserName,");
            strSql.Append("VisaInfo_id=@VisaInfo_id,");
            strSql.Append("Visa_id=@Visa_id,");
            strSql.Append("Type=@Type,");
            strSql.Append("EntryTime=@EntryTime");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ActType",     SqlDbType.VarChar,           50),
                new SqlParameter("@WorkId",      SqlDbType.VarChar,           50),
                new SqlParameter("@UserName",    SqlDbType.VarChar,          100),
                new SqlParameter("@VisaInfo_id", SqlDbType.UniqueIdentifier,  16),
                new SqlParameter("@Visa_id",     SqlDbType.UniqueIdentifier,  16),
                new SqlParameter("@Type",        SqlDbType.VarChar,           50),
                new SqlParameter("@EntryTime",   SqlDbType.DateTime),
                new SqlParameter("@id",          SqlDbType.Int, 4)
            };
            parameters[0].Value = model.ActType;
            parameters[1].Value = model.WorkId;
            parameters[2].Value = model.UserName;
            parameters[3].Value = model.VisaInfo_id;
            parameters[4].Value = model.Visa_id;
            parameters[5].Value = model.Type;
            parameters[6].Value = model.EntryTime;
            parameters[7].Value = model.id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public TravelAgency.Model.ActionRecords DataRowToModel(DataRow row)
 {
     TravelAgency.Model.ActionRecords model = new TravelAgency.Model.ActionRecords();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["ActType"] != null)
         {
             model.ActType = row["ActType"].ToString();
         }
         if (row["WorkId"] != null)
         {
             model.WorkId = row["WorkId"].ToString();
         }
         if (row["UserName"] != null)
         {
             model.UserName = row["UserName"].ToString();
         }
         if (row["VisaInfo_id"] != null && row["VisaInfo_id"].ToString() != "")
         {
             model.VisaInfo_id = new Guid(row["VisaInfo_id"].ToString());
         }
         if (row["Visa_id"] != null && row["Visa_id"].ToString() != "")
         {
             model.Visa_id = new Guid(row["Visa_id"].ToString());
         }
         if (row["Type"] != null)
         {
             model.Type = row["Type"].ToString();
         }
         if (row["EntryTime"] != null && row["EntryTime"].ToString() != "")
         {
             model.EntryTime = DateTime.Parse(row["EntryTime"].ToString());
         }
     }
     return(model);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(TravelAgency.Model.ActionRecords model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ActionRecords(");
            strSql.Append("ActType,WorkId,UserName,VisaInfo_id,Visa_id,Type,EntryTime)");
            strSql.Append(" values (");
            strSql.Append("@ActType,@WorkId,@UserName,@VisaInfo_id,@Visa_id,@Type,@EntryTime)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ActType",     SqlDbType.VarChar,           50),
                new SqlParameter("@WorkId",      SqlDbType.VarChar,           50),
                new SqlParameter("@UserName",    SqlDbType.VarChar,          100),
                new SqlParameter("@VisaInfo_id", SqlDbType.UniqueIdentifier,  16),
                new SqlParameter("@Visa_id",     SqlDbType.UniqueIdentifier,  16),
                new SqlParameter("@Type",        SqlDbType.VarChar,           50),
                new SqlParameter("@EntryTime",   SqlDbType.DateTime)
            };
            parameters[0].Value = model.ActType;
            parameters[1].Value = model.WorkId;
            parameters[2].Value = model.UserName;
            parameters[3].Value = model.VisaInfo_id;//这里不能是new GUID
            parameters[4].Value = model.Visa_id;
            parameters[5].Value = model.Type;
            parameters[6].Value = model.EntryTime;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TravelAgency.Model.ActionRecords GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,ActType,WorkId,UserName,VisaInfo_id,Visa_id,Type,EntryTime from ActionRecords ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }