Esempio n. 1
0
        public int CountRows(LichLamViecModels clparam)
        {
            logger.Start("CountRows");
            int iResult = 0;

            try
            {
                Hashtable param = new Hashtable();
                param   = base.SetDataToHashtable(false, clparam);
                iResult = (int)sqlMap.ExecuteQueryForObject("cv_lichlamviec.CountRows", param);
            }
            catch (Exception ex)
            {
                sqlMap.RollbackTransaction();
                iResult = 0;
                logger.Error(ex.Message);
            }
            logger.End("CountRows");
            return(iResult);
        }
Esempio n. 2
0
        public List <LichLamViecModels> selectEventForIdEvent(LichLamViecModels clParam)
        {
            logger.Start("selectEventForIdEvent");
            List <LichLamViecModels> lstResult = new List <LichLamViecModels>();

            try
            {
                Hashtable param = base.SetDataToHashtable(false, clParam);
                param["xoa"] = CST_Common.CST_NOT_DELETE;
                IList        iList = sqlMap.ExecuteQueryForList("cv_lichlamviec.loadSuKien", param);
                CastDataType cast  = new CastDataType();
                lstResult = cast.AdvanceCastDataToList <LichLamViecModels>(iList);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            logger.End("selectEventForIdEvent");
            return(lstResult);
        }
Esempio n. 3
0
        public List <LichLamViecModels> SelectRows(LichLamViecModels clParam)
        {
            logger.Start("SelectRows");
            List <LichLamViecModels> lstResult = new List <LichLamViecModels>();

            try
            {
                Hashtable param = new Hashtable();
                param = base.SetDataToHashtable(false, clParam);
                IList        ilist = sqlMap.ExecuteQueryForList("cv_lichlamviec.SelectRows", param);
                CastDataType cast  = new CastDataType();
                lstResult = cast.AdvanceCastDataToList <LichLamViecModels>(ilist);
            }
            catch (Exception ex)
            {
                logger.Error("Loi ---> " + ex.Message);
            }
            logger.End("SelectRows");
            return(lstResult);
        }
        public string updateSuKienRegist(LichLamViecModels clParam)
        {
            logger.Start("updateSuKienRegist");
            string strResult = "";

            try
            {
                Hashtable param = SetDataToHashtable(false, clParam);
                sqlMap.Update("SuKien010000.updateSuKienRegist", param);
                sqlMap.CommitTransaction();
                strResult = "1";
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                strResult = "-1";
            }
            logger.End("updateSuKienRegist");
            return(strResult);
        }
        public string updateEvent(LichLamViecModels clParam)
        {
            logger.Start("updateEvent");
            string strResult = "";

            try
            {
                //if (clParam.loainhacnho == "1")
                //{
                //    //Khoang cach: datetime - int
                //    DateTime dtime = DateTime.Parse(clParam.ngaybatdau);
                //    int temp = int.Parse(clParam.songaynhacnho);
                //    DateTime dtNhacNho = dtime.AddDays(-temp);
                //    if (dtNhacNho.DayOfWeek == DayOfWeek.Sunday)
                //    {
                //        dtNhacNho = dtNhacNho.AddDays(-2);
                //    }
                //    else if (dtNhacNho.DayOfWeek == DayOfWeek.Saturday)
                //    {
                //        dtNhacNho = dtNhacNho.AddDays(-1);
                //    }
                //    clParam.thoigiannhacnho = dtNhacNho.ToString("yyyy-MM-dd");
                //}

                sqlMap.BeginTransaction();
                Hashtable parram = SetDataToHashtable(false, clParam);
                sqlMap.Update("SuKien010000.updateSuKien", parram);

                //sqlMap.Update("SuKien010000.updateSuKienNguoiDung", parram);
                sqlMap.CommitTransaction();
                strResult = "1";
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                sqlMap.RollbackTransaction();
                strResult = "-1";
            }
            logger.End("updateEvent");
            return(strResult);
        }
Esempio n. 6
0
        public LichLamViecModels RowDetail(LichLamViecModels clparam)
        {
            logger.Start("RowDetail");
            LichLamViecModels vbResult = new LichLamViecModels();

            try
            {
                Hashtable param = new Hashtable();
                param = base.SetDataToHashtable(false, clparam);
                IList        ilist = sqlMap.ExecuteQueryForList("cv_lichlamviec.RowDetail", param);
                CastDataType cast  = new CastDataType();
                vbResult = cast.AdvanceCastDataToList <LichLamViecModels>(ilist)[0];
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                vbResult = new LichLamViecModels();
            }
            logger.End("RowDetail");
            return(vbResult);
        }
        public string insertEvent(LichLamViecModels clParam)
        {
            logger.Start("insertEvent");
            string strResult = "";

            try
            {
                sqlMap.BeginTransaction();
                Hashtable parram = SetDataToHashtable(false, clParam);
                parram["xoa"]     = CST_Common.CST_NOT_DELETE;
                parram["seqname"] = "seq_cal_ghichucongviec";
                string id = sqlMap.ExecuteQueryForObject("Common.GetNextVal", parram).ToString();
                parram["maghichu"] = id;
                sqlMap.Insert("SuKien010000.insertSuKien", parram);
                //sqlMap.CommitTransaction();

                ////insert cal_ghichunguoidung
                //Hashtable parram1 = new Hashtable();
                //parram1["maghichu"] = id;
                //parram1["seqname"] = "seq_cal_ghichucongviecnguoidung";
                //string id1 = sqlMap.ExecuteQueryForObject("Common.GetNextVal", parram1).ToString();
                //parram1["maghichunguoidung"] = id1;
                //parram1["mataikhoan"] = clParam.nguoitaoghichucongviec;
                //parram1["loainhacnho"] = clParam.loainhacnho;
                //parram1["thoigiannhacnho"] = clParam.thoigiannhacnho;
                //parram1["songaynhacnho"] = clParam.songaynhacnho;
                //parram1["danhacnho"] = CST_Common.CST_CHUANHACNHO_FLG;
                //sqlMap.Insert("SuKien010000.insertSuKienNguoiDung", parram1);
                sqlMap.CommitTransaction();
                strResult = id;
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                sqlMap.RollbackTransaction();
                strResult = "-1";
            }
            logger.End("insertEvent");
            return(strResult);
        }
        public string editCal(LichLamViecModels clParam)
        {
            logger.Start("editCal");
            string strResult = "";

            try
            {
                sqlMap.BeginTransaction();
                Hashtable param = SetDataToHashtable(false, clParam);
                sqlMap.Update("SuKien010000.editCal", param);
                strResult = "1";
                sqlMap.CommitTransaction();
            }
            catch (Exception ex)
            {
                sqlMap.RollbackTransaction();
                logger.Error(ex);
                strResult = "0";
            }
            logger.End("editCal");
            return(strResult);
        }
Esempio n. 9
0
        public string InsertRow(LichLamViecModels clParam)
        {
            logger.Start("InsertRow");
            string strResult = "";

            try
            {
                sqlMap.BeginTransaction();
                Hashtable param = new Hashtable();
                param            = base.SetDataToHashtable(false, clParam);
                param["seqname"] = "seq_cal_lichlamviec";
                string strid = sqlMap.ExecuteQueryForObject("Common.GetNextVal", param).ToString();
                int    iID   = -1;
                int.TryParse(strid, out iID);
                if (iID == -1)
                {
                    return(string.Empty);
                }
                //tao ma cong viec
                param["malichlamviec"] = string.Format(Functiontring.ReturnStringFormatID("malichlamviec"),
                                                       clParam.maphongban,
                                                       DateTime.Now.Year,
                                                       DateTime.Now.Month,
                                                       iID.ToString("0000"));
                sqlMap.Insert("cv_lichlamviec.InsertRow", param);
                sqlMap.CommitTransaction();
                strResult = param["malichlamviec"].ToString();
            }
            catch (Exception ex)
            {
                sqlMap.RollbackTransaction();
                strResult = "-1";
                logger.Error(ex.Message);
            }
            logger.End("InsertRow");
            return(strResult);
        }
Esempio n. 10
0
        public bool UpdateRow(LichLamViecModels clParam)
        {
            logger.Start("UpdateRow");
            bool bResult = false;

            try
            {
                sqlMap.BeginTransaction();
                Hashtable param = new Hashtable();
                param = base.SetDataToHashtable(false, clParam);

                sqlMap.Update("cv_lichlamviec.UpdateRow", param);
                sqlMap.CommitTransaction();
                bResult = true;
            }
            catch (Exception ex)
            {
                sqlMap.RollbackTransaction();
                bResult = false;
                logger.Error(ex.Message);
            }
            logger.End("UpdateRow");
            return(bResult);
        }
Esempio n. 11
0
        public string insertCal(LichLamViecModels clParam)
        {
            logger.Start("insertCal");
            string strResult = "";

            try
            {
                sqlMap.BeginTransaction();
                Hashtable param = SetDataToHashtable(false, clParam);
                param["seqname"]  = "seq_cal_ghichucongviec";
                param["maghichu"] = sqlMap.ExecuteQueryForObject("Common.GetNextVal", param).ToString();
                sqlMap.Insert("SuKien010000.insertCal", param);
                strResult = "Lưu thành công";
                sqlMap.CommitTransaction();
            }
            catch (Exception ex)
            {
                sqlMap.RollbackTransaction();
                logger.Error(ex);
                strResult = "Lỗi " + ex.Message;
            }
            logger.End("insertCal");
            return(strResult);
        }