コード例 #1
0
 protected void btnCapNhatQuyTac_Click(object sender, DirectEventArgs e)
 {
     try
     {
         DAL.QuyTacLamThemGio quyTac = new DAL.QuyTacLamThemGio();
         if (e.ExtraParams["Command"] == "Edit")
         {
             quyTac = new QuyTacLamThemGioController().GetByID(int.Parse("0" + hdfIDQuyTac.Text));
         }
         quyTac.TuGio  = GetTime(tfTuGio.Text);
         quyTac.DenGio = GetTime(tfDenGio.Text);
         if (cbxLoaiNgay.SelectedItem.Value != null)
         {
             quyTac.LoaiNgay = cbxLoaiNgay.SelectedItem.Value;
         }
         if (txtHeSoLuong.Text != "")
         {
             quyTac.NhanHeSo = decimal.Parse("0" + txtHeSoLuong.Text.Replace('.', ','));
         }
         //if (hdfQuyTacFrMaCa.Text != "")
         //    quyTac.FrMaCa = int.Parse(hdfQuyTacFrMaCa.Text);
         //else
         //    quyTac.FrMaCa = int.Parse(cbxQuyTacChonCaLamViec.SelectedItem.Value);
         quyTac.MaCa        = e.ExtraParams["MaCa"].ToString();
         quyTac.CreatedBy   = CurrentUser.ID;
         quyTac.CreatedDate = DateTime.Now;
         quyTac.Order       = int.Parse("0" + txtOrder.Text);
         if (e.ExtraParams["Command"] == "Edit")
         {
             new QuyTacLamThemGioController().Update(quyTac);
             Dialog.ShowNotification("Cập nhật dữ liệu thành công");
             ResourceManager1.RegisterClientScriptBlock("rlst1", "#{wdQuyTacLamThemGio}.hide(); #{grp_QuyTacLamThemGio}.reload();");
         }
         else
         {
             new QuyTacLamThemGioController().Insert(quyTac);
             Dialog.ShowNotification("Thêm mới dữ liệu thành công");
             ResourceManager1.RegisterClientScriptBlock("rlst2", "#{grp_QuyTacLamThemGio}.reload();");
         }
         if (e.ExtraParams["Closed"] == "True")
         {
             wdQuyTacLamThemGio.Hide();
         }
         else
         {
             ResourceManager1.RegisterClientScriptBlock("rlst4", "ResetQuyTacLamThemGio();");
         }
     }
     catch (Exception ex)
     {
         X.Msg.Alert("Thông báo", "Có lỗi xảy ra: " + ex.Message).Show();
     }
 }
コード例 #2
0
    protected void btnAddFunction_Click(object sender, DirectEventArgs e)
    {
        try
        {
            FunctionInfo info = new FunctionInfo()
            {
                ControlText = txtControlText.Text,
                Description = txtDescription.Text,
                MenuID      = int.Parse(hdfTreeNodeID.Text),
                ParentID    = int.Parse(cbxChucNangCha.SelectedItem.Value.ToString())
            };
            FunctionController.GetInstance().CreateFunction(info);
            if (e.ExtraParams["Continue"] == "No")
            {
                wdFunction.Hide();
            }

            if (string.IsNullOrEmpty(hdfRoleID.Text) == false || AjaxSearchUser.GetValue() != null)
            {
                Dialog.ShowNotification(GlobalResourceManager.GetInstance().GetLanguageValue("SetPermissionSuccess"));
            }
            else
            {
                Dialog.ShowNotification(GlobalResourceManager.GetInstance().GetLanguageValue("AddFunctionSuccess"));
            }
            ResourceManager1.RegisterClientScriptBlock("ds", "resetWdFunction();");
        }
        catch (Exception ex)
        {
            Dialog.ShowError(GlobalResourceManager.GetInstance().GetErrorMessageValue("DefaultErrorMessage"));

            NhatkyTruycapInfo accessDiary = new NhatkyTruycapInfo()
            {
                CHUCNANG   = GlobalResourceManager.GetInstance().GetHistoryAccessValue("AddFunction") + " Default/btnAddFunction_Click",
                MOTA       = ex.Message.Replace("'", " "),
                IsError    = true,
                USERNAME   = CurrentUser.UserName,
                THOIGIAN   = DateTime.Now,
                MANGHIEPVU = "Functions",
                TENMAY     = Util.GetInstance().GetComputerName(Request.UserHostAddress),
                IPMAY      = Request.UserHostAddress,
                THAMCHIEU  = "",
            };
            new SoftCore.AccessHistory.AccessHistoryController().AddAccessHistory(accessDiary);
        }
    }
コード例 #3
0
    /// <summary>
    /// Hiện form để sắp xếp lại thứ tự của menu panel
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void mnuOrder_Click(object sender, DirectEventArgs e)
    {
        List <MenuInfo> MenuPanelList = MenuController.GetInstance().GetMenus(-1, false, true);
        string          menuStr       = "";

        foreach (MenuInfo menu in MenuPanelList)
        {
            menuStr = string.Concat(menuStr, string.Format("<li id='{0}'>{1}</li>", menu.ID.ToString(), menu.MenuName));
        }
        string output = @" <div class='demo'>
                            <ul id='sortable'>
                             {0}
                            </ul>
                        </div>";

        string script = @" $(function () {
                                $('#sortable').sortable();
                                $('#sortable').disableSelection();
                            });";

        lblOutput.Html = string.Format(output, menuStr);
        wdSortAscending.Show();
        ResourceManager1.RegisterClientScriptBlock("load", script);
    }
コード例 #4
0
    protected void btnCapNhat_Click(object sender, DirectEventArgs e)
    {
        try
        {
            LinqProvider         linq         = new LinqProvider();
            DanhSachCaController dsController = new DanhSachCaController();
            DAL.DanhSachCa       ca           = new DAL.DanhSachCa();
            if (e.ExtraParams["Command"] == "Edit")
            {
                ca = linq.GetDataContext().DanhSachCas.Where(t => t.ID == int.Parse(hdfRecordID.Text)).FirstOrDefault();
            }
            else
            {
                string lyDo = "";
                if (KiemTraTrungNgayNghiLe(txtMaCa.Text, ref lyDo))
                {
                    X.Msg.Alert("Thông báo từ hệ thống", lyDo + " Vui lòng nhập mã ca khác!").Show();
                    return;
                }
            }
            ca.MaCa  = txtMaCa.Text;
            ca.TenCa = txtTenCa.Text;
            if (txtPhuCapCa.Text != "")
            {
                ca.PhuCapCa = double.Parse(txtPhuCapCa.Text.Replace('.', ','));
            }
            if (txtLuongCuaCa.Text != "")
            {
                ca.TienLuongCa = double.Parse(txtLuongCuaCa.Text.Replace('.', ','));
            }
            if (txtTongSoGio.Text != "")
            {
                ca.TongGio = double.Parse(txtTongSoGio.Text.Replace('.', ','));
            }
            ca.LoaiCa = int.Parse("0" + hdfLoaiCa.Text);
            //   ca.NgayApDung = cbxNgayApDung.SelectedItem.Value;
            //
            ca.GioVao     = GetTime(tfBatDauCa.Text);
            ca.GioRa      = GetTime(tfKetThucCaSau.Text);
            ca.NghiGiuaCa = GetTime(tfNghiNuaCaDau.Text);
            ca.VaoGiuaCa  = GetTime(tfBatDauCaSau.Text);
            //ca.BatDauTinhLamThemDauGio = GetTime(tfBatDauLamThemDauGio.Text);
            //ca.BatDauTinhLamThemCuoiGio = GetTime(tfBatDauLamThemCuoiGio.Text);
            //
            ca.RaNgoaiKhongBiTruGio = chkRaNgoaiKhongBiTruGio.Checked;
            //
            ca.BatDauQuetTheLan1  = GetTime(tfDauCaTu.Text);
            ca.KetThucQuetTheLan1 = GetTime(tfDauCaDen.Text);
            ca.BatDauQuetTheLan2  = GetTime(tfGiuaCaRaTu.Text);
            ca.KetThucQuetTheLan2 = GetTime(tfGiuaCaRaDen.Text);
            ca.BatDauQuetTheLan3  = GetTime(tfGiuaCaVaoTu.Text);
            ca.KetThucQuetTheLan3 = GetTime(tfGiuaCaVaoDen.Text);
            ca.BatDauQuetTheLan4  = GetTime(tfCuoiCaTu.Text);
            ca.KetThucQuetTheLan4 = GetTime(tfCuoiCaDen.Text);
            //
            //if (!SoftCore.Util.GetInstance().IsDateNull(dfApDungTu.SelectedDate))
            //    ca.ThoiGianApDungTu = dfApDungTu.SelectedDate;
            //if (!SoftCore.Util.GetInstance().IsDateNull(dfApDungDen.SelectedDate))
            //    ca.ThoiGianApDungDen = dfApDungDen.SelectedDate;
            //
            if (txtSoPhutChoPhepDiMuon.Text != "")
            {
                ca.SoPhutChoPhepDiMuon = double.Parse(txtSoPhutChoPhepDiMuon.Text);
            }
            if (txtSoPhutChoPhepVeSom.Text != "")
            {
                ca.SoPhutChoPhepVeSom = double.Parse(txtSoPhutChoPhepVeSom.Text);
            }
            ca.DangSuDung = chkDangSuDung.Checked;
            //
            ca.MaDonVi     = Session["MaDonVi"].ToString();
            ca.CreatedBy   = CurrentUser.ID;
            ca.CreatedDate = DateTime.Now;

            if (e.ExtraParams["Command"] == "Edit")
            {
                ca.ID = int.Parse(hdfRecordID.Text);
                dsController.Update(ca);
                Dialog.ShowNotification("Cập nhật dữ liệu thành công!");
                grp_DanhSachCa.Reload();
                wdThemCaLamViec.Hide();
            }
            else
            {
                DAL.DanhSachCa tmp = dsController.GetOneByMaCa(ca.MaCa);
                if (tmp != null)
                {
                    X.Msg.Alert("Thông báo", "Mã ca đã tồn tại. Vui lòng nhập mã ca khác!").Show();
                    return;
                }
                dsController.Insert(ca);
                Dialog.ShowNotification("Thêm mới thành công ca!");
                grp_DanhSachCa.Reload();
            }
            if (e.ExtraParams["Closed"] == "True")
            {
                wdThemCaLamViec.Hide();
            }
            else
            {
                ResourceManager1.RegisterClientScriptBlock("rl1f", "resetForm();");
            }
        }
        catch (Exception ex)
        {
            X.Msg.Alert("Thông báo", "Có lỗi xảy ra: " + ex.Message).Show();
        }
    }
コード例 #5
0
 private void ReloadStore()
 {
     ResourceManager1.RegisterClientScriptBlock("d", "#{Store1}.reload();");
 }
コード例 #6
0
    protected void btnAddUser_Click(object sender, DirectEventArgs e)
    {
        try
        {
            UsersController uController = new UsersController();
            UserInfo        uInfo       = new UserInfo()
            {
                Address     = txtAddress.Text,
                CreatedBy   = CurrentUser.ID,
                CreatedOn   = DateTime.Now,
                DisplayName = txtDisplayName.Text.Trim(),
                EdittedBy   = CurrentUser.ID,
                EdittedOn   = DateTime.Now,
                Email       = txtEmail.Text,
                FirstName   = txtFirstName.Text,
                Gender      = rdNam.Checked,
                UserName    = txtUserName.Text,
                IsLock      = false,
                IsSuperUser = false,
                LastName    = txtLastName.Text,
                Phone       = txtPhone.Text,
                Password    = txtPassword.Text
            };
            if (!dfBirthday.SelectedDate.ToString().Contains("0001"))
            {
                uInfo.Birthday = dfBirthday.SelectedDate;
            }
            else
            {
                uInfo.Birthday = new DateTime(1900, 1, 1);
            }
            //Insert
            if (e.ExtraParams["Command"] != "Update")
            {
                int userID = uController.CreateUser(uInfo);
                // new DM_DONVIController().AddUserIntoDonVi(Session["MaDonVi"].ToString(), userID);
                new DM_DONVIController().AddUserIntoDonVi(hdfSelectedDepartmentID.Text, userID);
                Dialog.ShowNotification("Thêm mới tài khoản thành công");
            }
            else
            {
                uInfo.Password = "";
                uInfo.ID       = int.Parse(hdfRecordID.Text);
                uController.UpdateUser(uInfo);
                new DM_DONVIController().UpdateUserIntoDonVi(hdfSelectedDepartmentID.Text, uInfo.ID);
                Dialog.ShowNotification("Cập nhật tài khoản thành công");
            }
            GridPanel1.Reload();
            if (!string.IsNullOrEmpty(txtEmail.Text) && chkSendMail.Checked)
            {
                sendEmailCreateAccount(uInfo);
            }

            if (e.ExtraParams["Close"] == "True")
            {
                wdAddUser.Hide();
            }
            else
            {
                ResourceManager1.RegisterClientScriptBlock("resetForm", "resetForm();");
            }
        }
        catch (SqlException sqlex)
        {
            switch (sqlex.Number)
            {
            case 2627:
                X.MessageBox.Alert("Có lỗi xảy ra", "Tài khoản này đã tồn tại, bạn vui lòng chọn tài khoản khác").Show();
                break;

            default:
                X.MessageBox.Alert("Có lỗi xảy ra", sqlex.Message).Show();
                break;
            }
        }
        catch (Exception ex)
        {
            X.MessageBox.Alert("Có lỗi xảy ra", ex.Message).Show();
        }
    }