Exemplo n.º 1
0
        public void CapNhatMonAn()
        {
            int flag = 0;
            int[] index = gridView_MonAn.GetSelectedRows();
            if (index.Length > 0)
            {
                string tenMon = gridView_MonAn.GetRowCellValue(index[0], "TenMon").ToString();
                //  string maloai = gridView_MonAn.GetRowCellValue(index[0], "LoaiMon").ToString();
                string gia = gridView_MonAn.GetRowCellValue(index[0], "Gia").ToString();
                string donvitinh = gridView_MonAn.GetRowCellValue(index[0], "DonViTinh").ToString();
                //  string maNH = gridView_MonAn.GetRowCellValue(index[0], "MaNH").ToString();

                if (tenMon != null)
                {
                    DTO.MonAn_DTO MonAn = new MonAn_DTO();
                    MonAn.tenmon = tenMon;
                    //  MonAn.MaLoai = maloai;
                    MonAn.Gia =double.Parse( gia);
                    MonAn.Dvtinh= donvitinh;
                    //  MonAn.MaNhaHang = maNH;        dang can nhac

                    chon = index[0];
                     tt = ArrayMaMon[chon];
                    flag = MonAn_BUS.CapNhatMonAn(mode,MonAn, tt,maNH);
                }
            }
            if (flag != 0)
            {
                DevExpress.XtraEditors.XtraMessageBox.Show("Cập nhật thành công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);

            }
        }
Exemplo n.º 2
0
 public static int CapNhatMonAn_Commit(MonAn_DTO MonAn, int maMonAn)
 {
     Provider provider = new Provider();
     string sql = string.Format("update MonAn set TenMon=N'{0}',Gia='{1}',DonViTinh='{2}' where MaMon='{3}'", MonAn.tenmon, MonAn.Gia, MonAn.Dvtinh, maMonAn);
     sql += " commit tran";
     SqlCommand cm = provider.CreateCommandStringSql(sql);
     return provider.ExecuteInsertUpdateDelete(cm);
 }
Exemplo n.º 3
0
        public static int CapNhatMonAn(int mode,MonAn_DTO MonAn, int maMonAn)
        {
            Provider provider = new Provider();
            string store="sp_CapNhatMonAn";
            if(mode==3)
                store = "sp_CapNhatMonAn_Fix";
            //chua xu ly nha hang
               // string sql = string.Format("update MonAn set TenMon=N'{0}',Gia='{1}',DonViTinh='{2}' where MaMon='{3}' and MaNH='{4}'", MonAn.tenmon, MonAn.Gia, MonAn.Dvtinh, maMonAn,maNH);

            SqlCommand cm = provider.CreateCommandStoreName(store);
            cm.Parameters.Add("@TenMon", SqlDbType.NVarChar, 50);
            cm.Parameters.Add("@gia", SqlDbType.Money);
            cm.Parameters.Add("@DVTinh", SqlDbType.NVarChar, 10);
            cm.Parameters.Add("@MaMon", SqlDbType.Int);

            cm.Parameters["@TenMon"].Value = MonAn.tenmon;
            cm.Parameters["@gia"].Value = MonAn.Gia;
            cm.Parameters["@DVTinh"].Value = MonAn.Dvtinh;
            cm.Parameters["@MaMon"].Value = maMonAn;
            return provider.ExecuteInsertUpdateDelete(cm);
        }
Exemplo n.º 4
0
 //public static DataTable DocMonAn_Commit()
 //{
 //    return MonAn_DAO.DocMonAn_Commit();
 //}
 public static int ThemMonAn(int mode,MonAn_DTO monAn, string maNH)
 {
     return MonAn_DAO.ThemMonAn(mode,monAn, maNH);
 }
Exemplo n.º 5
0
 public static int CapNhatMonAn(int mode,MonAn_DTO MonAn, int maMonAn, string maNH)
 {
     return MonAn_DAO.CapNhatMonAn(mode,MonAn, maMonAn);
 }
Exemplo n.º 6
0
        public static int ThemMonAn(int mode,MonAn_DTO MonAn,string maNH)
        {
            Provider provider = new Provider();
            string  store="sp_ThemMonAn";

            if(mode==3)
                store = "sp_ThemMonAn_Fix";
            //string sql = string.Format("insert into MonAn(TenMon,LoaiMon,Gia,DonViTinh,MaNH) values ('{0}','{1}','{2}','{3}','{4}')", MonAn.tenmon, MonAn.Mamon, MonAn.Gia, MonAn.Dvtinh,maNH);
            SqlCommand cm = provider.CreateCommandStoreName(store);
            cm.Parameters.Add("@TenMon", SqlDbType.NVarChar,50);
            cm.Parameters.Add("@LoaiMon", SqlDbType.NChar, 20);
            cm.Parameters.Add("@Gia", SqlDbType.Int);
            cm.Parameters.Add("@DonViTinh", SqlDbType.NVarChar, 20);
            cm.Parameters.Add("@MaNH", SqlDbType.NChar, 5);

            cm.Parameters["@TenMon"].Value = MonAn.tenmon;
            cm.Parameters["@LoaiMon"].Value = MonAn.Mamon;
            cm.Parameters["@Gia"].Value = MonAn.Gia;
            cm.Parameters["@DonViTinh"].Value = MonAn.Dvtinh;
            cm.Parameters["@MaNH"].Value = maNH;
            return provider.ExecuteInsertUpdateDelete(cm);
        }