Example #1
0
        public int Operation(string _operator, ListLoaiVatTu _operand, ListLoaiVatTu oldstate)
        {
            int code = 0;

            switch (_operator)
            {
            case "insert":
                code = CreateLoaiVatTu(_operand);
                break;

            case "update":
                code = UpdateLoaiVatTu(_operand);
                break;

            case "delete":
                code = RemoveLoaiVatTu(_operand);
                break;

            case "unupdate":
                code = UpdateLoaiVatTu(oldstate);
                break;
            }
            return(code);
        }
Example #2
0
 private int RemoveLoaiVatTu(ListLoaiVatTu lvt)
 {
     string[] name  = { "MALOAI" };
     string[] param = { lvt.MALOAI };
     return(Access.ExecuteNonQuery("SP_XOA_LOAIVT", name, param, 1));
 }
Example #3
0
 private int UpdateLoaiVatTu(ListLoaiVatTu lvt)
 {
     string[] name  = { "MALOAI", "@TENLOAI" };
     string[] param = { lvt.MALOAI, lvt.TENLOAI };
     return(Access.ExecuteNonQuery("SP_SUA_LOAIVT", name, param, 2));
 }
Example #4
0
 public LoaiVTCommand(string _operator, ListLoaiVatTu _operand, ListLoaiVatTu oldstate)
 {
     this._operator = _operator;
     this._operand  = _operand;
     this.oldstate  = oldstate;
 }