Esempio n. 1
0
        public ZOO_PHIEUNHAPTHUOC_InsResult LuuPhieuNhap(ZOO_PHIEUNHAPTHUOC data)
        {
            try
            {
                using (var dataContext = new AssetDataContext())
                {
                    ZOO_PHIEUNHAPTHUOC_InsResult result = dataContext.ZOO_PHIEUNHAPTHUOC_Ins(
                        data.MaLo,
                        data.SoLuong,
                        data.NgayNhap == null ? "" : data.NgayNhap.Value.ToString(formatDate),

                        data.NOTES,
                        data.RECORD_STATUS,
                        data.MAKER_ID,
                        data.CREATE_DT == null ? "" : data.CREATE_DT.Value.ToString(formatDate),
                        data.AUTH_STATUS,
                        data.CHECKER_ID,
                        data.APPROVE_DT == null ? "" : data.APPROVE_DT.Value.ToString(formatDate)
                        ).FirstOrDefault();

                    return(result);
                }
            }
            catch (Exception ex)
            {
                return(new ZOO_PHIEUNHAPTHUOC_InsResult()
                {
                    Result = "-1", ErrorDesc = ex.Message, MaPhieuNhap = ""
                });
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Goi Store thong bang parameter
        /// </summary>
        /// <typeparam name="T">Doi tuong store tra ve</typeparam>
        /// <param name="parameters">Doi so truyen vao store</param>
        /// <returns></returns>
        public IEnumerable <T> ExecuteStoredProcedure <T>(List <gParam> parameters)
        {
            try
            {
                using (var dataContext = new AssetDataContext())
                {
                    Type genericType = typeof(T);

                    string   commandsthing = genericType.Name.Replace("Result", " ");
                    int      count         = parameters.Count();
                    string[] param         = new string[count];
                    for (int i = 0; i < count; i++)
                    {
                        if (i > 0)
                        {
                            commandsthing += ", ";
                        }
                        commandsthing += parameters[i].Name + "={" + i.ToString() + "} ";
                        param[i]       = parameters[i].Value == null ? "" : parameters[i].Value;
                    }

                    return(dataContext.ExecuteQuery <T>(commandsthing, param).ToList <T>());
                }
            }
            catch (Exception)
            {
                return(null);
            }
        }
Esempio n. 3
0
        public ZOO_LOTHUOC_UpdResult ChinhSuaLoThuoc(ZOO_LOTHUOC data)
        {
            try
            {
                using (var dataContext = new AssetDataContext())
                {
                    ZOO_LOTHUOC_UpdResult result = dataContext.ZOO_LOTHUOC_Upd(
                        data.MaLo,
                        data.MaThuoc,
                        data.SoLo,
                        data.NgaySanXuat == null ? "" : data.NgaySanXuat.Value.ToString(formatDate),
                        data.NgayHetHan == null ? "" : data.NgayHetHan.Value.ToString(formatDate),
                        data.SoLuong,

                        data.NOTES,
                        data.RECORD_STATUS,
                        data.MAKER_ID,
                        data.CREATE_DT == null ? "" : data.CREATE_DT.Value.ToString(formatDate),
                        data.AUTH_STATUS,
                        data.CHECKER_ID,
                        data.APPROVE_DT == null ? "" : data.APPROVE_DT.Value.ToString(formatDate)
                        ).FirstOrDefault();

                    return(result);
                }
            }
            catch (Exception ex)
            {
                return(new ZOO_LOTHUOC_UpdResult()
                {
                    Result = "-1", ErrorDesc = ex.Message, MaLo = ""
                });
            }
        }
Esempio n. 4
0
 public IEnumerable <ZOO_PHIEUNHAPTHUOC_SearchResult> TimPhieuNhap(string maphieu, string tenthuoc, DateTime ngaynhap, int top)
 {
     try
     {
         using (var dataContext = new AssetDataContext())
         {
             IEnumerable <ZOO_PHIEUNHAPTHUOC_SearchResult> result = dataContext.ZOO_PHIEUNHAPTHUOC_Search(maphieu, tenthuoc, ngaynhap == null ? "" : ngaynhap.ToString(formatDate), top).ToList();
             return(result);
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }
Esempio n. 5
0
 public IEnumerable <ZOO_LOTHUOC_SearchResult> TimLoThuocCombobox(string mathuoc)
 {
     try
     {
         using (var dataContext = new AssetDataContext())
         {
             IEnumerable <ZOO_LOTHUOC_SearchResult> result = dataContext.ZOO_LOTHUOC_Search("", mathuoc, "", "", "", "", 0).ToList();
             return(result);
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }
Esempio n. 6
0
 public IEnumerable <CM_ALLCODE_SearchResult> CM_ALLCODE_Search(CM_ALLCODE_SearchResult data, int top)
 {
     try
     {
         using (var dataContext = new AssetDataContext())
         {
             var result = dataContext.CM_ALLCODE_Search(data.ID, data.CDNAME, data.CDVAL, data.CONTENT, data.CDTYPE, data.LSTODR, 200);
             return(result.ToList());
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }
Esempio n. 7
0
 public IEnumerable <ZOO_THUOC> DanhSachThuoc()
 {
     try
     {
         using (var dataContext = new AssetDataContext())
         {
             var result = dataContext.ZOO_THUOCs.ToList();
             return(result);
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }
Esempio n. 8
0
        public IEnumerable <ZOO_BAOCAOTONKHO_SearchResult> LayBaoCaoTonKho(string maThuoc, string tenThuoc, DateTime ngayHetHang)
        {
            try
            {
                using (var dataContext = new AssetDataContext())
                {
                    IEnumerable <ZOO_BAOCAOTONKHO_SearchResult> result = dataContext.ZOO_BAOCAOTONKHO_Search(maThuoc, tenThuoc, ngayHetHang == null ? DateTime.Now.ToString(formatDate) : ngayHetHang.ToString(formatDate), 0).ToList();

                    return(result);
                }
            }
            catch (Exception)
            {
                return(null);
            }
        }
Esempio n. 9
0
        public IEnumerable <CM_ALLCODE_By_Type_IdResult> CM_ALLCODE_By_Type_Id(string CDTYPE)
        {
            try
            {
                using (var dataContext = new AssetDataContext())
                {
                    var result = dataContext.CM_ALLCODE_By_Type_Id(CDTYPE);

                    return(result.ToList());
                }
            }
            catch (Exception)
            {
                return(null);
            }
        }
Esempio n. 10
0
        public IEnumerable <CM_DEPT_GROUP_SearchResult> SearchCM_DEPT_GROUP(CM_DEPT_GROUP_SearchResult data, int top)
        {
            try
            {
                using (var dataContext = new AssetDataContext())
                {
                    IEnumerable <CM_DEPT_GROUP_SearchResult> result = dataContext.CM_DEPT_GROUP_Search(data.GROUP_ID, data.GROUP_CODE, data.GROUP_NAME, data.NOTES, data.RECORD_STATUS, data.AUTH_STATUS,
                                                                                                       data.MAKER_ID, data.CREATE_DT == null ? "" : data.CREATE_DT.Value.ToString(formatDate), data.CHECKER_ID, data.APPROVE_DT == null ? "" : data.APPROVE_DT.Value.ToString(formatDate), top).ToList();

                    return(result);
                }
            }
            catch (Exception)
            {
                return(null);
            }
        }
Esempio n. 11
0
 public CM_ALLCODE_UpdResult CM_ALLCODE_Upd(CM_ALLCODE_SearchResult data)
 {
     try
     {
         using (var dataContext = new AssetDataContext())
         {
             CM_ALLCODE_UpdResult result = dataContext.CM_ALLCODE_Upd(data.ID, data.CDNAME, data.CDVAL, data.CONTENT, data.CDTYPE, data.LSTODR).Single();
             return(result);
         }
     }
     catch (Exception ex)
     {
         return(new CM_ALLCODE_UpdResult()
         {
             Result = "-1", ID = -1, ErrorDesc = ex.Message
         });
     }
 }
Esempio n. 12
0
 public CM_DEPT_GROUP_ApprResult CM_DEPT_GROUP_Appr(CM_DEPT_GROUP_SearchResult data)
 {
     try
     {
         using (var dataContext = new AssetDataContext())
         {
             CM_DEPT_GROUP_ApprResult result = dataContext.CM_DEPT_GROUP_Appr(data.GROUP_ID, data.AUTH_STATUS, data.CHECKER_ID, data.APPROVE_DT == null ? "" : data.APPROVE_DT.Value.ToString(formatDate)).Single();
             return(result);
         }
     }
     catch (Exception ex)
     {
         return(new CM_DEPT_GROUP_ApprResult()
         {
             Result = "-1", ErrorDesc = ex.Message
         });
     }
 }
Esempio n. 13
0
 public CM_DEPT_GROUP_DelResult CM_DEPT_GROUP_Del(string id)
 {
     try
     {
         using (var dataContext = new AssetDataContext())
         {
             CM_DEPT_GROUP_DelResult result = dataContext.CM_DEPT_GROUP_Del(id).Single();
             return(result);
         }
     }
     catch (Exception ex)
     {
         return(new CM_DEPT_GROUP_DelResult()
         {
             Result = "-1", ErrorDesc = ex.Message
         });
     }
 }