Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Load all of the territories into a DataView from the SqlDataSource
            territoryData = (DataView)territoriesDataSource.Select(DataSourceSelectArguments.Empty);
            territoryData2 = (DataView)territoriesDataSource.Select(DataSourceSelectArguments.Empty);
            if (!this.IsPostBack)
            {
                GiamDinhVienDAO gdvdao = new GiamDinhVienDAO();
                lblThongBao.Visible = true;
                HttpCookie ck = Request.Cookies["MaGDV"];
                if (ck == null)
                    Response.Redirect("~/Pages/Login.aspx");

                else
                {
                    int magdv = int.Parse(Request.Cookies["MaGDV"].Value);
                    bool ktcv = gdvdao.KiemTraChucVuQuanLy(magdv);
                    if (ktcv == false)
                    {
                        bool ktgd = gdvdao.KiemTraGiamDoc(magdv);
                        if (ktgd == false)
                        {
                            Response.Write("<script>alert('You can't access!');</script>");
                            //Response.Redirect(Request.UrlReferrer.ToString());// quay lại trang trước đó
                            Response.Redirect("~/Pages/Notification.aspx");
                        }

                    }
                    lblNgay.Text = DateTime.Today.ToString("yyyy-MM-dd");
                    loadAllWorkDay();
                }

            }
        }
Exemplo n.º 2
0
        protected void btnCheckILA_Click(object sender, EventArgs e)
        {
            HttpCookie ck = Request.Cookies["MaGDV"];
            if (ck == null)
            {
                Response.Write("<script> alert('Please login again!');</script>");

            }
            else
            {
                //string id = "";
                //if (Session["ThamChieu"] != null)
                //    id = Session["ThamChieu"].ToString();
                //else
                //    Response.Write("<script> alert('Come back home page and select Claim No again!');</script>");
                DataTable dt = new DataTable();
                int idgdv = int.Parse(Request.Cookies["MaGDV"].Value);
                string title = "ILA'signature checker";
                bool up = claimDao.UpdateCheckILA(mClaimID, idgdv);
                if (up == true)
                {

                    loadSIGNCheck(mClaimID);
                }
                else
                    Response.Write("<script> alert('Update preparer error!');</script>");
                int maGDV = int.Parse(Request.Cookies["MaGDV"].Value);
                GiamDinhVienDAO gdv = new GiamDinhVienDAO();
                string noidung = gdv.LayTenTheoMa(maGDV) + " edited " + title + " of " + mClaimID + ".";
                SaveLogTracking(maGDV, noidung, mClaimID);
            }
        }
Exemplo n.º 3
0
        protected void btnDangNhap_Click(object sender, EventArgs e)
        {
            string user = txtTenDangNhap.Text;
            string mk = txtMatKhau.Text;
            mk = Util.SAVVYUtil.GetMD5Hash(mk);
            GiamDinhVienDAO gdvdao = new GiamDinhVienDAO();
            bool ss = gdvdao.SoSanhPassword(mk, user);
            if (ss == true)
            {
                DataTable dtgdv = gdvdao.KiemTraDangNhap(user, mk);
                string tengdv;
                if (dtgdv.Rows.Count > 0)
                {
                    DataRow dr = dtgdv.Rows[0];
                    tengdv = dr[1].ToString();

                    int ID_GDV = int.Parse(dr[0].ToString());
                    SaveLogTracking(ID_GDV, tengdv + " signed in.");
                    Session["GDV"] = tengdv;
                    Session["MaGDV"] = ID_GDV;
                    Session["ChucVu"] = dr[2].ToString();
                    HttpCookie ck = new HttpCookie("MaGDV");
                    ck.Value = ID_GDV.ToString();
                    ck.Expires = DateTime.Now.AddDays(7);
                    Response.Cookies.Add(ck);
                    Response.Redirect("~/Pages/Home.aspx");

                }

            }
            else
            {
                lblThongBao.Text = "Sai tên đăng nhập hoặc mật khẩu.";
            }
        }
        protected void btnCapNhat_Click(object sender, EventArgs e)
        {
            try
            {
                int ma = int.Parse(txtMaS.Text);
                string ten = txtTenS.Text;
                string dt = txtDtS.Text;
                string email = txtEmailS.Text;
                string diachi = txtDiaChiS.Text;
                int chucvu = int.Parse(drChucVuS.SelectedValue.ToString());
                string un = txtUsernameS.Text;
                float rate = float.Parse(txtRateU.Text);
                string maten = txtMaTenS.Text;
                int kh = int.Parse(txtKichHoat.Text);
                int pub = int.Parse(txtPublic.Text);
                GiamDinhVienDAO gdvdao = new GiamDinhVienDAO();
                string tenfull = txtFullnameS.Text;
                gdvdao.SuaGDV(ma, ten, dt, email, diachi, chucvu, un, maten, kh, pub, rate, tenfull);
                HienThiDanhSach();
                sua.Visible = false;

            }
            catch (Exception ex)
            {
                Response.Write("<script> alert('Không để trống thông tin!');</script>");
            }
        }
Exemplo n.º 5
0
        protected void btnUpdateDaiDien_Click(object sender, EventArgs e)
        {
            try
            {
                //mClaimID = Session["ThamChieu"].ToString();
                int claimID = int.Parse(mClaimID);

                Button btn = (Button)sender;
                string key = btn.Attributes["key"];
                string titlekey = btn.Attributes["title"];
                TextBox txtValue = (TextBox)FindControl("txt" + key);
                string value = txtValue.Text;
                string title = titlekey;

                if (value.Contains("'"))
                {
                    value = value.Replace("'", "&#39;");
                }
                //claimDao.updateClaimField(mClaimID, key, value);
                ck.UpdateChuKy(mClaimID, key, value);
                //sm.sendNoiDungClaim("Report_Update", TenGDV(), value,key, claimID);
                //sm.UpdateClaim("Report_Update", TenGDV(), value, key, claimID);
                int maGDV = int.Parse(Request.Cookies["MaGDV"].Value);
                GiamDinhVienDAO gdv = new GiamDinhVienDAO();
                string noidung = gdv.LayTenTheoMa(maGDV) + " edited " + title + " of " + claimID + ".";
                SaveLogTracking(maGDV, noidung, mClaimID);
                Response.Redirect(Request.RawUrl + "#" + key);

            }
            catch (Exception ex)
            {
                Response.Write("<script>alert('Error', 'Error update data');</script>");
            }
        }
Exemplo n.º 6
0
        protected void btnDangNhap_Click(object sender, EventArgs e)
        {
            string user = txtTenDangNhap.Text;
            string mk = txtMatKhau.Text;
            mk = GetMD5Hash(mk);
            GiamDinhVienDAO gdvdao = new GiamDinhVienDAO();
            bool ss = gdvdao.SoSanhPassword(mk, user);
            if (ss == true)
            {
                DataTable dtgdv = gdvdao.KiemTraDangNhap(user, mk);
                string tengdv;
                if (dtgdv.Rows.Count > 0)
                {

                    DataRow dr = dtgdv.Rows[0];
                    tengdv = dr[1].ToString();
                    Session["GDV"] = tengdv;
                    Session["MaGDV"] = dr[0].ToString();
                    Session["ChucVu"] = dr[2].ToString();
                    Response.Redirect("~/mobile/Homem.aspx");

                }

            }
            else
            {
                lblThongBao.Text = "Sai tên đăng nhập hoặc mật khẩu.";
            }
        }
 void loadGDV()
 {
     GiamDinhVienDAO gdv = new GiamDinhVienDAO();
     drDSGDV.DataSource = gdv.DanhSachGiamDinhVien();
     drDSGDV.DataTextField = "TenGDV";
     drDSGDV.DataValueField = "ID_GDV";
     drDSGDV.DataBind();
 }
Exemplo n.º 8
0
 protected void btnKhoiPhucMatKhau_Click(object sender, EventArgs e)
 {
     GiamDinhVienDAO gd = new GiamDinhVienDAO();
     SendMailDAO sm = new SendMailDAO();
        int magdv = gd.KiemTraEmail(txtEmail.Text);
     if (magdv!=0)
     {
         string link = "<a href=http://p.savvyadjusters.com/Pages/DoiMatKhau.aspx?ID=" + magdv + ">" + "Click Here</a>";
         string send= sm.khoiPhucMatKhau("PlatForm_ChangePassWord",txtEmail.Text, link);
         if( send=="oke")
             Response.Write("<script>alert('Vui lòng kiểm tra email!');</script>");
     }
 }
Exemplo n.º 9
0
 protected void btnKhoiPhucMatKhau_Click(object sender, EventArgs e)
 {
     GiamDinhVienDAO gdv = new GiamDinhVienDAO();
     string pas1 = txtpass1.Text;
     string pas2 = txtpass2.Text;
     int id= int.Parse(lblID.Text);
     if (pas1 == pas2)
     {
         string pasmd5 = GetMD5Hash(pas1);
         bool doi = gdv.DoiMatKhau(id, pasmd5);
         if (doi == true)
             Response.Redirect("~/Pages/Login.aspx");
     }
     else
         Response.Write("<script>alert('Mật khẩu nhập lại không đúng!');</script>");
 }
Exemplo n.º 10
0
        void load_DropList()
        {
            if (!this.IsPostBack)
            {
                // Giam dinh vien
                GiamDinhVienDAO gdv = new GiamDinhVienDAO();
                DataTable dt = gdv.DanhSachGiamDinhVien();
                drGDV1.DataSource = dt;
                drGDV1.DataValueField = "ID_GDV";
                drGDV1.DataTextField = "TenGDV";
                drGDV1.DataBind();

                drGDV2.DataSource = dt;
                drGDV2.DataValueField = "ID_GDV";
                drGDV2.DataTextField = "TenGDV";
                drGDV2.DataBind();

                drGDV3.DataSource = dt;
                drGDV3.DataValueField = "ID_GDV";
                drGDV3.DataTextField = "TenGDV";
                drGDV3.DataBind();

                // nha bao hiem
                NhaBHDAO nbhdao = new NhaBHDAO();
                drNBH.DataSource = nbhdao.DSCongTyTong();
                drNBH.DataValueField = "ID_NhaBH";
                drNBH.DataTextField = "TenNhaBH";
                drNBH.DataBind();

                // khach hang
                KhachHangDAO khdao = new KhachHangDAO();
                drKH.DataSource = khdao.DSNguoiDuocBaoHiem();
                drKH.DataValueField = "ID_KhachHang";
                drKH.DataTextField = "TenKhachHang";
                drKH.DataBind();

            }
        }
Exemplo n.º 11
0
        protected void btnThem_Click(object sender, EventArgs e)
        {
            if (this.IsPostBack)
            {
                TimeSheetDTO tsdto = new TimeSheetDTO();
                GiamDinhVienDAO gdv = new GiamDinhVienDAO();
                int maGDV = int.Parse(Request.Cookies["MaGDV"].Value);
                tsdto.MaGDV = maGDV;
                string tengdv = lblGiamDinhVien.Text;
                string maclaim = txtThamChieu.Text;
                bool kt = cl.KiemTraThamChieu(maclaim);
                float h = 0;
                if (txtSoGio.Text != "" && float.TryParse(txtSoGio.Text, out h))
                {
                    string diengiai = txtDienGiaiChiTiet.Text; ;
                    // string diengiaidetail = txtDienGiaiChiTiet.Text;
                    string loaidiengiai = "";
                    if (diengiai != "")
                        tsdto.DienGiai = diengiai;
                    else
                        tsdto.DienGiai = "";
                    string extr = txtEtraFee.Text;
                    if (extr != "")
                        tsdto.ExtraFee = extr;
                    else
                        tsdto.ExtraFee = "";
                    if (kt == true)
                    {
                        tsdto.ThamChieu = maclaim;
                        tsdto.Ngay = txtNgay.Text;
                        tsdto.IdCongTacTimeSheet = drDienGiai.SelectedItem.Value.ToString();
                        loaidiengiai = drDienGiai.SelectedItem.ToString();
                        if (int.Parse(drDienGiai.SelectedValue) !=0)
                        {

                            tsdto.ThoiLuongPhatSinh = float.Parse(txtSoGio.Text);
                            tsdto.GioThuc = DateTime.Now;

                            bool them = tsdao.ThemTimeSheet(tsdto);
                            if (them == true)
                            {
                                float time = tsdao.TongThoiLuongPhatSinhTheoCliam(maclaim);
                                wr.CapNhatGioTichLuy(maclaim, time);
                                string noidung = gdv.LayTenTheoMa(maGDV) + " created timesheet of case " + txtThamChieu.Text + " .";
                                SaveLogTracking(maGDV, noidung, txtThamChieu.Text);
                                #region KiemTra_GuiMail
                                float gio = tsdao.TongThoiLuongPhatSinhTheoCliam(maclaim);
                                bool updw = wr.CapNhatGioTichLuy(maclaim, gio);
                                #region BodysendLA
                                string bodyGDV = "Xin chào   " + tengdv;
                                bodyGDV += "<br/> Bạn vừa cập nhật TimeSheet mới. <br/> Thông tin TimeSheet:<br/>";
                                bodyGDV += "<table  width='100%' align='center' style='border-bottom-color:#CCC; border-bottom-style:solid; border-bottom-width:1px; " +
                                             " border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                                             " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;" +
                                            " border-right-color:#CCC; border-right-style:solid; border-right-width:1px;'>";
                                bodyGDV += "<tr style='background-color: #040; color:#FFF; font-weight:bold;'>";

                                //bodyGDV += "<th width='10%'>Giám định viên</th>";
                                bodyGDV += "<th width='10%'>Tham chiếu</th>";
                                bodyGDV += "<th width='10%'>Ngày</th>";
                                bodyGDV += "<th width='25%'>Diễn giải</th>";
                                bodyGDV += "<th width='25%'>Chi tiết</th>";
                                bodyGDV += "<th width='10%'>Số giờ</th>";

                                bodyGDV += "</tr>";
                                bodyGDV += "<tr style='text-align:center'>";

                                bodyGDV += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                                    " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tsdto.ThamChieu + "</td>";
                                bodyGDV += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                                    " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tsdto.Ngay + "</td>";
                                bodyGDV += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                                    " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + loaidiengiai + "</td>";
                                bodyGDV += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                                  " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + diengiai + "</td>";
                                bodyGDV += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                                    " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tsdto.ThoiLuongPhatSinh + "</td>";

                                bodyGDV += "</tr>";
                                bodyGDV += "</table>";
                                #endregion
                                #region BodyMailGiamDoc
                                //timesheet gui giam doc
                                string bodyGiamDoc = "Thông báo! ";
                                bodyGiamDoc += "<br/>" + tengdv + " vừa cập nhật TimeSheet mới. <br/> Thông tin Timesheet :<br/>";
                                bodyGiamDoc += "<table  width='100%' align='center' style='border-bottom-color:#CCC; border-bottom-style:solid; border-bottom-width:1px; " +
                                             " border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                                             " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;" +
                                            " border-right-color:#CCC; border-right-style:solid; border-right-width:1px;'>";
                                bodyGiamDoc += "<tr style='background-color: #040; color:#FFF; font-weight:bold;'>";

                                bodyGiamDoc += "<th width='20%'>LA</th>";
                                bodyGiamDoc += "<th width='10%'>Reference</th>";
                                bodyGiamDoc += "<th width='10%'>Date Update</th>";
                                bodyGiamDoc += "<th width='10%'>Date</th>";
                                bodyGiamDoc += "<th width='30%'>Description</th>";
                                bodyGiamDoc += "<th width='10%'>Time-Spent</th>";

                                bodyGiamDoc += "</tr>";

                                bodyGiamDoc += "<tr style='text-align:center'>";
                                bodyGiamDoc += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                                " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tengdv + "</td>";
                                bodyGiamDoc += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                                   " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tsdto.ThamChieu + "</td>";
                                bodyGiamDoc += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                                   " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tsdto.GioThuc + "</td>";
                                bodyGiamDoc += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                                    " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tsdto.Ngay + "</td>";
                                bodyGiamDoc += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                                    " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + diengiai + "</td>";
                                bodyGiamDoc += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                                    " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tsdto.ThoiLuongPhatSinh + "</td>";
                                bodyGiamDoc += "</tr>";
                                bodyGiamDoc += "</table>";
                                #endregion
                                string sTo = "";
                                int idgdv = int.Parse(Request.Cookies["MaGDV"].Value);
                                GiamDinhVienDAO gdvdao = new GiamDinhVienDAO();
                                DataTable dt = new DataTable();

                                dt = gdvdao.GiamDinhVienTheoMa(idgdv);
                                if (dt.Rows.Count > 0)
                                {
                                    DataRow dr = dt.Rows[0];
                                    sTo = dr[3].ToString();
                                }
                                string ktmgdv = "", ktmgiamdoc = "";
                                int month = int.Parse(DateTime.Now.Month.ToString());
                                //Send_Email("*****@*****.**", sTo, "Thông báo timesheet mới", bodyGiamDoc, "[email protected],[email protected]");
                                //sm.KiemTraMailChinhCC(sTo, bodyGiamDoc, "Timesheet Notification", "Timesheet", "*****@*****.**");
                                sm.KiemTraMailChinhCC(sTo, bodyGDV, "Timesheet Notification", "Timesheet", "*****@*****.**");
                                #endregion
                                ClearInputs(Page.Controls);
                                //Response.Write("<script> window.parent.closeDialog(); </script>");
                                //Response.Write("<script> window.parent.location.reload();</script>");
                            }
                        }
                        else
                            Response.Write("<script>alert('Chưa chọn loại công tác!');</script>");
                    }
                }
                else
                    Response.Write("<script>alert('Nhập sai định dạng giờ lẻ!');</script>");
            }
        }
Exemplo n.º 12
0
        protected void btnUpdateKhachHang_Click(object sender, EventArgs e)
        {
            try
            {
                //mClaimID = Session["ThamChieu"].ToString();

                int maKH = (int)kh.LayMaKHClaim(mClaimID);
                Button btn = (Button)sender;
                string key = btn.Attributes["key"];

                TextBox txtValue = (TextBox)FindControl("txt" + key);
                string value = txtValue.Text;
                string title = "";

                if (value.Contains("'"))
                {
                    value = value.Replace("'", "&#39;");
                }
                kh.UpdateKhachHang(maKH, key, value);
                int maGDV = int.Parse(Request.Cookies["MaGDV"].Value);
                GiamDinhVienDAO gdv = new GiamDinhVienDAO();
                string noidung = gdv.LayTenTheoMa(maGDV) + " edited " + title + " of " + mClaimID + ".";
                SaveLogTracking(maGDV, noidung, mClaimID);
                Response.Redirect(Request.RawUrl + "#" + key);
            }
            catch (Exception ex)
            {
                Response.Write("<script>alert('Error', 'Error update data');</script>");
            }
        }
 protected void gvDSGDV_SelectedIndexChanged(object sender, EventArgs e)
 {
     GiamDinhVienDAO gdvdao = new GiamDinhVienDAO();
     GridViewRow row = gvDSGDV.SelectedRow;
     int mgdv = 0;
     if (row != null)
     {
         string temp = row.Cells[0].Text;
         mgdv = int.Parse(temp.ToString());
     }
     if (mgdv != null)
     {
         DataTable dt = new DataTable();
         dt = gdvdao.GiamDinhVienTheoMa(mgdv);
         if (dt.Rows.Count > 0)
         {
             DataRow dr = dt.Rows[0];
             txtMaS.Text = dr[0].ToString();
             txtTenS.Text = dr[1].ToString();
             txtDtS.Text = dr[2].ToString();
             txtEmailS.Text = dr[3].ToString();
             txtDiaChiS.Text = dr[5].ToString();
             drChucVuS.SelectedValue = dr[6].ToString();
             txtUsernameS.Text = dr[7].ToString();
             txtMaTenS.Text = dr[9].ToString();
             txtKichHoat.Text = dr[10].ToString();
             txtPublic.Text = dr[11].ToString();
             txtFullnameS.Text = dr["FullName"].ToString();
             txtRateU.Text=dr["Rate"].ToString();
         }
         sua.Visible = true;
     }
 }
 protected void btnThem_Click(object sender, EventArgs e)
 {
     try
     {
         string ten = txtTen.Text;
         string dt = txtDienThoai.Text;
         string email = txtEmail.Text;
         string ngaysinh = txtNgay.Text;
         string diachi = txtDiaChi.Text;
         int chucvu = int.Parse(drChucVu.SelectedValue.ToString());
         string maten = txtMaTenN.Text;
         float rate = float.Parse(txtRate.Text);
         string user = txtuser.Text;
         string pass = GetMD5Hash(txtpass.Text);
         string fullname = txtFullName.Text;
         GiamDinhVienDAO gdvdao = new GiamDinhVienDAO();
         gdvdao.ThemGiamDinhVien(ten, dt, email, ngaysinh, diachi, chucvu, user, pass, maten, rate, fullname);
         HienThiDanhSach();
         danhsach.Visible = true;
         them.Visible = false;
     }
     catch (Exception ex)
     {
         Response.Write("<script> alert('Không để trống thông tin!');</script>");
     }
 }
Exemplo n.º 15
0
        void load_DropDownlist()
        {
            if (!this.IsPostBack)
            {
                GiamDinhVienDAO gdv = new GiamDinhVienDAO();
                DataTable dt = gdv.DanhSachGiamDinhVien();
                drGDV1.DataSource = dt;
                drGDV1.DataValueField = "ID_GDV";
                drGDV1.DataTextField = "TenGDV";
                drGDV1.DataBind();

                drGDV2.DataSource = dt;
                drGDV2.DataValueField = "ID_GDV";
                drGDV2.DataTextField = "TenGDV";
                drGDV2.DataBind();

                drGDV3.DataSource = dt;
                drGDV3.DataValueField = "ID_GDV";
                drGDV3.DataTextField = "TenGDV";
                drGDV3.DataBind();

                drGDV4.DataSource = dt;
                drGDV4.DataValueField = "ID_GDV";
                drGDV4.DataTextField = "TenGDV";
                drGDV4.DataBind();
                //các công ty tổng nha bao hiem
                NhaBHDAO nbhdao = new NhaBHDAO();
                drNBH.DataSource = nbhdao.DSCongTyTong();
                drNBH.DataValueField = "ID_NhaBH";
                drNBH.DataTextField = "TenNhaBH";
                drNBH.DataBind();
            }
        }
Exemplo n.º 16
0
        protected void btnThem_Click(object sender, EventArgs e)
        {
            tsdto = new DiaryDTO();
            string maclaim = txtThamChieu.Text;
            bool kt = cl.KiemTraThamChieu(maclaim);
            int maGDV = int.Parse(Session["MaGDV"].ToString());
            string tengdv = Session["GDV"].ToString();
            if (maGDV != null)
            {
                if (kt == true)
                {
                    tsdto.MaClaim = maclaim;
                    tsdto.MaGDV = maGDV;
                    tsdto.NgayThuc = DateTime.Now;
                    tsdto.Ngay = DateTime.Parse(txtNgay.Text);
                    tsdto.DienGiai = txtDienGiai.Text.Trim();
                    tsdto.SoGio = float.Parse(txtSoGio.Text);
                    tsdto.NgayGioBatDau = DateTime.Parse(txtNgayBatDau.Text);
                    tsdto.NgayGioKetThuc = DateTime.Parse(txtNgayKetThuc.Text);
                    tsdto.KetQua = txtKetQuaGhiNhan.Text.Trim();
                    bool them = drdao.DiaryMoi(tsdto);
                    if (them == true)
                    {
                        #region KiemTra_GuiMail
                        float gio = drdao.TongThoiLuongPhatSinh(maclaim);
                        bool updw = wr.CapNhatGioTichLuy(maclaim, gio);
                        #region BodysendLA
                        string bodyGDV = "Xin chào   " + tengdv;
                        bodyGDV += "<br/> Bạn vừa cập nhật Diary mới. <br/> Thông tin Diary:<br/>";
                        bodyGDV += "<table  width='100%' align='center' style='border-bottom-color:#CCC; border-bottom-style:solid; border-bottom-width:1px; " +
                                     " border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                                     " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;" +
                                    " border-right-color:#CCC; border-right-style:solid; border-right-width:1px;'>";
                        bodyGDV += "<tr style='background-color: #040; color:#FFF; font-weight:bold;'>";

                        //bodyGDV += "<th width='10%'>Giám định viên</th>";
                        bodyGDV += "<th width='10%'>Tham chiếu</th>";
                        bodyGDV += "<th width='10%'>Ngày</th>";
                        bodyGDV += "<th width='30%'>Diễn giải</th>";
                        bodyGDV += "<th width='10%'>Số giờ</th>";
                        bodyGDV += "<th width='10%'>Start</th>";
                        bodyGDV += "<th width='10%'>Ended</th>";
                        bodyGDV += "<th width='30%'>Kết quả</th>";
                        bodyGDV += "</tr>";

                        bodyGDV += "<tr style='text-align:center'>";
                        //bodyGDV += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                        //" border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tengdv + "</td>";
                        bodyGDV += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                            " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tsdto.MaClaim + "</td>";
                        bodyGDV += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                            " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tsdto.Ngay + "</td>";
                        bodyGDV += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                            " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tsdto.DienGiai + "</td>";
                        bodyGDV += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                            " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tsdto.SoGio + "</td>";
                        bodyGDV += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                            " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tsdto.NgayGioBatDau + "</td>";
                        bodyGDV += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                          " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tsdto.NgayGioKetThuc + "</td>";
                        bodyGDV += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                          " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tsdto.KetQua + "</td>";
                        bodyGDV += "</tr>";
                        bodyGDV += "</table>";
                        #endregion
                        #region BodyMailGiamDoc
                        //timesheet gui giam doc
                        string bodyGiamDoc = "Thông báo! ";
                        bodyGiamDoc += "<br/>" + tengdv + " vừa cập nhật Dairy mới. <br/> Thông tin Diary:<br/>";
                        bodyGiamDoc += "<table  width='100%' align='center' style='border-bottom-color:#CCC; border-bottom-style:solid; border-bottom-width:1px; " +
                                     " border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                                     " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;" +
                                    " border-right-color:#CCC; border-right-style:solid; border-right-width:1px;'>";
                        bodyGiamDoc += "<tr style='background-color: #040; color:#FFF; font-weight:bold;'>";

                        bodyGiamDoc += "<th width='20%'>GĐV</th>";
                        bodyGiamDoc += "<th width='10%'>Tham chiếu</th>";
                        bodyGiamDoc += "<th width='10%'>Ngày Thực</th>";
                        bodyGiamDoc += "<th width='10%'>Ngày</th>";
                        bodyGiamDoc += "<th width='30%'>Diễn giải</th>";
                        bodyGiamDoc += "<th width='10%'>Số giờ</th>";
                        bodyGiamDoc += "<th width='10%'>Start</th>";
                        bodyGiamDoc += "<th width='10%'>Ended</th>";
                        bodyGiamDoc += "<th width='30%'>Kết quả</th>";
                        bodyGiamDoc += "</tr>";

                        bodyGiamDoc += "<tr style='text-align:center'>";
                        bodyGiamDoc += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                        " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tengdv + "</td>";
                        bodyGiamDoc += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                           " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tsdto.MaClaim + "</td>";
                        bodyGiamDoc += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                           " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tsdto.NgayThuc + "</td>";
                        bodyGiamDoc += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                            " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tsdto.Ngay + "</td>";
                        bodyGiamDoc += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                            " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tsdto.DienGiai + "</td>";
                        bodyGiamDoc += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                            " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tsdto.SoGio + "</td>";
                        bodyGiamDoc += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                            " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tsdto.NgayGioBatDau + "</td>";
                        bodyGiamDoc += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                          " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tsdto.NgayGioKetThuc + "</td>";
                        bodyGiamDoc += "<td style ='border-top-color:#CCC; border-top-style:solid; border-top-width:1px;" +
                          " border-left-color:#CCC; border-left-style:solid; border-left-width:1px;'>" + tsdto.KetQua + "</td>";
                        bodyGiamDoc += "</tr>";
                        bodyGiamDoc += "</table>";
                        #endregion
                        string sTo = "";
                        int idgdv = int.Parse(Session["MaGDV"].ToString());
                        GiamDinhVienDAO gdvdao = new GiamDinhVienDAO();
                        DataTable dt = new DataTable();

                        dt = gdvdao.GiamDinhVienTheoMa(idgdv);
                        if (dt.Rows.Count > 0)
                        {
                            DataRow dr = dt.Rows[0];
                            sTo = dr[3].ToString();
                        }
                        string ktmgdv = "", ktmgiamdoc = "";
                        int month = int.Parse(DateTime.Now.Month.ToString());
                        //ktmgiamdoc = smdao.KiemTraMailChinh("Timesheet","*****@*****.**", bodyGiamDoc, "Thông báo Diary của tháng " + month);
                        ktmgdv = smdao.KiemTraMailChinh("New_Claim",sTo, bodyGDV, "Thông báo cập nhật Diary");
                        if (updw == true && ktmgdv != "")
                        {
                            //Response.Redirect("~/Pages/DiaRy.aspx");
                            Response.Write("<script>alert('Updated!');</script>");
                            Response.Redirect(Request.Url.PathAndQuery, true);
                        }
                        #endregion
                        Response.Write("<script>alert('Đã thêm!');</script>");
                    }
                    else
                    {
                        lblThongBaoThem.Visible = true;
                        lblThongBaoThem.Text = "Have something wrong here!";
                    }
                }
                else
                {
                    Response.Write("<script>alert('Mã Claim không hợp lệ!');</script>");
                    lbllThongBao.Visible = true;
                }

            }
            else
                Response.Redirect("~/Pages/Longin.aspx");
        }
 protected void gvDSGDV_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     GiamDinhVienDAO gdvdao = new GiamDinhVienDAO();
     int autoid = int.Parse(gvDSGDV.DataKeys[e.RowIndex].Value.ToString());
     bool kq= gdvdao.XoaGDV(autoid);
     if(kq==true)
         HienThiDanhSach();
 }
Exemplo n.º 18
0
        protected void btnUpdateGDVCheck_Click(object sender, EventArgs e)
        {
            try
            {
                //mClaimID = Session["ThamChieu"].ToString();
                //int claimID = int.Parse(mClaimID);

                Button btn = (Button)sender;
                string key = btn.Attributes["key"];

                DropDownList drValue = (DropDownList)FindControl("dr" + key);
                int id = int.Parse(drValue.SelectedValue.ToString());
                string title = "";

                bool up = claimDao.UpdateCheckILA(mClaimID, id);
                if (up == true)
                {
                    loadSIGNCheck(mClaimID);

                }
                else
                    Response.Write("<script> alert('Update preparer error!');</script>");
                int maGDV = int.Parse(Request.Cookies["MaGDV"].Value);
                GiamDinhVienDAO gdv = new GiamDinhVienDAO();
                string noidung = gdv.LayTenTheoMa(maGDV) + " edited " + title + " of " + mClaimID + ".";
                SaveLogTracking(maGDV, noidung, mClaimID);

                Response.Redirect(Request.RawUrl + "#" + key);

            }
            catch (Exception ex)
            {
                Response.Write("<script>alert('Error', 'Error update data');</script>");
            }
        }
        void load_DropList()
        {
            if (!this.IsPostBack)
            {
                // Giam dinh vien
                GiamDinhVienDAO gdv = new GiamDinhVienDAO();
                DataTable dt = gdv.DanhSachGiamDinhVien();
                drGDV1.DataSource = dt;
                drGDV1.DataValueField = "ID_GDV";
                drGDV1.DataTextField = "TenGDV";
                drGDV1.DataBind();

                drGDV2.DataSource = dt;
                drGDV2.DataValueField = "ID_GDV";
                drGDV2.DataTextField = "TenGDV";
                drGDV2.DataBind();

                drGDV3.DataSource = dt;
                drGDV3.DataValueField = "ID_GDV";
                drGDV3.DataTextField = "TenGDV";
                drGDV3.DataBind();

                // nha bao hiem
                NhaBHDAO nbhdao = new NhaBHDAO();
                drNBH.DataSource = nbhdao.DSCongTyTong();
                drNBH.DataValueField = "ID_NhaBH";
                drNBH.DataTextField = "TenNhaBH";
                drNBH.DataBind();

                // khach hang
                KhachHangDAO khdao = new KhachHangDAO();
                drKH.DataSource = khdao.DSNguoiDuocBaoHiem();
                drKH.DataValueField = "ID_KhachHang";
                drKH.DataTextField = "TenKhachHang";
                drKH.DataBind();

                // loai hinh ton that
                LoaiHinhTonThatDAO lhTTdao = new LoaiHinhTonThatDAO();
                drLoaiHinhTonThat.DataSource = lhTTdao.DSLoaiHinhTT();
                drLoaiHinhTonThat.DataValueField = "ID_LoaiHinhTonThat";
                drLoaiHinhTonThat.DataTextField = "LoaiHinhTonThat";
                drLoaiHinhTonThat.DataBind();
                // giai doan thuc hien
                GiaiDoanDAO gddao = new GiaiDoanDAO();

            }
        }