コード例 #1
0
        private void SaveData()
        {
            try
            {
                if (Request.QueryString["id"] != null)
                {
                    int    id   = int.Parse(Request.QueryString["id"].ToString());
                    int    code = -1;
                    string msg  = "";

                    FeeManager feeManager = new FeeManager();
                    FeeBase    fee        = new FeeBase();

                    fee.FeeId      = id;
                    fee.FeeTypeId  = int.Parse(ddlFeeType.SelectedValue);
                    fee.Amount     = decimal.Parse(txtAmount.Text.Trim().Replace(",", ""));
                    fee.UserName   = txtUserName.Text.Trim();
                    fee.Note       = txtNote.Text.Trim();
                    fee.FeeStatus  = int.Parse(ddlFeeStatus.SelectedValue);
                    fee.UpdateDate = DateTime.Now;
                    fee.UpdateUser = User.Identity.Name;

                    feeManager.Fee_Update(fee, ref code, ref msg);

                    if (code == 0)
                    {
                        ErrorBox.Message  = string.Empty;
                        NotifyBox.Message = "Lưu dữ liệu thành công";
                    }
                    else
                    {
                        ErrorBox.Message  = "Lưu dữ liệu thất bại";
                        NotifyBox.Message = string.Empty;
                    }

                    SaveActionLog("Cập nhật", string.Format("code: {0}; msg: {1}; id: {2}", code, msg, id));
                }
                else
                {
                    ErrorBox.Message  = "Không lấy được dữ liệu";
                    NotifyBox.Message = string.Empty;
                }
            }
            catch (Exception ex)
            {
                ErrorBox.Message  = "Lỗi chức năng";
                NotifyBox.Message = string.Empty;
                SaveErrorLog(ex);
            }
        }
コード例 #2
0
        private void SaveData()
        {
            try
            {
                int    code = -1;
                string msg  = "";

                FeeManager feeManager = new FeeManager();
                FeeBase    fee        = new FeeBase();

                fee.FeeTypeId  = int.Parse(ddlFeeType.SelectedValue);
                fee.Amount     = decimal.Parse(txtAmount.Text.Trim().Replace(",", ""));
                fee.UserName   = txtUserName.Text.Trim();
                fee.Note       = txtNote.Text.Trim();
                fee.FeeStatus  = int.Parse(ddlFeeStatus.SelectedValue);
                fee.CreateDate = DateTime.Now;
                fee.CreateUser = User.Identity.Name;

                feeManager.Fee_Insert(fee, ref code, ref msg);

                if (code == 0)
                {
                    ErrorBox.Message  = string.Empty;
                    NotifyBox.Message = "Lưu dữ liệu thành công";
                }
                else
                {
                    ErrorBox.Message  = "Lưu dữ liệu thất bại";
                    NotifyBox.Message = string.Empty;
                }

                SaveActionLog("Thêm mới", string.Format("code: {0}; msg: {1}", code, msg));
            }
            catch (Exception ex)
            {
                ErrorBox.Message  = "Lỗi chức năng";
                NotifyBox.Message = string.Empty;
                SaveErrorLog(ex);
            }
        }
コード例 #3
0
 public void Fee_Update(FeeBase fee, ref int code, ref string msg)
 {
     adapter.Fee_Update(fee, ref code, ref msg);
 }
コード例 #4
0
        public void Fee_Update(FeeBase fee, ref int code, ref string msg)
        {
            try
            {
                List <SqlParameter> paramList = new List <SqlParameter>();
                SqlParameter        param;

                param           = new SqlParameter("@FeeId", SqlDbType.Int, 4);
                param.Direction = ParameterDirection.Input;
                param.Value     = fee.FeeId;
                paramList.Add(param);

                param           = new SqlParameter("@FeeTypeId", SqlDbType.Int, 4);
                param.Direction = ParameterDirection.Input;
                param.Value     = fee.FeeTypeId;
                paramList.Add(param);

                param           = new SqlParameter("@Amount", SqlDbType.Decimal);
                param.Direction = ParameterDirection.Input;
                param.Value     = fee.Amount;
                paramList.Add(param);

                param           = new SqlParameter("@UserName", SqlDbType.NVarChar, 50);
                param.Direction = ParameterDirection.Input;
                param.Value     = fee.UserName;
                paramList.Add(param);

                param           = new SqlParameter("@Note", SqlDbType.NVarChar, 500);
                param.Direction = ParameterDirection.Input;
                param.Value     = fee.Note;
                paramList.Add(param);

                param           = new SqlParameter("@FeeStatus", SqlDbType.Int, 4);
                param.Direction = ParameterDirection.Input;
                param.Value     = fee.FeeStatus;
                paramList.Add(param);

                param           = new SqlParameter("@UpdateDate", SqlDbType.DateTime);
                param.Direction = ParameterDirection.Input;
                param.Value     = fee.UpdateDate;
                paramList.Add(param);

                param           = new SqlParameter("@UpdateUser", SqlDbType.VarChar, 50);
                param.Direction = ParameterDirection.Input;
                param.Value     = fee.UpdateUser;
                paramList.Add(param);

                using (SqlDataReader dr = (SqlDataReader)Database.ExecuteReader("usp_Fee_Update", CommandType.StoredProcedure, paramList.ToArray()))
                {
                    if (dr.HasRows)
                    {
                        DataTable dt = new DataTable("dt");
                        dt.Load(dr);

                        DataRow row = dt.Rows[0];
                        code = int.Parse(row["code"].ToString());
                        msg  = row["msg"].ToString();
                    }

                    Database.CloseConn();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #5
0
 public void Fee_Insert(FeeBase fee, ref int code, ref string msg)
 {
     adapter.Fee_Insert(fee, ref code, ref msg);
 }