Пример #1
0
        private void btnPush_Click(object sender, EventArgs e)
        {
            if (txtBrowserSave.Text != "")
            {
                Loading_FS.text = "\tĐang tạo người dùng ...";
                Loading_FS.ShowSplash();
                using (StreamWriter streamWriter = new StreamWriter(directoryPath + "/Api-Patron-Log-" + tool.getDate() + ".txt"))
                {
                    foreach (StringBuilder item in DataDBLocal.listStringBuilder)
                    {
                        streamWriter.WriteLine(new AlephUploadPatronAPI().Url(item.ToString()));
                    }
                }
                //xuất ra danh sách patronid và patronbarcode để chuyển tên ảnh bạn đọc
                ExportDanhSachTT();
                Loading_FS.CloseSplash();
                MessageBox.Show("Tạo người thành công!", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                Loading_FS.text = "\tĐang cập nhập lại dữ liệu ...";
                Loading_FS.ShowSplash();
                ResetForm();
                Loading_FS.CloseSplash();
                MessageBox.Show("Cập nhập dữ liệu thành công!", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                MessageBox.Show("Chưa chọn đường dẫn lưu !", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }
Пример #2
0
 private void btnConvert_Click(object sender, EventArgs e)
 {
     Loading_FS.text = "\tĐang đưa dữ liệu ...";
     Loading_FS.ShowSplash();
     ChangeName();
     Loading_FS.CloseSplash();
     MessageBox.Show("Thành công!", "Thông báo!");
 }
Пример #3
0
 private void CreatePatron()
 {
     Loading_FS.text = "\tĐang đưa dữ liệu ...";
     Loading_FS.ShowSplash();
     using (StreamWriter streamWriter = new StreamWriter(directoryPath + "/Api-Patron-Log-" + tool.getDate() + ".txt"))
     {
         streamWriter.WriteLine(new AlephAPI().Url(sb.ToString()));
     }
     using (StreamWriter streamWriter2 = new StreamWriter(directoryPath + "/Ldap-Log-" + tool.getDate() + ".txt"))
     {
         streamWriter2.WriteLine(u.userLogin + "\t" + new ModelLdap().CreateUser(u));
     }
     Loading_FS.CloseSplash();
     MessageBox.Show("Thành công!", "Thông báo!");
 }
Пример #4
0
 private void LoadForm()
 {
     try
     {
         Loading_FS.text = "\tĐang cập nhập dữ liệu...";
         Loading_FS.ShowSplash();
         CloneList();
         LoadData();
         CreateFolder(directoryPath);
         CheckDataGridView(dgvAleph, lbCountListExcel);
         CheckDataGridView(dgvLdap, lbCountHad);
         Loading_FS.CloseSplash();
         panel1.Visible = true;
     }
     catch (Exception ex)
     {
         Loading_FS.CloseSplash();
         MessageBox.Show("Lỗi không mong muốn !\n" + ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     }
 }
Пример #5
0
        private void RequestApiUpdate()
        {
            statusResult = 0;
            string block     = (comboBox1.SelectedItem as ComboboxItem).Value.ToString();
            string blockName = (comboBox1.SelectedItem as ComboboxItem).Text;

            List <PatronEntity> ListAlreadyExists = DataDBLocal.ListAlreadyExists.CloneObject();

            DialogResult dialogResult = MessageBox.Show("Bạn có chắc chắn " + blockName + " không ?", "Thông báo", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                try
                {
                    Loading_FS.text = "\tĐang cập nhập dữ liệu ...";
                    Loading_FS.ShowSplash();
                    using (StreamWriter streamWriter = new StreamWriter(directoryPath + "\\" + "logUpdate" + new ToolP().getDate() + ".txt"))
                    {
                        foreach (PatronEntity patron in ListAlreadyExists)
                        {
                            streamWriter.WriteLine(new AlephUploadPatronAPI().Url(new SBApiAleph().sbPatronApi(patron.MaSV_O, block).ToString()));
                        }
                        statusResult = 1;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error: \n" + ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    log.Error(ex.Message);
                }
                finally
                {
                    Loading_FS.CloseSplash();
                }
                if (statusResult == 1)
                {
                    MessageBox.Show("Cập nhập thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Пример #6
0
        private void WriterUserLdap()
        {
            if (txtMa.Text == "")
            {
                MessageBox.Show("Không thể để trống mã!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }
            if (string.IsNullOrWhiteSpace(txtPassword.Text.Trim()))
            {
                MessageBox.Show("Không thể để trống mật khẩu !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }
            User user = new User();

            user.cn              = txtMa.Text.Trim();
            user.sn              = txtMa.Text.Trim();
            user.userLogin       = txtMa.Text.Trim();
            user.userMail        = txtEmail.Text.Trim();
            user.telephoneNumber = txtPhone.Text.Trim();
            user.userPassword    = txtPassword.Text.Trim();
            user.objectClass     = "OpenLDAPPerson";
            using (StreamWriter streamWriter = new StreamWriter(directoryPath + "/Ldap-Log-" + tool.getDate() + ".txt"))
            {
                streamWriter.WriteLine(user.userLogin + "\t" + new ModelLdap().CreateUser(user));
            }
            try
            {
                Loading_FS.text = "\tĐang tạo người dùng...";
                Loading_FS.ShowSplash();
                LoadData();
                Loading_FS.CloseSplash();
                MessageBox.Show("Thành công!", "Thông báo!");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Lỗi !" + ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #7
0
        private void ChangeName()
        {
            if (list == null)
            {
                readTxt();
            }
            int num = 0;

            num = list.Count;
            if (files == null)
            {
                return;
            }
            string text  = "";
            string text2 = "";
            int    num2  = 0;
            int    num3  = 0;
            int    num4  = 0;

            Loading_FS.ShowSplash();
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            for (int i = 0; i < files.Length; i++)
            {
                text = files[i];
                int    num5  = text.LastIndexOf("\\");
                string text3 = text.Substring(num5 + 1);
                if (!text3.Contains("."))
                {
                    continue;
                }
                text3 = text3.Substring(0, text3.LastIndexOf("."));
                string text4 = text.Substring(num5 + 1).Substring(text.Substring(num5 + 1).LastIndexOf("."));
                for (int j = 0; j < num; j++)
                {
                    string str   = list[j].id.ToString();
                    string text5 = list[j].barcode.ToString();
                    if (text5.Trim().ToUpper().Equals(text3.ToUpper()))
                    {
                        try
                        {
                            if (num3 == 1000)
                            {
                                num3 = 0;
                                num4++;
                            }
                            string text6 = src + "\\Converter\\pic" + num4;
                            if (!Directory.Exists(text6))
                            {
                                Directory.CreateDirectory(text6);
                            }
                            text2 = text6 + "\\" + str + ".jpg";
                            File.Move(text, text2);
                            num3++; num2++;
                        }
                        catch (Exception ex)
                        {
                            log.Error(ex.Message);
                            continue;
                        }
                        break;
                    }
                }
            }
            stopwatch.Stop();
            Loading_FS.CloseSplash();
            MessageBox.Show("Thành công: " + num2 + "\nTime: " + stopwatch.Elapsed.ToString() + "s", "Thông báo!");
            files = null;
            loadItems(lb_showDirectory);
        }