コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (selectedHoaDon == null || tbRepairInfo.Text == "" || tbWage.Text == "")
            {
                return;
            }
            //Tạo đối tượng DTO sửa chữa
            try
            {
                DTO_SuaChua repairDTO = new DTO_SuaChua();
                repairDTO.Date      = DateTime.Now;
                repairDTO.ID        = repairBUS.getNextRepairingId();
                repairDTO.requestID = selectedHoaDon.ID;
                repairDTO.TienCong  = Int32.Parse(tbWage.Text);
                repairDTO.MoTaLoi   = tbRepairInfo.Text + "\r\nNgày sửa: " + DateTime.Now.ToString("dd-mm-yyyy HH:MM:ss");

                repairBUS.insertRepairing(repairDTO);

                //listRequest.SelectedIndex = -1;
                btnSave.Enabled = false;

                ReloadRequestList();
                UpdateTotalPrice();
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }
        }
コード例 #2
0
        public bool deleteRepairing(DTO_SuaChua repairDTO)
        {
            string query = "delete from SUACHUA where MaSuaChua = @_id";

            SqlParameter[] sqlParameters = new SqlParameter[1];
            sqlParameters[0]       = new SqlParameter("@_id", SqlDbType.VarChar);
            sqlParameters[0].Value = Convert.ToString(repairDTO.ID);
            return(conn.executeDeleteQuery(query, sqlParameters));
        }
コード例 #3
0
        public DTO_SuaChua getRepairingById(int _id)
        {
            DTO_SuaChua repairDTO = new DTO_SuaChua();
            DataTable   dataTable = new DataTable();

            dataTable = repairDAL.getRepairingById(_id);
            foreach (DataRow dr in dataTable.Rows)
            {
                repairDTO.fromDatarow(dr);
            }
            return(repairDTO);
        }
コード例 #4
0
        public bool insertRepairing(DTO_SuaChua repairDTO)
        {
            string query = "if exists (select * from YEUCAUSUACHUA where MaYeuCau = @_MaYeuCau and DaSuaChua = 0) begin insert into SUACHUA(MaYeuCau, NgayLap, TienCong, MoTaLoi) " +
                           " values(@_MaYeuCau,@_NgayLap, @_TienCong, @_MoTaLoi ) update YEUCAUSUACHUA set DaSuaChua = 1 where MaYeuCau = @_MaYeuCau end  ";

            SqlParameter[] sqlParameters = new SqlParameter[4];
            sqlParameters[0]       = new SqlParameter("@_MaYeuCau", SqlDbType.VarChar);
            sqlParameters[0].Value = repairDTO.requestID.ToString();
            sqlParameters[1]       = new SqlParameter("@_NgayLap", SqlDbType.VarChar);
            sqlParameters[1].Value = repairDTO.Date.ToString("MM-dd-yyyy");
            sqlParameters[2]       = new SqlParameter("@_TienCong", SqlDbType.VarChar);
            sqlParameters[2].Value = repairDTO.TienCong.ToString();
            sqlParameters[3]       = new SqlParameter("@_MoTaLoi", SqlDbType.NVarChar);
            sqlParameters[3].Value = repairDTO.MoTaLoi;

            return(conn.executeInsertQuery(query, sqlParameters));
        }
コード例 #5
0
 public bool deleteBoughtDevice(DTO_SuaChua repairDTO)
 {
     return(repairDAL.deleteRepairing(repairDTO));
 }
コード例 #6
0
 public bool insertRepairing(DTO_SuaChua repairDTO)
 {
     return(repairDAL.insertRepairing(repairDTO));
 }