Ejemplo n.º 1
0
        public static IssueModel LayThongTinVanDe(int VanDeID)
        {
            IssueModel IM = new IssueModel();

            try {
                DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.ConnectionString(), CommandType.Text, "SELECT * FROM VanDe WHERE VanDeID=" + VanDeID.ToString());
                if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    IM.VanDeID       = Int32.Parse(ds.Tables[0].Rows[0]["VanDeID"].ToString());
                    IM.DuAnID        = Int32.Parse(ds.Tables[0].Rows[0]["DuAnID"].ToString());
                    IM.LoaiVanDeID   = Int32.Parse(ds.Tables[0].Rows[0]["LoaiVanDeID"].ToString());
                    IM.TenVanDe      = ds.Tables[0].Rows[0]["TenVanDe"].ToString();
                    IM.MoTa          = ds.Tables[0].Rows[0]["MoTa"].ToString();
                    IM.TrangThai     = Int32.Parse(ds.Tables[0].Rows[0]["TrangThai"].ToString());
                    IM.NguoiThucHien = ds.Tables[0].Rows[0]["NguoiThucHien"].ToString();
                    IM.NgayBatDau    = FormatDate(ds.Tables[0].Rows[0]["NgayBatDau"].ToString());
                    IM.NgayKetThuc   = FormatDate(ds.Tables[0].Rows[0]["NgayKetThuc"].ToString());
                    IM.SoGioDuKien   = Int32.Parse(ds.Tables[0].Rows[0]["SoGioDuKien"].ToString());
                    IM.SoGioThucTe   = Int32.Parse(ds.Tables[0].Rows[0]["SoGioThucTe"].ToString());
                }
            }
            catch (Exception ex)
            { }

            return(IM);
        }
Ejemplo n.º 2
0
        public static ResData CapNhatVanDe(IssueModel IM)
        {
            ResData res = new ResData();

            try
            {
                SqlParameter ResultID = new SqlParameter();
                ResultID.ParameterName = "@ResultID";
                ResultID.Direction     = ParameterDirection.Output;
                ResultID.SqlDbType     = SqlDbType.Int;

                SqlParameter ResultDesc = new SqlParameter();
                ResultDesc.ParameterName = "@ResultDesc";
                ResultDesc.Direction     = ParameterDirection.Output;
                ResultDesc.SqlDbType     = SqlDbType.NVarChar;
                ResultDesc.Size          = 500;

                SqlParameter ResultVanDeID = new SqlParameter();
                ResultVanDeID.ParameterName = "@ResultVanDeID";
                ResultVanDeID.Direction     = ParameterDirection.Output;
                ResultVanDeID.SqlDbType     = SqlDbType.Int;

                SqlParameter[] pars =
                {
                    new SqlParameter("VanDeID",       IM.VanDeID),
                    new SqlParameter("DuAnID",        IM.DuAnID),
                    new SqlParameter("LoaiVanDeID",   IM.LoaiVanDeID),
                    new SqlParameter("TenVanDe",      IM.TenVanDe),
                    new SqlParameter("MoTa",          IM.MoTa),
                    new SqlParameter("FileDinhKem",   IM.FileDinhKem),
                    new SqlParameter("TrangThai",     IM.TrangThai),
                    new SqlParameter("NguoiThucHien", IM.NguoiThucHien),
                    new SqlParameter("NgayBatDau",    IM.NgayBatDau),
                    new SqlParameter("NgayKetThuc",   IM.NgayKetThuc),
                    new SqlParameter("SoGioDuKien",   IM.SoGioDuKien),
                    new SqlParameter("SoGioThucTe",   IM.SoGioThucTe),
                    new SqlParameter("NguoiCapNhat",  IM.NguoiCapNhat),
                    ResultID,
                    ResultDesc,
                    ResultVanDeID
                };

                SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionString(), CommandType.StoredProcedure, "sp_VanDe_Update", pars);

                res.ResultID      = Int32.Parse(ResultID.Value.ToString());
                res.ResultDesc    = ResultDesc.Value.ToString();
                res.ResultVanDeID = Int32.Parse(ResultVanDeID.Value.ToString());
            }
            catch (Exception ex)
            {
                res.ResultID   = -99;
                res.ResultDesc = ex.Message;
            }
            return(res);
        }