Пример #1
0
    /*
     * Reset password
     */
    protected void btnResetPassword_Click(object sender, DirectEventArgs e)
    {
        try
        {
            string userName = txtResetUsername.Text;
            string email    = txtResetEmail.Text;
            string maDonVi  = string.Empty;//Mã đơn vị của người khôi phục mật khẩu
            if (new UserController().CheckUserResetPassword(userName, email, ref maDonVi))
            {
                string newPassword = Util.GetInstance().GetRandomString(7);

                HeThongController htController        = new HeThongController();
                string            systemGmail         = htController.GetValueByName(SystemConfigParameter.EMAIL, maDonVi);
                string            systemGmailPassword = htController.GetValueByName(SystemConfigParameter.PASSWORD_EMAIL, maDonVi);

                if (string.IsNullOrEmpty(systemGmail) || string.IsNullOrEmpty(systemGmailPassword))
                {
                    X.Msg.Alert(GlobalResourceManager.GetInstance().GetLanguageValue("warning"), "Chưa có thông tin Email của hệ thống, bạn hãy liên hệ với người quản lý phần mềm để được hỗ trợ !").Show();
                    return;
                }

                string mailName = GlobalResourceManager.GetInstance().GetLanguageValue("email_title_forgot_password");
                string subject  = GlobalResourceManager.GetInstance().GetLanguageValue("email_title_forgot_password");
                string content  = Util.GetInstance().ReadFile(Server.MapPath("Modules/MailTemplate/ForgotPassword." + GlobalResourceManager.GetInstance().GetCurrentCulture() + ".html"));
                SoftCore.User.UserInfo uinfo = UsersController.GetInstance().GetUser(userName);

                if (uinfo.DisplayName == null)
                {
                    content = string.Format(content, userName, userName, newPassword);
                }
                else
                {
                    content = string.Format(content, uinfo.DisplayName, userName, newPassword);
                }
                if (SoftCore.Utilities.Email.SendEmail(systemGmail, systemGmailPassword, mailName, email, subject, content))
                {
                    uinfo.ChangePassword(newPassword);
                    X.Msg.Alert("Đổi mật khẩu thành công", GlobalResourceManager.GetInstance().GetLanguageValue("email_notice_forgot_password")).Show();
                    wdResetPassword.Hide();
                }
                else
                {
                    X.Msg.Alert(GlobalResourceManager.GetInstance().GetLanguageValue("warning"), "Xin lỗi ,Khôi phục mật khẩu không thành công !").Show();
                }
            }
            else
            {
                X.Msg.Alert(GlobalResourceManager.GetInstance().GetLanguageValue("warning"), GlobalResourceManager.GetInstance().GetLanguageValue("email_error_forgot_password")).Show();
            }
            txtResetUsername.Clear();
            txtResetEmail.Clear();
        }
        catch (Exception ex)
        {
            X.Msg.Alert(GlobalResourceManager.GetInstance().GetLanguageValue("warning"), ex.Message).Show();
        }
    }
Пример #2
0
    /// <summary>
    /// Lấy tên trưởng phòng hành chính nhân sự
    /// @daibx
    /// </summary>
    /// <param name="maDonVi"></param>
    /// <param name="displayName">Tên người ký nhập ở trên form filter</param>
    /// <returns></returns>
    public string GetHeadOfHRroom(string maDonVi, string displayName)
    {
        string name = new HeThongController().GetValueByName(SystemConfigParameter.chuky4, maDonVi);

        if (string.IsNullOrEmpty(name))
        {
            name = displayName;
        }
        return(name);
    }
Пример #3
0
    /// <summary>
    /// Lấy tên công ty
    /// @daibx
    /// </summary>
    /// <param name="maDonVi"></param>
    /// <returns></returns>
    public string GetCompanyName(string maDonVi)
    {
        string companyName = new HeThongController().GetValueByName(SystemConfigParameter.COMPANY_NAME, maDonVi);

        if (string.IsNullOrEmpty(companyName))
        {
            return("CHƯA CÓ THÔNG TIN CÔNG TY");
        }
        return(companyName);
    }
Пример #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!X.IsAjaxRequest)
     {
         ltrApplicationName.Text = GlobalResourceManager.GetInstance().GetLanguageValue("software_online_system");
         //load combobox để thực hiện cho việc add module - super user
         if (CurrentUser.IsSuperUser)
         {
             List <ModuleInfo> ModulesList = ModuleController.GetInstance().GetAllModules(Server.MapPath("Modules"));
             foreach (ModuleInfo item in ModulesList)
             {
                 cbModule.Items.Add(new Ext.Net.ListItem(item.ModuleName));
             }
             LoadRole(this.TreePanel1); //Load role cho việc thiết lập menu, chỉ load khi có quyền
             LoadTreeIncludeCheckBox(); //cái này chỉ áp dụng cho super admin để thêm module
             //hiện phân quyền
             btnSystem.Visible = true;
             btnSystem_PermissionList.Visible = true;
         }
         try
         {
             string menuType = new HeThongController().GetValueByName("MENU_TYPE", Session["MaDonVi"].ToString());
             if (menuType.Equals("Horizontal"))
             {
                 LoadTopMenu(); //load menu ngang
             }
             else
             {
                 if (menuType.Equals("VerticalCollapsed"))
                 {
                     LoadLeftMenu(true); //Load menu dọc thu nhỏ
                 }
                 else
                 {
                     LoadLeftMenu(false); //Load menu dọc
                 }
             }
         }
         catch (Exception ex)
         {
             Dialog.ShowError("Default.aspx = " + ex.Message);
         }
         ModuleFileRefresh(null, null);
         if (!string.IsNullOrEmpty(CurrentUser.DisplayName))
         {
             btnDisplayName.Text = CurrentUser.DisplayName;
         }
         else
         {
             btnDisplayName.Text = CurrentUser.FirstName + " " + CurrentUser.LastName;
         }
         SetVisibleByRole();
     }
     LoadRole(this.TreePanelRole);
 }
Пример #5
0
    /// <summary>
    /// Lấy tên người tạo báo cáo
    /// @Lê Anh
    /// </summary>
    /// <param name="name"></param>
    /// <returns></returns>
    public string GetCreatedReporterName(string maDonVi, string reporter)
    {
        HeThongController htController     = new HeThongController();
        string            usingCurrentUser = htController.GetValueByName(SystemConfigParameter.SuDungTenDangNhap, maDonVi);

        if (usingCurrentUser == "True")
        {
            return(reporter);
        }
        else
        {
            return(new HeThongController().GetValueByName(SystemConfigParameter.chuky1, maDonVi));
        }
    }
Пример #6
0
    protected void btnUpdateConfig_Click(object sender, DirectEventArgs e)
    {
        try
        {
            //if (txtSystemMail.Text.Contains("@gmail.com") == false && !string.IsNullOrEmpty(txtSystemMail.Text))
            //{
            //    X.MessageBox.Alert("Thông báo", "Hệ thống chỉ chấp nhận định dạng gmail").Show();
            //    return;
            //}
            string            maDonVi      = Session["MaDonVi"].ToString();
            HeThongController htController = new HeThongController();
            // tab thông tin chung
            htController.CreateOrSave(SystemConfigParameter.EMAIL, txtSystemMail.Text.Trim(), CurrentUser.ID, maDonVi);
            htController.CreateOrSave(SystemConfigParameter.PASSWORD_EMAIL, txtPassword.Text.Trim(), CurrentUser.ID, maDonVi);
            htController.CreateOrSave(SystemConfigParameter.MENU_TYPE, cbMenuType.SelectedItem.Value, CurrentUser.ID, maDonVi);
            htController.CreateOrSave(SystemConfigParameter.COMPANY_NAME, txtCompanyName.Text.Trim(), CurrentUser.ID, maDonVi);
            htController.CreateOrSave(SystemConfigParameter.CITY, txtCity.Text.Trim(), CurrentUser.ID, maDonVi);
            // htController.CreateOrSave(SystemConfigParameter.LUONG_CB, txtLuongCB.Text.Trim(), CurrentUser.ID, maDonVi);
            htController.CreateOrSave(SystemConfigParameter.PREFIX, txtTienTo.Text.Trim(), CurrentUser.ID, maDonVi);
            htController.CreateOrSave(SystemConfigParameter.NUMBER_OF_CHARACTER, txtSoLuong.Text.Trim(), CurrentUser.ID, maDonVi);
            htController.CreateOrSave(SystemConfigParameter.COMPANY_ADDRESS, txt_DiaChi.Text.Trim(), CurrentUser.ID, maDonVi);
            htController.CreateOrSave(SystemConfigParameter.COMPANY_MASOTHUE, txt_MaSoThue.Text.Trim(), CurrentUser.ID, maDonVi);
            htController.CreateOrSave(SystemConfigParameter.COMPANY_DIENTHOAI, txt_DienThoai.Text.Trim(), CurrentUser.ID, maDonVi);
            htController.CreateOrSave(SystemConfigParameter.COMPANY_FAX, txt_Fax.Text.Trim(), CurrentUser.ID, maDonVi);
            htController.CreateOrSave(SystemConfigParameter.COMPANY_EMAIL, txt_Email.Text.Trim(), CurrentUser.ID, maDonVi);
            //   htController.CreateOrSave(SystemConfigParameter.BAO_HET_HAN_HOP_DONG, txtNotification.Text.Trim(), CurrentUser.ID, maDonVi);

            // tab sinh mã, số quyết định
            htController.CreateOrSave(SystemConfigParameter.SUFFIX_SOHOPDONG, txtSoHopDong.Text.Trim(), CurrentUser.ID, maDonVi);
            htController.CreateOrSave(SystemConfigParameter.SUFFIX_SOQDLUONG, txtSoQuyetDinhLuong.Text.Trim(), CurrentUser.ID, maDonVi);
            htController.CreateOrSave(SystemConfigParameter.SUFFIX_SOQDKHENTHUONG, txtSoQDKhenThuong.Text.Trim(), CurrentUser.ID, maDonVi);
            htController.CreateOrSave(SystemConfigParameter.SUFFIX_SOQDKYLUAT, txtSoQDKyLuat.Text.Trim(), CurrentUser.ID, maDonVi);
            htController.CreateOrSave(SystemConfigParameter.SUFFIX_SOQDCONGTAC, txtSoQDCongTac.Text.Trim(), CurrentUser.ID, maDonVi);
            htController.CreateOrSave(SystemConfigParameter.SUFFIX_SOQDDIEUCHUYEN, txtSoQĐieuChuyen.Text.Trim(), CurrentUser.ID, maDonVi);

            // tab cấu hình chữ ký báo cáo
            htController.CreateOrSave(SystemConfigParameter.SuDungTenDangNhap, chknguoidangnhap.Checked.ToString(), CurrentUser.ID, maDonVi);
            htController.CreateOrSave(SystemConfigParameter.chuky1, txtnguoiky1.Text.Trim(), CurrentUser.ID, maDonVi);
            htController.CreateOrSave(SystemConfigParameter.chuky2, txtnguoiky2.Text.Trim(), CurrentUser.ID, maDonVi);
            htController.CreateOrSave(SystemConfigParameter.chuky3, txtnguoiky3.Text.Trim(), CurrentUser.ID, maDonVi);
            htController.CreateOrSave(SystemConfigParameter.chuky4, txtnguoiky4.Text.Trim(), CurrentUser.ID, maDonVi);

            wdWindow.Hide();
        }
        catch (Exception ex)
        {
            X.MessageBox.Alert("Thông báo", ex.Message).Show();
        }
    }
Пример #7
0
    public rp_ToKhaiThue()
    {
        InitializeComponent();
        //
        // TODO: Add constructor logic here
        //
        HeThongController ht          = new HeThongController();
        string            companyname = "COMPANY_NAME";
        string            city        = "CITY";

        xrl_TenCongTy.Text   = ht.GetValueByCompanyName(companyname).ToString().ToUpper();
        xrl_TenThanhPho.Text = "THÀNH PHỐ " + ht.GetValueByCity(city).ToString().ToUpper();
        xrl_NgayBaoCao.Text  = "Ngày báo cáo:" + string.Format("{0:dd/MM/yyyy}", DateTime.Now);
        xrtngayketxuat.Text  = " Hà Nội, ngày " + DateTime.Now.Day + " tháng " + DateTime.Now.Month + " năm " + DateTime.Now.Year;
    }
Пример #8
0
    private string GetReporter(string maDonVi)
    {
        string name       = CurrentUser.DisplayName;
        string a          = new HeThongController().GetValueByName(SystemConfigParameter.SuDungTenDangNhap, maDonVi);
        bool   isDangNhap = false;

        if (!string.IsNullOrEmpty(a))
        {
            isDangNhap = bool.Parse(a);
        }
        if (isDangNhap == false)
        {
            name = new HeThongController().GetValueByName(SystemConfigParameter.chuky1, maDonVi);
        }
        return(name);
    }
    public rp_BaoCaoDanhSachCanBoHuongChinhSach()
    {
        InitializeComponent();
        //
        // TODO: Add constructor logic here
        //
        HeThongController ht          = new HeThongController();
        string            companyname = "COMPANY_NAME";

        if (!string.IsNullOrEmpty(ht.GetValueByCompanyName(companyname).ToString()))
        {
            xrl_TenCongTy.Text = ht.GetValueByCompanyName(companyname).ToString().ToUpper();
        }
        xrl_NgayBaoCao.Text = "Ngày báo cáo: " + string.Format("{0:dd/MM/yyyy}", DateTime.Now);
        xrtngayketxuat.Text = "Ngày " + DateTime.Now.Day + " tháng " + DateTime.Now.Month + " năm " + DateTime.Now.Year;
    }
    public rp_BaoCaoChiTietMotDotTuyenDung()
    {
        InitializeComponent();
        try
        {
            HeThongController ht   = new HeThongController();
            string            city = "CITY";

            xrl_ThangBaoCao.Text = "Ngày báo cáo:" + string.Format("{0:dd/MM/yyyy}", DateTime.Now);
            xrtngayketxuat.Text  = " Hà Nội, ngày " + DateTime.Now.Day + " tháng " + DateTime.Now.Month + " năm " + DateTime.Now.Year;
        }
        catch (Exception ex)
        {
            xrl_TitleBC.Text = ex.Message;
        }
    }
 public rp_BaoCaoKhenThuongKyLuatTrongThang()
 {
     InitializeComponent();
     //
     // TODO: Add constructor logic here
     //
     //
     try
     {
         HeThongController ht = new HeThongController();
     }
     catch (Exception ex)
     {
         xrl_TitleBC.Text = ex.Message;
     }
 }
Пример #12
0
    public void BindData(ReportFilterEmployeeProfile filter)
    {
        try
        {
            DataTable table = DataController.DataHandler.GetInstance().ExecuteDataTable("WG_GetHopDongThuViec", "@Prkey", filter.PrKeyHoSo);
            if (table.Rows.Count > 0)
            {
                HeThongController htController = new HeThongController();
                ReportController  rpController = new ReportController();
                string            giamDoc      = ReportController.GetInstance().GetDirectorName(filter.SessionDepartmentID, filter.Ten2);

                xrLabel2.Text = string.Format(xrLabel2.Text, filter.SoQuyetDinh);
                // Hà Nội, ngày {0} tháng {1} năm {2}
                xrLabel1.Text = string.Format(xrLabel1.Text, DateTime.Now.ToString("dd"), DateTime.Now.ToString("MM"), DateTime.Now.ToString("yyyy"));
                // giam doc
                xrRichText4.Rtf = rpController.Convertstringtortf(xrRichText4.Rtf, "{0}", giamDoc.ToUpper());
                // nhân viên
                xrRichText4.Rtf = rpController.Convertstringtortf(xrRichText4.Rtf, "{1}", table.Rows[0]["HO_TEN"].ToString());
                xrRichText4.Rtf = rpController.Convertstringtortf(xrRichText4.Rtf, "{2}", table.Rows[0]["NGAY_SINH"].ToString());
                xrRichText4.Rtf = rpController.Convertstringtortf(xrRichText4.Rtf, "{3}", table.Rows[0]["TEN_NUOC"].ToString());
                xrRichText4.Rtf = rpController.Convertstringtortf(xrRichText4.Rtf, "{4}", table.Rows[0]["SO_CMND"].ToString());
                xrRichText4.Rtf = rpController.Convertstringtortf(xrRichText4.Rtf, "{5}", table.Rows[0]["NGAYCAP_CMND"].ToString());
                xrRichText4.Rtf = rpController.Convertstringtortf(xrRichText4.Rtf, "{6}", table.Rows[0]["TEN_NOICAP_CMND"].ToString());
                xrRichText4.Rtf = rpController.Convertstringtortf(xrRichText4.Rtf, "{7}", table.Rows[0]["HO_KHAU"].ToString());
                xrRichText4.Rtf = rpController.Convertstringtortf(xrRichText4.Rtf, "{8}", table.Rows[0]["DIA_CHI_LH"].ToString());
                xrRichText4.Rtf = rpController.Convertstringtortf(xrRichText4.Rtf, "{9}", table.Rows[0]["DI_DONG"].ToString());
                xrRichText4.Rtf = rpController.Convertstringtortf(xrRichText4.Rtf, "{10}", table.Rows[0]["TEN_TRINHDO"].ToString());
                xrRichText4.Rtf = rpController.Convertstringtortf(xrRichText4.Rtf, "{11}", table.Rows[0]["TEN_CHUYENNGANH"].ToString());


                xrRichText4.Rtf = rpController.Convertstringtortf(xrRichText4.Rtf, "{12}", filter.Thang.ToString());
                xrRichText4.Rtf = rpController.Convertstringtortf(xrRichText4.Rtf, "{13}", filter.TuNgay.ToString("dd"));
                xrRichText4.Rtf = rpController.Convertstringtortf(xrRichText4.Rtf, "{14}", filter.TuNgay.ToString("MM"));
                xrRichText4.Rtf = rpController.Convertstringtortf(xrRichText4.Rtf, "{15}", filter.TuNgay.ToString("yyyy"));
                xrRichText4.Rtf = rpController.Convertstringtortf(xrRichText4.Rtf, "{16}", table.Rows[0]["TEN_DONVI"].ToString());
                xrRichText4.Rtf = rpController.Convertstringtortf(xrRichText4.Rtf, "{17}", table.Rows[0]["TEN_DONVI"].ToString());

                xrRichText4.Rtf = rpController.Convertstringtortf(xrRichText4.Rtf, "{18}", filter.SoTien.ToString("n0"));
                xrRichText4.Rtf = rpController.Convertstringtortf(xrRichText4.Rtf, "{19}", SoftCore.Util.GetInstance().DocTienBangChu(filter.SoTien, " đồng"));
            }
        }
        catch (Exception)
        {
        }
    }
    public void BinData(ReportFilterTax rp)
    {
        try
        {
            //xrl_TenCongTy.Text = rp.CompanyName;
            //xrl_TenThanhPho.Text = rp.CityName;
            //if (rp.ReportTitle != "")
            //    xrl_TitleBC.Text = rp.ReportTitle;

            string cityNameNormal = new HeThongController().GetValueByName(SystemConfigParameter.CITY, rp.SessionDepartmentID);

            DataTable table = DataController.DataHandler.GetInstance().ExecuteDataTable("BC_Thue_DanhSachDangKyGiamTruGiaCanh", "@TuNgay", "@DenNgay", rp.TuNgay, rp.DenNgay);
            DataSource = table;

            xrt_manhanvien.DataBindings.Add("Text", DataSource, "MA_CB");
            xrt_hovaten.DataBindings.Add("Text", DataSource, "HO_TEN");
            xrt_ngaysinh.DataBindings.Add("Text", DataSource, "NGAY_SINH", "{0:dd/MM/yyyy}");
            xrt_soCMT.DataBindings.Add("Text", DataSource, "SO_CMND");
            xrt_ngaycap.DataBindings.Add("Text", DataSource, "NGAYCAP_CMND", "{0:dd/MM/yyyy}");
            xrt_noicap.DataBindings.Add("Text", DataSource, "TEN_NOICAP_CMND");
            xrt_songuoigiamtru.DataBindings.Add("Text", DataSource, "SoNguoiGiamTru");

            xrl_Ngay.Text = cityNameNormal + ", ngày " + DateTime.Now.Day + " tháng " + DateTime.Now.Month + " năm " + DateTime.Now.Year;

            if (!string.IsNullOrEmpty(rp.Footer1))
            {
                xrl_footer1.Text = rp.Footer1;
            }
            if (!string.IsNullOrEmpty(rp.Footer3))
            {
                xrl_footer3.Text = rp.Footer3;
            }
            if (!string.IsNullOrEmpty(rp.Ten1))
            {
                xrl_ten1.Text = rp.Ten1;
            }
            if (!string.IsNullOrEmpty(rp.Ten3))
            {
                xrl_ten3.Text = rp.Ten3;
            }
        }
        catch (Exception ex)
        { }
    }
Пример #14
0
 protected void btnTinhSoNgayPhep_Click(object sender, DirectEventArgs e)
 {
     try
     {
         HeThongController          system     = new HeThongController();
         DanhSachNgayPhepController controller = new DanhSachNgayPhepController();
         DAL.DanhSachNgayPhep       ngayPhep   = new DanhSachNgayPhep()
         {
             Nam                = DateTime.Now.Year,
             CreatedBy          = CurrentUser.ID,
             SoNgayPhepNamNay   = string.IsNullOrEmpty(nbfSoNgayPhep.Text) ? 0 : int.Parse(nbfSoNgayPhep.Text),
             SoNgayPhepNamTruoc = 0,
             SoNgayPhepDuocThem = string.IsNullOrEmpty(nbfSoNgayPhepThuongThem.Text) ? 0 : int.Parse(nbfSoNgayPhepThuongThem.Text),
             SoNgayPhepCongDonToiDaTrongThang = int.Parse(nbfSoNgayPhepCongDonToiDaTrong1Thang.Text),
             CreatedDate = DateTime.Now,
         };
         if (ngayPhep.SoNgayPhepDuocThem != 0)
         {
             ngayPhep.ThoiHanSuDungNgayPhepDuocThem = dfHanDungNgayPhepThuongThem.SelectedDate;
         }
         if (ngayPhep.SoNgayPhepNamTruoc != 0)
         {
             ngayPhep.ThoiHanSuDungNgayPhepNamTruoc = dfHanDungNgayPhepNamTruoc.SelectedDate;
         }
         if (rdApDungChoTatCaNhanVien.Checked)
         {
             controller.TinhSoNgayPhep(ngayPhep, Session["MaDonVi"].ToString());
         }
         //else if (rdChiNhungNhanVienDuocChon.Checked)
         //{
         //    foreach (var item in RowSelectionModel1.SelectedRows)
         //    {
         //        controller.TinhSoNgayPhep(ngayPhep, int.Parse(item.RecordID));
         //    }
         //}
         wdTinhSoNgayPhep.Hide();
         //   GridPanel1.Reload();
     }
     catch (Exception ex)
     {
         X.MessageBox.Alert("Có lỗi xảy ra", ex.Message).Show();
     }
 }
Пример #15
0
 protected void btnSendEmail_Click(object sender, DirectEventArgs e)
 {
     try
     {
         string mailto = e.ExtraParams["Email"];
         if (string.IsNullOrEmpty(mailto))
         {
             X.Msg.Alert(GlobalResourceManager.GetInstance().GetLanguageValue("warning"), GlobalResourceManager.GetInstance().GetDesktopValue("email_not_found")).Show();
             return;
         }
         HeThongController htController = new HeThongController();
         SendMail1.SetEmailTo(htController.GetValueByName(SystemConfigParameter.EMAIL, Session["MaDonVi"].ToString()), htController.GetValueByName(SystemConfigParameter.PASSWORD_EMAIL, Session["MaDonVi"].ToString()), mailto);
         SendMail1.Show();
     }
     catch (Exception ex)
     {
         X.Msg.Alert("Cảnh báo", ex.Message).Show();
     }
 }
Пример #16
0
    /// <summary>
    /// Sinh mã cán bộ dựa vào cấu hình hệ thống:
    /// -   Tiền tố của mã cán bộ
    /// -   Số lượng chữ số theo sau tiền tố
    /// </summary>
    /// <returns>Mã cán bộ mới được sinh ra</returns>
    public string GenerateMaCB(string maDV)
    {
        string prefix = new HeThongController().GetValueByName(SystemConfigParameter.PREFIX, maDV);
        string sl     = new HeThongController().GetValueByName(SystemConfigParameter.NUMBER_OF_CHARACTER, maDV);

        if (string.IsNullOrEmpty(prefix))
        {
            prefix = "NV";
        }
        int       number    = string.IsNullOrEmpty(sl) ? 5 : int.Parse(sl);
        DataTable table     = DataController.DataHandler.GetInstance().ExecuteDataTable("GetMaCBByConfig", "@Prefix", "@Number", prefix, number);
        string    oldMaCB   = table.Rows.Count == 0 ? "00000000000000000000" : table.Rows[0]["MA_CB"].ToString();
        long      oldNumber = long.Parse("" + oldMaCB.Substring(prefix.Length));

        oldNumber++;
        string newMaCB = "00000000000000000000" + oldNumber;

        newMaCB = prefix + newMaCB.Substring(newMaCB.Length - number);
        return(newMaCB);
    }
Пример #17
0
    public rp_TrichNopBHYT()
    {
        InitializeComponent();
        //
        // TODO: Add constructor logic here
        //
        HeThongController ht          = new HeThongController();
        string            companyname = "COMPANY_NAME";
        string            city        = "CITY";

        if (!string.IsNullOrEmpty(ht.GetValueByCompanyName(companyname).ToString()))
        {
            xrl_TenCongTy.Text = ht.GetValueByCompanyName(companyname).ToString().ToUpper();
        }
        if (!string.IsNullOrEmpty(ht.GetValueByCity(city).ToString()))
        {
            xrl_TenThanhPho.Text = "THÀNH PHỐ " + ht.GetValueByCity(city).ToString().ToUpper();
        }
        xrl_ThangBaoCao.Text = "Tháng: " + DateTime.Now.Month + " năm " + DateTime.Now.Year;
        xrtngayketxuat.Text  = " Hà Nội, ngày " + DateTime.Now.Day + " tháng " + DateTime.Now.Month + " năm " + DateTime.Now.Year;
    }
Пример #18
0
    private void sendEmailCreateAccount(UserInfo uInfo)
    {
        // send email to user
        HeThongController htController = new HeThongController();
        object            mailFrom     = htController.GetValueByName(SystemConfigParameter.EMAIL, Session["MaDonVi"].ToString());
        string            from         = mailFrom != null?mailFrom.ToString() : "";

        string mailPassword      = htController.GetValueByName(SystemConfigParameter.PASSWORD_EMAIL, Session["MaDonVi"].ToString());
        string fromEmailPassword = mailPassword != null?mailPassword.ToString() : "";

        if (from == "" || fromEmailPassword != "")
        {
            from = "*****@*****.**";
            fromEmailPassword = "******";
        }

        string mailName = GlobalResourceManager.GetInstance().GetLanguageValue("email_title_create_account");
        string subject  = GlobalResourceManager.GetInstance().GetLanguageValue("email_title_create_account");
        string content  = Util.GetInstance().ReadFile(Server.MapPath("../../Modules/MailTemplate/CreateAccount." + GlobalResourceManager.GetInstance().GetCurrentCulture() + ".html"));

        if (uInfo.DisplayName == null)
        {
            content = string.Format(content, uInfo.UserName, uInfo.UserName, uInfo.Password);
        }
        else
        {
            content = string.Format(content, uInfo.DisplayName, uInfo.UserName, uInfo.Password);
        }

        if (mailFrom != "" && mailPassword != "")
        {
            SoftCore.Utilities.Email.SendEmail(from, fromEmailPassword, mailName, uInfo.Email, subject, content);

            X.Msg.Alert(GlobalResourceManager.GetInstance().GetLanguageValue("warning"), GlobalResourceManager.GetInstance().GetLanguageValue("email_notice_create_account")).Show();
        }
        // end send email to user
    }
Пример #19
0
    protected void btnCapNhatCauHinh_Click(object sender, DirectEventArgs e)
    {
        try
        {
            string            maDV       = Session["MaDonVi"].ToString();
            HeThongController controller = new HeThongController();

            controller.CreateOrSave(SystemConfigParameter.DSC_GIOVAO, chkGioVao.Checked.ToString(), CurrentUser.ID, maDV);
            controller.CreateOrSave(SystemConfigParameter.DSC_GIORA, chkGioRa.Checked.ToString(), CurrentUser.ID, maDV);
            controller.CreateOrSave(SystemConfigParameter.DSC_SOGIOLAM, chkSoGioLam.Checked.ToString(), CurrentUser.ID, maDV);
            controller.CreateOrSave(SystemConfigParameter.DSC_CHOPHEPDIMUON, chkChoPhepDiMuon.Checked.ToString(), CurrentUser.ID, maDV);
            controller.CreateOrSave(SystemConfigParameter.DSC_CHOPHEPVESOM, chkChoPhepVeSom.Checked.ToString(), CurrentUser.ID, maDV);
            //   controller.CreateOrSave(SystemConfigParameter.DSC_BATDAUTINHLAMTHEMDAUGIO, chkBatDauTinhLamThemDauGio.Checked.ToString(), CurrentUser.ID, maDV);
            //   controller.CreateOrSave(SystemConfigParameter.DSC_BATDAULAMTHEMCUOIGIO, chkBatDauTinhLamThemCuoiGio.Checked.ToString(), CurrentUser.ID, maDV);
            controller.CreateOrSave(SystemConfigParameter.DSC_APDUNGTUNGAY, chkApDungTuNgay.Checked.ToString(), CurrentUser.ID, maDV);
            controller.CreateOrSave(SystemConfigParameter.DSC_APDUNGDENNGAY, chkApDungDenNgay.Checked.ToString(), CurrentUser.ID, maDV);

            controller.CreateOrSave(SystemConfigParameter.DSC_QUETTHEDAUCA, chkQuetTheDauCa.Checked.ToString(), CurrentUser.ID, maDV);
            controller.CreateOrSave(SystemConfigParameter.DSC_QUETTHENGHIDAUCA, chkQuetTheNghiDauCa.Checked.ToString(), CurrentUser.ID, maDV);
            controller.CreateOrSave(SystemConfigParameter.DSC_QUETTHEVAOCASAU, chkQuetTheVaoCaSau.Checked.ToString(), CurrentUser.ID, maDV);
            controller.CreateOrSave(SystemConfigParameter.DSC_QUETTHECUOICA, chkQuetTheCuoiCa.Checked.ToString(), CurrentUser.ID, maDV);
            controller.CreateOrSave(SystemConfigParameter.DSC_PHUCAPCA, chkPhuCapCa.Checked.ToString(), CurrentUser.ID, maDV);
            controller.CreateOrSave(SystemConfigParameter.DSC_MUCLUONGCA, chkMucLuongCa.Checked.ToString(), CurrentUser.ID, maDV);
            controller.CreateOrSave(SystemConfigParameter.DSC_NGAYAPDUNG, chkNgayApDung.Checked.ToString(), CurrentUser.ID, maDV);
            controller.CreateOrSave(SystemConfigParameter.DSC_NGAYTAO, chkNgayTao.Checked.ToString(), CurrentUser.ID, maDV);
            controller.CreateOrSave(SystemConfigParameter.DSC_LOAICA, chkLoaiCa.Checked.ToString(), CurrentUser.ID, maDV);

            Dialog.ShowNotification("Đã lưu cấu hình");
            wdConfigGridPanel.Hide();
            Response.Redirect(Request.RawUrl);
        }
        catch (Exception ex)
        {
            X.Msg.Alert("Thông báo từ hệ thống", "Có lỗi xảy ra: " + ex.Message).Show();
        }
    }
Пример #20
0
    /*
     * Biểu đồ thống kê tình trạng đi muộn về sớm
     * daibx    22/06/2013
     */
    private void BieuDoThongKeTinhTrangDiMuonVeSom(string macb, int thang, int nam, int height)
    {
        try
        {
            string MaDonVi = Session["MaDonVi"].ToString();

            var data = DataController.DataHandler.GetInstance().ExecuteDataTable("ChamCong_GetDiMuonVeSomByMaCB", "@MA_CB", "@Thang", "@Nam", macb, thang, nam);

            string batDauLamSa           = new HeThongController().GetValueByName(SystemConfigParameter.BAT_DAU_LAM_SANG, MaDonVi);
            string ketThucLamSa          = new HeThongController().GetValueByName(SystemConfigParameter.KET_THUC_LAM_SANG, MaDonVi);
            string batDauLamCh           = new HeThongController().GetValueByName(SystemConfigParameter.BAT_DAU_LAM_CHIEU, MaDonVi);
            string ketThucLamCh          = new HeThongController().GetValueByName(SystemConfigParameter.KET_THUC_LAM_CHIEU, MaDonVi);
            string HThucLamT7            = new HeThongController().GetValueByName(SystemConfigParameter.HINH_THUC_LAM_T7, MaDonVi);
            string HThucLamCN            = new HeThongController().GetValueByName(SystemConfigParameter.HINH_THUC_LAM_CN, MaDonVi);
            int    soPhutChoPhepVeSom    = int.Parse(new HeThongController().GetValueByName(SystemConfigParameter.SO_PHUT_CHO_PHEP_VE_SOM, MaDonVi));
            int    soPhutChoPhepDiMuon   = int.Parse(new HeThongController().GetValueByName(SystemConfigParameter.SO_PHUT_CHO_PHEP_DI_MUON, MaDonVi));
            int    soPhutMinCoiLaLamThem = int.Parse(new HeThongController().GetValueByName(SystemConfigParameter.SO_PHUT_TOI_THIEU_DUOC_TINH_LAM_THEM, MaDonVi));
            bool   choPhepLamThemDauGio  = bool.Parse(new HeThongController().GetValueByName(SystemConfigParameter.CHO_PHEP_LAM_THEM_DAU_GIO, MaDonVi));
            int    soPhutDiMuonCoiLaNghi = int.Parse(new HeThongController().GetValueByName(SystemConfigParameter.SO_PHUT_DI_MUON_COI_LA_NGHI, MaDonVi));

            int gioVaoSang   = int.Parse(batDauLamSa.Split(':')[0]);
            int phutVaoSang  = int.Parse(batDauLamSa.Split(':')[1]);
            int gioRaSang    = int.Parse(ketThucLamSa.Split(':')[0]);
            int phutRaSang   = int.Parse(ketThucLamSa.Split(':')[1]);
            int gioVaoChieu  = int.Parse(batDauLamCh.Split(':')[0]);
            int phutVaoChieu = int.Parse(batDauLamCh.Split(':')[1]);
            int gioRaChieu   = int.Parse(ketThucLamCh.Split(':')[0]);
            int phutRaChieu  = int.Parse(ketThucLamCh.Split(':')[1]);

            int      maxDay = DateTime.DaysInMonth(nam, thang);
            object[] tenMoc = new object[maxDay];

            object[] diMuonList = new object[maxDay];
            object[] veSomList  = new object[maxDay];
            for (int i = 0; i < maxDay; i++)
            {
                diMuonList[i] = 0;
                veSomList[i]  = 0;
            }

            for (int i = 0; i < data.Rows.Count; i++)
            {
                var item = data.Rows[i];
                if (item != null)
                {
                    DateTime curDay = new DateTime(nam, thang, int.Parse(item["DAY"].ToString()));
                    int      thu    = (int)curDay.DayOfWeek;
                    if (item["DAY"] != null && item["DAY"].ToString() != "")
                    {
                        // Tính đi muộn, làm thêm đầu giờ
                        if (item["VAO"].ToString() != "")
                        {
                            int diMuon = 0;
                            if (thu == 6)   // thứ 7
                            {
                                switch (HThucLamT7)
                                {
                                case "FULLTIME":
                                    diMuon = CalculateDiMuon(gioVaoSang, phutVaoSang, item["VAO"].ToString(), gioRaSang, phutRaSang, gioVaoChieu, phutVaoChieu, gioRaChieu, phutRaChieu);
                                    break;

                                case "LAM_SANG_NGHI_CHIEU":
                                    diMuon = CalculateDiMuon(gioVaoSang, phutVaoSang, item["VAO"].ToString(), gioRaSang, phutRaSang, int.Parse(item["VAO"].ToString().Split(':')[0]), int.Parse(item["VAO"].ToString().Split(':')[1]), int.Parse(item["VAO"].ToString().Split(':')[0]), int.Parse(item["VAO"].ToString().Split(':')[1]));
                                    break;

                                case "LAM_CHIEU_NGHI_SANG":
                                    diMuon = CalculateDiMuonChieu(gioVaoChieu, phutVaoChieu, item["VAO"].ToString(), gioRaSang, phutRaSang, gioVaoChieu, phutVaoChieu, gioRaChieu, phutRaChieu);
                                    break;
                                }
                                if (diMuon > soPhutChoPhepDiMuon)
                                {
                                    diMuonList[int.Parse(item["DAY"].ToString()) - 1] = diMuon;
                                }
                            }
                            else if (thu == 0)  // chủ nhật
                            {
                                switch (HThucLamCN)
                                {
                                case "FULLTIME":
                                    diMuon = CalculateDiMuon(gioVaoSang, phutVaoSang, item["VAO"].ToString(), gioRaSang, phutRaSang, gioVaoChieu, phutVaoChieu, gioRaChieu, phutRaChieu);
                                    break;

                                case "LAM_SANG_NGHI_CHIEU":
                                    diMuon = CalculateDiMuon(gioVaoSang, phutVaoSang, item["VAO"].ToString(), gioRaSang, phutRaSang, int.Parse(item["VAO"].ToString().Split(':')[0]), int.Parse(item["VAO"].ToString().Split(':')[1]), int.Parse(item["VAO"].ToString().Split(':')[0]), int.Parse(item["VAO"].ToString().Split(':')[1]));
                                    break;

                                case "LAM_CHIEU_NGHI_SANG":
                                    diMuon = CalculateDiMuonChieu(gioVaoChieu, phutVaoChieu, item["VAO"].ToString(), gioRaSang, phutRaSang, gioVaoChieu, phutVaoChieu, gioRaChieu, phutRaChieu);
                                    break;
                                }
                                if (diMuon > soPhutChoPhepDiMuon)
                                {
                                    diMuonList[int.Parse(item["DAY"].ToString()) - 1] = diMuon;
                                }
                            }
                            else // ngày thường
                            {
                                diMuon = CalculateDiMuon(gioVaoSang, phutVaoSang, item["VAO"].ToString(), gioRaSang, phutRaSang, gioVaoChieu, phutVaoChieu, gioRaChieu, phutRaChieu);
                                if (diMuon > soPhutChoPhepDiMuon)
                                {
                                    diMuonList[int.Parse(item["DAY"].ToString()) - 1] = diMuon;
                                }
                            }
                        }

                        // Tính về sớm, làm thêm cuối giờ
                        if (item["RA"].ToString() != "")
                        {
                            int veSom = 0;
                            if (thu == 6)   // thứ 7
                            {
                                switch (HThucLamT7)
                                {
                                case "FULLTIME":
                                    veSom = CalculateVeSom(gioRaChieu, phutRaChieu, item["RA"].ToString(), gioRaSang, phutRaSang, gioVaoChieu, phutVaoChieu, gioVaoSang, phutVaoSang);
                                    break;

                                case "LAM_SANG_NGHI_CHIEU":
                                    veSom = CalculateVeSomSang(gioRaSang, phutRaSang, item["RA"].ToString(), gioRaSang, phutRaSang, gioVaoChieu, phutVaoChieu, gioVaoSang, phutVaoSang);
                                    break;

                                case "LAM_CHIEU_NGHI_SANG":
                                    veSom = CalculateVeSom(gioRaChieu, phutRaChieu, item["RA"].ToString(), int.Parse(item["RA"].ToString().Split(':')[0]), int.Parse(item["RA"].ToString().Split(':')[1]), gioVaoChieu, phutVaoChieu, int.Parse(item["RA"].ToString().Split(':')[0]), int.Parse(item["RA"].ToString().Split(':')[1]));
                                    break;
                                }
                                if (veSom > soPhutChoPhepVeSom)
                                {
                                    veSomList[int.Parse(item["DAY"].ToString()) - 1] = veSom;
                                }
                            }
                            else if (thu == 0)  // chủ nhật
                            {
                                switch (HThucLamCN)
                                {
                                case "FULLTIME":
                                    veSom = CalculateVeSom(gioRaChieu, phutRaChieu, item["RA"].ToString(), gioRaSang, phutRaSang, gioVaoChieu, phutVaoChieu, gioVaoSang, phutVaoSang);
                                    break;

                                case "LAM_SANG_NGHI_CHIEU":
                                    veSom = CalculateVeSomSang(gioRaSang, phutRaSang, item["RA"].ToString(), gioRaSang, phutRaSang, gioVaoChieu, phutVaoChieu, gioVaoSang, phutVaoSang);
                                    break;

                                case "LAM_CHIEU_NGHI_SANG":
                                    veSom = CalculateVeSom(gioRaChieu, phutRaChieu, item["RA"].ToString(), int.Parse(item["RA"].ToString().Split(':')[0]), int.Parse(item["RA"].ToString().Split(':')[1]), gioVaoChieu, phutVaoChieu, int.Parse(item["RA"].ToString().Split(':')[0]), int.Parse(item["RA"].ToString().Split(':')[1]));
                                    break;
                                }
                                if (veSom > soPhutChoPhepVeSom)
                                {
                                    veSomList[int.Parse(item["DAY"].ToString()) - 1] = veSom;
                                }
                            }
                            else// ngày thường
                            {
                                veSom = CalculateVeSom(gioRaChieu, phutRaChieu, item["RA"].ToString(), gioRaSang, phutRaSang, gioVaoChieu, phutVaoChieu, gioVaoSang, phutRaSang);
                                if (veSom > soPhutChoPhepVeSom)
                                {
                                    veSomList[int.Parse(item["DAY"].ToString()) - 1] = veSom;
                                }
                            }
                        }
                    }
                }
            }
            string tencb = data.Rows[0]["HO_TEN"].ToString();
            hcFrutas.Title = new Title("Thời gian đi muộn về sớm trong tháng " + thang + "/" + nam + " của nhân viên " + tencb);

            for (int i = 1; i <= maxDay; i++)
            {
                tenMoc[i - 1] = i;
            }

            // ve bieu do
            hcFrutas.YAxis.Add(new YAxisItem {
                title = new Title("Số phút")
            });
            hcFrutas.XAxis.Add(new XAxisItem {
                categories = tenMoc, title = new Title("Ngày trong tháng")
            });

            //dados
            var series = new Collection <Serie>();

            series.Add(new Serie {
                name = "Đi muộn", data = diMuonList
            });
            series.Add(new Serie {
                name = "Về sớm", data = veSomList
            });

            hcFrutas.PlotOptions = new PlotOptionsColumn()
            {
                borderColor  = "#dedede",
                borderRadius = 4,
                dataLabels   = new DataLabels()
                {
                    enabled = true,
                },
            };
            hcFrutas.Height = height;
            hcFrutas.Legend = new Legend()
            {
                layout          = Highcharts.Core.Layout.horizontal,
                align           = Align.left,
                verticalAlign   = Highcharts.Core.VerticalAlign.top,
                x               = 70,
                y               = -5,
                floating        = true,
                shadow          = true,
                backgroundColor = "#FFF",
                enabled         = true,
            };
            hcFrutas.Exporting.enabled = true;
            hcFrutas.DataSource        = series;
            hcFrutas.DataBind();
        }
        catch
        {
            throw;
        }
    }
Пример #21
0
    protected void btnTaoTaiKhoan_Click(object sender, DirectEventArgs e)
    {
        try
        {
            string[]       tmp          = hdfJsonData.Text.Replace("[", "").Replace("]", "").Replace("},", "#").Split('#');
            HoSoController hsController = new HoSoController();
            LinqProvider   linq         = new LinqProvider();
            string         email        = string.Empty;
            string         password     = string.Empty;
            if (Checkbox1.Checked)
            {
                HeThongController ht          = new HeThongController();
                object            objEmail    = ht.GetValueByName(SystemConfigParameter.EMAIL, Session["MaDonVi"].ToString());
                object            objPassword = ht.GetValueByName(SystemConfigParameter.PASSWORD_EMAIL, Session["MaDonVi"].ToString());
                if (objEmail != null)
                {
                    email = objEmail.ToString();
                }
                if (objPassword != null)
                {
                    password = objPassword.ToString();
                }
            }
            int countDuplicate = 0;
            int success        = 0;
            foreach (var item in tmp)
            {
                try
                {
                    DAL.HOSO hs = linq.GetDataContext().HOSOs.Where(t => t.MA_CB == Util.GetInstance().Getproperties(item, "UserID")).FirstOrDefault();//hsController.GetByMaCB(Util.GetInstance().Getproperties(item, "UserID"));
                    if (hs == null)
                    {
                        continue;
                    }
                    UserInfo uInfo = new UserInfo()
                    {
                        Gender      = hs.MA_GIOITINH == "M" ? true : false,
                        Address     = hs.DIA_CHI_LH,
                        Birthday    = hs.NGAY_SINH,
                        DisplayName = hs.HO_TEN,
                        Image       = "",
                        CreatedBy   = CurrentUser.ID,
                        CreatedOn   = DateTime.Now,
                        EdittedBy   = CurrentUser.ID,
                        EdittedOn   = DateTime.Now,
                        IsLock      = false,
                        Email       = hs.EMAIL,
                        IsSuperUser = false,
                        Phone       = hs.DI_DONG,
                        FirstName   = hs.HO_CB,
                        LastName    = hs.TEN_CB,
                        Password    = Util.GetInstance().Getproperties(item, "Password"),
                        UserName    = Util.GetInstance().Getproperties(item, "UserName"),
                    };
                    int uID = UsersController.GetInstance().CreateUser(uInfo);
                    if (uID > 0)
                    {
                        hs.UserID = uID;
                        linq.Save();

                        //Gán quyền cho người dùng
                        foreach (var roleItem in CheckboxSelectionModelRoleList.SelectedRows)
                        {
                            UsersController.GetInstance().SetRoles(uID, int.Parse(roleItem.RecordID));
                        }

                        new DM_DONVIController().AddUserIntoDonVi(hdfMaDonViOfCurrentUser.Text, uID);

                        //Gửi email thông báo
                        if (Checkbox1.Checked && string.IsNullOrEmpty(hs.EMAIL) == false)
                        {
                            string content = GlobalResourceManager.GetInstance().GetLanguageValue("NotifyUserName");
                            Email.SendEmail(email, password, "Thông báo mật khẩu", hs.EMAIL, "Thông báo mật khẩu", string.Format(content, uInfo.UserName, uInfo.Password));
                        }
                    }
                    success++;
                }
                catch (Exception ex)
                {
                    if (ex.Message.ToLower().Contains("duplicate key"))
                    {
                        countDuplicate++;
                    }
                }
            }
            wdTaoTaiKhoanNhanVien.Hide();
            string notifies = "";
            if (success > 0)
            {
                notifies += "Tạo tài khoản thành công cho " + success + " cán bộ.";
            }
            if (countDuplicate > 0)
            {
                notifies += " Có " + countDuplicate + " tài khoản đã tồn tại.";
            }
            X.Msg.Alert("Thông báo từ hệ thống", notifies).Show();
            ReloadStore();
        }
        catch (Exception ex)
        {
            Dialog.ShowError(ex.Message);
        }
    }
Пример #22
0
    protected void btn_SentEmail_HappyBirthDay_Click(object sender, DirectEventArgs e)
    {
        try
        {
            SelectedRowCollection selecteds = RowSelectionModel3.SelectedRows;
            string    mailto = string.Empty;
            string    error  = "";
            DataTable dt     = DataController.DataHandler.GetInstance().ExecuteDataTable("sp_GetAllEmailHappyBirthDayMonth");
            if (e.ExtraParams["All"] == "True")
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (!string.IsNullOrEmpty(dt.Rows[i]["Email"].ToString()))
                    {
                        mailto += dt.Rows[i]["Email"].ToString() + ", ";
                    }
                    else if (!string.IsNullOrEmpty(dt.Rows[i]["EMAIL_RIENG"].ToString()))
                    {
                        mailto += dt.Rows[i]["EMAIL_RIENG"].ToString() + ", ";
                    }
                    else
                    {
                        error += dt.Rows[i]["HO_TEN2"].ToString() + " ";
                    }
                }
            }
            else
            {
                foreach (var item in selecteds)
                {
                    string ma_CB = item.RecordID;
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if (dt.Rows[i]["Ma_CB"].ToString() == ma_CB)
                        {
                            if (!string.IsNullOrEmpty(dt.Rows[i]["Email"].ToString()))
                            {
                                mailto += dt.Rows[i]["Email"].ToString() + ", ";
                            }
                            else if (!string.IsNullOrEmpty(dt.Rows[i]["EMAIL_RIENG"].ToString()))
                            {
                                mailto += dt.Rows[i]["EMAIL_RIENG"].ToString() + ", ";
                            }
                            else
                            {
                                Dialog.ShowError(GlobalResourceManager.GetInstance().GetDesktopValue("email_not_found"));
                                return;
                            }
                        }
                    }
                }
            }
            string mail = "";
            for (int i = 0; i < mailto.Length - 2; i++)
            {
                mail += mailto[i];
            }
            HeThongController htController = new HeThongController();
            SendMail1.SetEmailTo(htController.GetValueByName(SystemConfigParameter.EMAIL, Session["MaDonVi"].ToString()), htController.GetValueByName(SystemConfigParameter.PASSWORD_EMAIL, Session["MaDonVi"].ToString()), mail);

            SendMail1.Show();
            if (!string.IsNullOrEmpty(error.Trim()))
            {
                Dialog.ShowError("Một số nhân viên không có email :" + error);
            }
        }
        catch (Exception ex)
        {
            Dialog.ShowError("Lỗi xảy ra " + ex.Message);
        }
    }
Пример #23
0
    public void BindData(ReportFilterEmployeeProfile filter)
    {
        try
        {
            DataTable table = DataController.DataHandler.GetInstance().ExecuteDataTable("WG_ThoaThuanHocViec", "@Prkey", filter.PrKeyHoSo);
            if (table.Rows.Count > 0)
            {
                HeThongController htController = new HeThongController();
                ReportController  rpController = new ReportController();
                string            giamDoc      = htController.GetValueByName(SystemConfigParameter.chuky2, filter.SessionDepartmentID);
                // Hà Nội, ngày {0} tháng {1} năm {2}
                xrRichText5.Rtf = rpController.Convertstringtortf(xrRichText5.Rtf, "{0}", DateTime.Now.ToString("dd"));
                xrRichText5.Rtf = rpController.Convertstringtortf(xrRichText5.Rtf, "{1}", DateTime.Now.ToString("MM"));
                xrRichText5.Rtf = rpController.Convertstringtortf(xrRichText5.Rtf, "{2}", DateTime.Now.ToString("yyyy"));
                // Hôm nay, ngày {0} tại Công ty cổ phần Thế giới Giải trí.
                xrRichText7.Rtf = rpController.Convertstringtortf(xrRichText7.Rtf, "{0}", DateTime.Now.ToString("dd/MM/yyyy"));
//              Chúng tôi, một bên là:      Ông {0} (gọi tắt là Người sử dụng lao động)
//              Chức vụ		   :    Tổng Giám Đốc
//              Đại diện cho   :    Công ty cổ phần thế giới Giải trí (gọi tắt là Công ty)
//              Địa chỉ        :    191 Bà Triệu-Hai Bà Trưng-Hà Nội
//              Và một bên là  :    {1} (gọi tắt là Người lao động)
//              Sinh ngày      :    {2}
//              CMND số	       :    {3}   cấp ngày {4}    nơi cấp : {5}
//              Địa chỉ thường trú: {6}
//              Chỗ ở hiện tại :    {7}
//              Điện thoại di động: {8}    ĐTNR: {9}
                string ngayCapCMND     = table.Rows[0]["NgayCapCMND"].ToString();
                string ngaySinh        = table.Rows[0]["NgaySinh"].ToString();
                string noiCapCMND      = table.Rows[0]["NoiCapCMND"].ToString();
                string diaChiThuongTru = table.Rows[0]["DiaChiThuongTru"].ToString();
                string choOHienNay     = table.Rows[0]["ChoOHienNay"].ToString();
                string diDong          = table.Rows[0]["DiDong"].ToString();
                string nhaRieng        = table.Rows[0]["DTNR"].ToString();
                xrRichText8.Rtf = rpController.Convertstringtortf(xrRichText8.Rtf, "{0}", giamDoc);
                xrRichText8.Rtf = rpController.Convertstringtortf(xrRichText8.Rtf, "{1}", table.Rows[0]["HoTen"].ToString());
                xrRichText8.Rtf = rpController.Convertstringtortf(xrRichText8.Rtf, "{2}", string.IsNullOrEmpty(ngaySinh) ? "..." : ngaySinh.Remove(10));
                xrRichText8.Rtf = rpController.Convertstringtortf(xrRichText8.Rtf, "{3}", table.Rows[0]["SoCMND"].ToString());
                xrRichText8.Rtf = rpController.Convertstringtortf(xrRichText8.Rtf, "{4}", string.IsNullOrEmpty(ngayCapCMND) ? "..." : ngayCapCMND.Remove(10));
                xrRichText8.Rtf = rpController.Convertstringtortf(xrRichText8.Rtf, "{5}", string.IsNullOrEmpty(noiCapCMND) ? "..." : noiCapCMND);
                xrRichText8.Rtf = rpController.Convertstringtortf(xrRichText8.Rtf, "{6}", string.IsNullOrEmpty(diaChiThuongTru) ? "..." : diaChiThuongTru);
                xrRichText8.Rtf = rpController.Convertstringtortf(xrRichText8.Rtf, "{7}", string.IsNullOrEmpty(choOHienNay) ? "..." : choOHienNay);
                xrRichText8.Rtf = rpController.Convertstringtortf(xrRichText8.Rtf, "{8}", string.IsNullOrEmpty(diDong) ? "..." : diDong);
                xrRichText8.Rtf = rpController.Convertstringtortf(xrRichText8.Rtf, "{9}", string.IsNullOrEmpty(nhaRieng) ? "..." : nhaRieng);
//              Thoả thuận ký kết bản thoả thuận học việc và cam kết thực hiện đúng những điều khoản sau:
//              Điều 1: Thời hạn và công việc:
//              -	Thời hạn học việc: {0}
//              -	Từ ngày {1} tháng {2} năm {3}    đến ngày {4} tháng {5} năm {6}
//              -	Địa điểm học việc:  Công ty cổ phần Thế giới Giải trí & các chi nhánh của Công ty
//              -	Chức vụ: {7}      ;Công việc phải làm: Theo bản mô tả công việc
                int soNgay = filter.DenNgay.Subtract(filter.TuNgay).Days;
                xrRichText10.Rtf = rpController.Convertstringtortf(xrRichText10.Rtf, "{0}", soNgay.ToString() + " ngày");
                // từ ngày
                xrRichText10.Rtf = rpController.Convertstringtortf(xrRichText10.Rtf, "{1}", filter.TuNgay.ToString("dd"));
                xrRichText10.Rtf = rpController.Convertstringtortf(xrRichText10.Rtf, "{2}", filter.TuNgay.ToString("MM"));
                xrRichText10.Rtf = rpController.Convertstringtortf(xrRichText10.Rtf, "{3}", filter.TuNgay.ToString("yyyy"));
                DateTime denNgay = filter.DenNgay;
                xrRichText10.Rtf = rpController.Convertstringtortf(xrRichText10.Rtf, "{4}", denNgay.ToString("dd"));
                xrRichText10.Rtf = rpController.Convertstringtortf(xrRichText10.Rtf, "{5}", denNgay.ToString("MM"));
                xrRichText10.Rtf = rpController.Convertstringtortf(xrRichText10.Rtf, "{6}", denNgay.ToString("yyyy"));
                string chucVu = table.Rows[0]["TEN_CHUCVU"].ToString();
                xrRichText10.Rtf = rpController.Convertstringtortf(xrRichText10.Rtf, "{7}", string.IsNullOrEmpty(chucVu) ? "..." : chucVu);
                // mức lương
                xrRichText12.Rtf = rpController.Convertstringtortf(xrRichText12.Rtf, "{0}", filter.SoTien.ToString("n0"));
                string thanhChu = SoftCore.Util.GetInstance().DocTienBangChu(filter.SoTien, " đồng");
                xrRichText12.Rtf = rpController.Convertstringtortf(xrRichText12.Rtf, "{1}", thanhChu);
            }
            else
            {
                ExtMessage.Dialog.Alert("Không tìm thấy dữ liệu của cán bộ");
            }
        }
        catch (Exception ex)
        {
            ExtMessage.Dialog.Alert("Có lỗi xảy ra: " + ex.Message);
        }
    }
    public DataTable GetDiMuonVeSom(DataTable data, string MaDonVi, string Nam, string Thang)
    {
        string batDauLamSa           = new HeThongController().GetValueByName(SystemConfigParameter.BAT_DAU_LAM_SANG, MaDonVi);
        string ketThucLamSa          = new HeThongController().GetValueByName(SystemConfigParameter.KET_THUC_LAM_SANG, MaDonVi);
        string batDauLamCh           = new HeThongController().GetValueByName(SystemConfigParameter.BAT_DAU_LAM_CHIEU, MaDonVi);
        string ketThucLamCh          = new HeThongController().GetValueByName(SystemConfigParameter.KET_THUC_LAM_CHIEU, MaDonVi);
        string HThucLamT7            = new HeThongController().GetValueByName(SystemConfigParameter.HINH_THUC_LAM_T7, MaDonVi);
        string HThucLamCN            = new HeThongController().GetValueByName(SystemConfigParameter.HINH_THUC_LAM_CN, MaDonVi);
        int    soPhutChoPhepVeSom    = int.Parse(new HeThongController().GetValueByName(SystemConfigParameter.SO_PHUT_CHO_PHEP_VE_SOM, MaDonVi));
        int    soPhutChoPhepDiMuon   = int.Parse(new HeThongController().GetValueByName(SystemConfigParameter.SO_PHUT_CHO_PHEP_DI_MUON, MaDonVi));
        int    soPhutMinCoiLaLamThem = int.Parse(new HeThongController().GetValueByName(SystemConfigParameter.SO_PHUT_TOI_THIEU_DUOC_TINH_LAM_THEM, MaDonVi));
        int    soPhutMuonCoiLaNghi   = int.Parse(new HeThongController().GetValueByName(SystemConfigParameter.SO_PHUT_DI_MUON_COI_LA_NGHI, MaDonVi));

        int gioVaoSang   = int.Parse(batDauLamSa.Split(':')[0]);
        int phutVaoSang  = int.Parse(batDauLamSa.Split(':')[1]);
        int gioRaSang    = int.Parse(ketThucLamSa.Split(':')[0]);
        int phutRaSang   = int.Parse(ketThucLamSa.Split(':')[1]);
        int gioVaoChieu  = int.Parse(batDauLamCh.Split(':')[0]);
        int phutVaoChieu = int.Parse(batDauLamCh.Split(':')[1]);
        int gioRaChieu   = int.Parse(ketThucLamCh.Split(':')[0]);
        int phutRaChieu  = int.Parse(ketThucLamCh.Split(':')[1]);

        DataTable table     = CreateDataTable();
        int       maxLength = data.Rows.Count;
        int       ngay      = DateTime.DaysInMonth(Convert.ToInt32(Nam), Convert.ToInt32(Thang));

        for (int i = 0; i < maxLength; i++)
        {
            int      thu = 0;
            DateTime curDay;
            var      item = data.Rows[i];
            if (item != null)
            {
                DataRow dr = table.NewRow();
                dr["MA_CB"]     = item["MA_CB"];  // MA_CB
                dr["HO_TEN"]    = item["HO_TEN"]; // HO_TEN
                dr["TEN_PHONG"] = item["TEN_PHONG"];
                string tenphong = item["TEN_PHONG"].ToString();
                string macb = item["MA_CB"].ToString();
                int    tongDiMuon = 0, tongVeSom = 0, solan_dimuon = 0, solan_vesom = 0;
                while (item["MA_CB"].ToString() == macb)
                {
                    if (item["DAY"] != null && item["DAY"].ToString() != "")
                    {
                        if (Convert.ToInt32(item["DAY"]) <= ngay)
                        {
                            curDay = new DateTime(int.Parse(Nam), int.Parse(Thang), int.Parse(item["DAY"].ToString()));
                            thu    = (int)curDay.DayOfWeek;
                        }
                        // Tính đi muộn, làm thêm đầu giờ
                        if (item["VAO"].ToString() != "")
                        {
                            int diMuon = 0;
                            if (thu == 6)   // thứ 7
                            {
                                switch (HThucLamT7)
                                {
                                case "FULLTIME":
                                    diMuon = CalculateDiMuon(gioVaoSang, phutVaoSang, item["VAO"].ToString(), gioRaSang, phutRaSang, gioVaoChieu, phutVaoChieu, gioRaChieu, phutRaChieu);
                                    break;

                                case "LAM_SANG_NGHI_CHIEU":
                                    diMuon = CalculateDiMuon(gioVaoSang, phutVaoSang, item["VAO"].ToString(), gioRaSang, phutRaSang, int.Parse(item["VAO"].ToString().Split(':')[0]), int.Parse(item["VAO"].ToString().Split(':')[1]), int.Parse(item["VAO"].ToString().Split(':')[0]), int.Parse(item["VAO"].ToString().Split(':')[1]));
                                    break;

                                case "LAM_CHIEU_NGHI_SANG":
                                    diMuon = CalculateDiMuonChieu(gioVaoChieu, phutVaoChieu, item["VAO"].ToString(), gioRaSang, phutRaSang, gioVaoChieu, phutVaoChieu, gioRaChieu, phutRaChieu);
                                    break;
                                }
                                if (diMuon > soPhutChoPhepDiMuon)
                                {
                                    tongDiMuon += diMuon;
                                    solan_dimuon++;
                                    dr["DI_MUON" + item["DAY"].ToString()] = diMuon > 60 ? ((diMuon / 60) + "").Split('.')[0] + "h" + (diMuon % 60) + "'" : diMuon + "'";
                                }
                            }
                            else if (thu == 0)  // chủ nhật
                            {
                                switch (HThucLamCN)
                                {
                                case "FULLTIME":
                                    diMuon = CalculateDiMuon(gioVaoSang, phutVaoSang, item["VAO"].ToString(), gioRaSang, phutRaSang, gioVaoChieu, phutVaoChieu, gioRaChieu, phutRaChieu);
                                    break;

                                case "LAM_SANG_NGHI_CHIEU":
                                    diMuon = CalculateDiMuon(gioVaoSang, phutVaoSang, item["VAO"].ToString(), gioRaSang, phutRaSang, int.Parse(item["VAO"].ToString().Split(':')[0]), int.Parse(item["VAO"].ToString().Split(':')[1]), int.Parse(item["VAO"].ToString().Split(':')[0]), int.Parse(item["VAO"].ToString().Split(':')[1]));
                                    break;

                                case "LAM_CHIEU_NGHI_SANG":
                                    diMuon = CalculateDiMuonChieu(gioVaoChieu, phutVaoChieu, item["VAO"].ToString(), gioRaSang, phutRaSang, gioVaoChieu, phutVaoChieu, gioRaChieu, phutRaChieu);
                                    break;
                                }
                                if (diMuon > soPhutChoPhepDiMuon)
                                {
                                    tongDiMuon += diMuon;
                                    solan_dimuon++;
                                    dr["DI_MUON" + item["DAY"].ToString()] = diMuon > 60 ? ((diMuon / 60) + "").Split('.')[0] + "h" + (diMuon % 60) + "'" : diMuon + "'";
                                }
                            }
                            else // ngày thường
                            {
                                diMuon = CalculateDiMuon(gioVaoSang, phutVaoSang, item["VAO"].ToString(), gioRaSang, phutRaSang, gioVaoChieu, phutVaoChieu, gioRaChieu, phutRaChieu);
                                if (diMuon > soPhutChoPhepDiMuon)
                                {
                                    tongDiMuon += diMuon;
                                    solan_dimuon++;
                                    dr["DI_MUON" + item["DAY"].ToString()] = diMuon > 60 ? ((diMuon / 60) + "").Split('.')[0] + "h" + (diMuon % 60) + "'" : diMuon + "'";
                                }
                            }
                        }

                        // Tính về sớm, làm thêm cuối giờ
                        if (item["RA"].ToString() != "")
                        {
                            int veSom = 0;
                            if (thu == 6)   // thứ 7
                            {
                                switch (HThucLamT7)
                                {
                                case "FULLTIME":
                                    veSom = CalculateVeSom(gioRaChieu, phutRaChieu, item["RA"].ToString(), gioRaSang, phutRaSang, gioVaoChieu, phutVaoChieu, gioVaoSang, phutVaoSang);
                                    break;

                                case "LAM_SANG_NGHI_CHIEU":
                                    veSom = CalculateVeSomSang(gioRaSang, phutRaSang, item["RA"].ToString(), gioRaSang, phutRaSang, gioVaoChieu, phutVaoChieu, gioVaoSang, phutVaoSang);
                                    break;

                                case "LAM_CHIEU_NGHI_SANG":
                                    veSom = CalculateVeSom(gioRaChieu, phutRaChieu, item["RA"].ToString(), int.Parse(item["RA"].ToString().Split(':')[0]), int.Parse(item["RA"].ToString().Split(':')[1]), gioVaoChieu, phutVaoChieu, int.Parse(item["RA"].ToString().Split(':')[0]), int.Parse(item["RA"].ToString().Split(':')[1]));
                                    break;
                                }
                                if (veSom > soPhutChoPhepVeSom)
                                {
                                    tongVeSom += veSom;
                                    solan_vesom++;
                                    dr["VE_SOM" + item["DAY"].ToString()] = veSom > 60 ? ((veSom / 60) + "").Split('.')[0] + "h" + (veSom % 60) + "'" : veSom + "'";
                                }
                            }
                            else if (thu == 0)  // chủ nhật
                            {
                                switch (HThucLamCN)
                                {
                                case "FULLTIME":
                                    veSom = CalculateVeSom(gioRaChieu, phutRaChieu, item["RA"].ToString(), gioRaSang, phutRaSang, gioVaoChieu, phutVaoChieu, gioVaoSang, phutVaoSang);
                                    break;

                                case "LAM_SANG_NGHI_CHIEU":
                                    veSom = CalculateVeSomSang(gioRaSang, phutRaSang, item["RA"].ToString(), gioRaSang, phutRaSang, gioVaoChieu, phutVaoChieu, gioVaoSang, phutVaoSang);
                                    break;

                                case "LAM_CHIEU_NGHI_SANG":
                                    veSom = CalculateVeSom(gioRaChieu, phutRaChieu, item["RA"].ToString(), int.Parse(item["RA"].ToString().Split(':')[0]), int.Parse(item["RA"].ToString().Split(':')[1]), gioVaoChieu, phutVaoChieu, int.Parse(item["RA"].ToString().Split(':')[0]), int.Parse(item["RA"].ToString().Split(':')[1]));
                                    break;
                                }
                                if (veSom > soPhutChoPhepVeSom)
                                {
                                    tongVeSom += veSom;
                                    solan_vesom++;
                                    dr["VE_SOM" + item["DAY"].ToString()] = veSom > 60 ? ((veSom / 60) + "").Split('.')[0] + "h" + (veSom % 60) + "'" : veSom + "'";
                                }
                            }
                            else// ngày thường
                            {
                                veSom = CalculateVeSom(gioRaChieu, phutRaChieu, item["RA"].ToString(), gioRaSang, phutRaSang, gioVaoChieu, phutVaoChieu, gioVaoSang, phutVaoSang);
                                if (veSom > soPhutChoPhepVeSom)
                                {
                                    tongVeSom += veSom;
                                    solan_vesom++;
                                    dr["VE_SOM" + item["DAY"].ToString()] = veSom > 60 ? ((veSom / 60) + "").Split('.')[0] + "h" + (veSom % 60) + "'" : veSom + "'";
                                }
                            }
                        }
                    }
                    i++;
                    if (i < maxLength)
                    {
                        item = data.Rows[i];
                    }
                    else
                    {
                        break;
                    }
                }
                if (tongDiMuon == 0 && tongVeSom == 0)
                {
                    continue;
                }
                dr["TONG_DIMUON"]  = tongDiMuon > 60 ? ((tongDiMuon / 60) + "").Split('.')[0] + "h" + (tongDiMuon % 60) + "'" : tongDiMuon + "'";
                dr["TONG_VESOM"]   = tongVeSom > 60 ? ((tongVeSom / 60) + "").Split('.')[0] + "h" + (tongVeSom % 60) + "'" : tongVeSom + "'";
                dr["SOLAN_DIMUON"] = solan_dimuon > 0 ? solan_dimuon + " lần" : "";
                dr["SOLAN_VESOM"]  = solan_vesom > 0 ? solan_vesom + " lần" : "";
                table.Rows.Add(dr);
                i--;
            }
        }
        return(table);
    }
Пример #25
0
    /// <summary>
    /// Reset mật khẩu người dùng
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void mnuResetPassword_Click(object sender, DirectEventArgs e)
    {
        string userid     = "";
        string failUserId = "";

        try
        {
            string[]      ds         = hdfListUserID.Text.Split(',');
            List <string> userIDList = new List <string>();
            for (int i = 0; i < ds.Count(); i++)
            {
                if (ds[i] != "")
                {
                    userIDList.Add(ds[i]);
                }
            }
            string mailContent    = Util.GetInstance().ReadFile(Server.MapPath("EmailHTML/ResetPassword.htm"));
            string systemName     = new HeThongController().GetValueByName(SystemConfigParameter.COMPANY_NAME, Session["MaDonVi"].ToString()).ToString();
            string systemEmail    = new HeThongController().GetValueByName(SystemConfigParameter.EMAIL, Session["MaDonVi"].ToString());
            string systemPassword = new HeThongController().GetValueByName(SystemConfigParameter.PASSWORD_EMAIL, Session["MaDonVi"].ToString());
            foreach (var item in userIDList)
            {
                string   password = Util.GetInstance().GetRandomString(7);
                UserInfo u        = UsersController.GetInstance().GetUser(int.Parse(item));
                if (Email.SendEmail(systemEmail, systemPassword, systemName, u.Email, "Thông báo mật khẩu mới", string.Format(mailContent, password, u.DisplayName)))
                {
                    u.Password = password;
                    UsersController.GetInstance().UpdateUser(u);
                    userid += item + ", ";
                }
                else
                {
                    failUserId += item + ", ";
                }
            }
            if (!string.IsNullOrEmpty(failUserId))
            {
                X.MessageBox.Alert("Thông báo", "Các mã tài khoản sau không đổi đổi được mật khẩu: " + failUserId).Show();
            }
            else
            {
                X.MessageBox.Alert("Thông báo", GlobalResourceManager.GetInstance().GetLanguageValue("ResetPasswordSuccess")).Show();
            }
            NhatkyTruycapInfo accessDiary = new NhatkyTruycapInfo()
            {
                CHUCNANG   = GlobalResourceManager.GetInstance().GetHistoryAccessValue("ResetPassword"),
                MOTA       = GlobalResourceManager.GetInstance().GetHistoryAccessValue("ResetPassword"),
                IsError    = false,
                USERNAME   = CurrentUser.UserName,
                THOIGIAN   = DateTime.Now,
                MANGHIEPVU = "Users",
                TENMAY     = Util.GetInstance().GetComputerName(Request.UserHostAddress),
                IPMAY      = Request.UserHostAddress,
                THAMCHIEU  = "Các UserId bị reset mật khẩu : " + userid,
            };
            new SoftCore.AccessHistory.AccessHistoryController().AddAccessHistory(accessDiary);
        }
        catch (Exception ex)
        {
            NhatkyTruycapInfo accessDiary = new NhatkyTruycapInfo()
            {
                CHUCNANG   = GlobalResourceManager.GetInstance().GetHistoryAccessValue("ResetPassword"),
                MOTA       = ex.Message.Replace("'", " "),
                IsError    = true,
                USERNAME   = CurrentUser.UserName,
                THOIGIAN   = DateTime.Now,
                MANGHIEPVU = "Users",
                TENMAY     = Util.GetInstance().GetComputerName(Request.UserHostAddress),
                IPMAY      = Request.UserHostAddress,
                THAMCHIEU  = "Các UserId bị reset mật khẩu : " + userid,
            };
            new SoftCore.AccessHistory.AccessHistoryController().AddAccessHistory(accessDiary);
            Dialog.ShowNotification(GlobalResourceManager.GetInstance().GetErrorMessageValue("DefaultErrorMessage"));
        }
    }
Пример #26
0
    public void BindData(string prkey, string madonvi)
    {
        this.PaperKind = System.Drawing.Printing.PaperKind.Letter;
        DataTable dt = DataController.DataHandler.GetInstance().ExecuteDataTable("GetNhanSuChiTiet", "@Id", prkey);

        this.xrpAvatar.Borders = BorderSide.All;
        if (dt.Rows.Count <= 0)
        {
            return;
        }
        if (!string.IsNullOrEmpty(dt.Rows[0]["PHOTO"].ToString()))
        {
            xrpAvatar.ImageUrl = dt.Rows[0]["PHOTO"].ToString();
            xrpAvatar.Sizing   = ImageSizeMode.StretchImage;
        }
        else
        {
            xrpAvatar.ImageUrl = "~/Resource/images/Anh34default.jpg";
            xrpAvatar.Sizing   = ImageSizeMode.StretchImage;

            //  xrpAvatar.Borders = ((DevExpress.XtraPrinting.BorderSide)((((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Top)
            //| DevExpress.XtraPrinting.BorderSide.Right)
            //| DevExpress.XtraPrinting.BorderSide.Bottom)));
            //  xrpAvatar.Sizing = ImageSizeMode.StretchImage;
        }

        var ht = new HeThongController();


        xrLabel1.Text = ht.GetValueByName(SystemConfigParameter.COMPANY_NAME, madonvi).ToUpper();
        xrLabel2.Text = ht.GetValueByName(SystemConfigParameter.COMPANY_ADDRESS, madonvi);
        if (xrLabel2.Text != "")
        {
            xrLabel2.Text = "Địa chỉ: " + xrLabel2.Text;
        }
        xrLabel3.Text = ht.GetValueByName(SystemConfigParameter.COMPANY_DIENTHOAI, madonvi);
        if (xrLabel3.Text != "")
        {
            xrLabel3.Text = "Tel: " + xrLabel3.Text;
        }
        xrLabel5.Text = ht.GetValueByName(SystemConfigParameter.COMPANY_FAX, madonvi);
        if (xrLabel5.Text != "")
        {
            xrLabel5.Text = "Fax: " + xrLabel5.Text;
        }
        //xrLabel2.Text = ht.GetValueByName(SystemConfigParameter., rp.MaDonVi);// địa chỉ trang web
        xrLabel7.Text = ht.GetValueByName(SystemConfigParameter.COMPANY_EMAIL, madonvi);
        if (xrLabel7.Text != "")
        {
            xrLabel7.Text = "Email: " + xrLabel7.Text;
        }


        xrlHoTen.Text = (dt.Rows[0]["TEN_CHUCVU"].ToString().ToUpper() != "" ? dt.Rows[0]["TEN_CHUCVU"].ToString().ToUpper() + " : " : "") + dt.Rows[0]["HO_TEN"].ToString().ToUpper();
        //xrPictureBox1.SizeF = new SizeF(160F, 120F);
        xrlGioiTinh.Text   = dt.Rows[0]["GioiTinh"].ToString();
        xrlSoCMND.Text     = dt.Rows[0]["SO_CMND"].ToString();
        xrTableCell6.Text  = dt.Rows[0]["NGAY_SINH"].ToString();
        xrTableCell18.Text = dt.Rows[0]["NGAYCAP_CMND"].ToString();
        xrTableCell8.Text  = dt.Rows[0]["HO_KHAU"].ToString();
        xrTableCell10.Text = dt.Rows[0]["DIA_CHI_LH"].ToString();
        xrTableCell22.Text = dt.Rows[0]["TEN_NOICAP_CMND"].ToString();
        xrTableCell20.Text = dt.Rows[0]["DI_DONG"].ToString();
        xrTableCell12.Text = dt.Rows[0]["TEN_TRINHDO"].ToString();
        xrTableCell4.Text  = dt.Rows[0]["TEN_TRUONG_DAOTAO"].ToString();
        xrTableCell14.Text = dt.Rows[0]["TEN_CHUYENNGANH"].ToString();
        xrTableCell24.Text = dt.Rows[0]["MST_CANHAN"].ToString();
        xrTableCell26.Text = dt.Rows[0]["SOTHE_BHXH"].ToString();
        xrTableCell28.Text = dt.Rows[0]["SO_TAI_KHOAN"].ToString();
        xrTableCell30.Text = dt.Rows[0]["EMAIL"].ToString();
        xrLabel13.Text     = dt.Rows[0]["MA_CONGTRINH"].ToString();
        rpwgSub_GiaDinh1.BinData(prkey, madonvi);
        rpwgSub_KinhNghiemCongTac1.BinData(prkey, madonvi);
        rpwgSub_QuaTrinhLamViec1.BinData(prkey, madonvi);
        rpwgSub_KhenThuongKyLuat1.BinData(prkey, madonvi);
    }
Пример #27
0
    public void BindData(ReportFilterQuyetDinhLuong filter)
    {
        // get salary dicision by prkeyHoSo
        string tenTP = new HeThongController().GetValueByName(SystemConfigParameter.CITY, filter.MaDonVi);
        string tenDV = new DM_DONVIController().GetNameById(filter.MaDonVi);

        xrt_ngayketxuat.Text = tenTP + ", ngày " + DateTime.Now.Day + " tháng " + DateTime.Now.Month + " năm " + DateTime.Now.Year;

        DataTable salaryDecision = DataController.DataHandler.GetInstance().ExecuteDataTable("sp_GetSalaryDecisionByID", "@ID", filter.ID);
        double    totalSalary    = 0;

        if (salaryDecision.Rows.Count > 0)
        {
            xrlSoQuyetDinh.Text = "Số: " + salaryDecision.Rows[0]["SoQuyetDinh"];
            xrlTitle.Text       = xrlTitle.Text.Replace("{1}", salaryDecision.Rows[0]["HO_TEN"].ToString());
            xrlTitle.Text       = xrlTitle.Text.Replace("{2}", salaryDecision.Rows[0]["MA_CB"].ToString());
            xrlCanCu.Text       = xrlCanCu.Text.Replace("{3}", tenDV);
            xrlXepLuongVoi.Text = xrlXepLuongVoi.Text.Replace("{4}", salaryDecision.Rows[0]["HO_TEN"].ToString());
            xrlChucDanh.Text    = salaryDecision.Rows[0]["TEN_CHUCVU"].ToString();
            xrlPhongBan.Text    = xrlPhongBan.Text.Replace("{7}", salaryDecision.Rows[0]["TEN_DONVI"].ToString());
            xrlNgach.Text       = salaryDecision.Rows[0]["TEN_NGACH"].ToString();
            xrlBacLuong.Text    = salaryDecision.Rows[0]["BacLuong"].ToString();
            xrlHeSoLuong.Text   = salaryDecision.Rows[0]["HeSoLuong"].ToString();
            if (!Convert.IsDBNull(salaryDecision.Rows[0]["LuongCung"]))
            {
                double tmp = Convert.ToDouble(salaryDecision.Rows[0]["LuongCung"]);
                if (tmp > 0)
                {
                    totalSalary += tmp;
                }
                xrlMucLuong.Text = Convert.ToDecimal(salaryDecision.Rows[0]["LuongCung"]).ToString("n0") + " VND";
            }
            else
            {
                xrlMucLuong.Text = "";
            }
            if (!Convert.IsDBNull(salaryDecision.Rows[0]["LuongDongBHXH"]))
            {
                double tmp = Convert.ToDouble(salaryDecision.Rows[0]["LuongDongBHXH"]);
                if (tmp > 0)
                {
                    totalSalary -= tmp;
                }
                xrlLuongDongBH.Text = Convert.ToDecimal(salaryDecision.Rows[0]["LuongDongBHXH"]).ToString("n0") + " VND";
            }
            else
            {
                xrlLuongDongBH.Text = "";
            }
            xrlBacLuongNB.Text = salaryDecision.Rows[0]["BacLuongNB"].ToString();

            xrNoiDungQD.Text = xrNoiDungQD.Text.Replace("{14}", tenDV);
            string ngayHL = salaryDecision.Rows[0]["NgayHieuLuc"].ToString();
            if (!string.IsNullOrEmpty(ngayHL))
            {
                xrNoiDungQD.Text = xrNoiDungQD.Text.Replace("{15}", string.Format("{0:dd/MM/yyyy}", DateTime.Parse(ngayHL)));
            }
            else
            {
                xrNoiDungQD.Text = xrNoiDungQD.Text.Replace("{15}", ".....");
            }
            string ngayHLNB = salaryDecision.Rows[0]["NgayHuongLuongNB"].ToString();
            if (!string.IsNullOrEmpty(ngayHLNB))
            {
                xrNoiDungQD.Text = xrNoiDungQD.Text.Replace("{16}", string.Format("{0:dd/MM/yyyy}", DateTime.Parse(ngayHLNB)));
            }
            else
            {
                xrNoiDungQD.Text = xrNoiDungQD.Text.Replace("{16}", ".....");
            }
            xrNoiDungQD.Text = xrNoiDungQD.Text.Replace("{18}", salaryDecision.Rows[0]["HO_TEN"].ToString());

            xrlNoiNhan.Text = xrlNoiNhan.Text.Replace("{19}", salaryDecision.Rows[0]["HO_TEN"].ToString());
        }

        DataTable phucapInformation = DataController.DataHandler.GetInstance().ExecuteDataTable("sp_GetPhuCapByPrkeyHoSoLuong", "@PrkeyHoSoLuong", filter.ID);

        foreach (DataRow item in phucapInformation.Rows)
        {
            if (!Convert.IsDBNull(item["SoTien"]))
            {
                double tmp = Convert.ToDouble(item["SoTien"]);
                if (tmp > 0)
                {
                    totalSalary += tmp;
                }
            }
        }
        xrlThuNhapGop.Text = xrlThuNhapGop.Text.Replace("{8}", string.Format("{0:n0} VND", totalSalary));

        DataSource = phucapInformation;
        xrt_tenphucap.DataBindings.Add("Text", DataSource, "Ten", "+ {0}");
        xrt_tien.DataBindings.Add("Text", DataSource, "SoTien", "{0:n0} VND");
    }