Esempio n. 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Loginfrm frm = new Loginfrm(string.Empty);
            frm.ShowDialog();

            if (!frm.IsLogedIn)
                this.Close();

            ExecutiveName = frm.ExecutiveName;
        }
Esempio n. 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Loginfrm frm = new Loginfrm(new UserDetail());
            frm.ShowDialog();

            if (!frm.IsLogedIn)
            {
                this.Close();
                return;
            }

            UserDetail = frm.UserDetail;
            _moduleList.AddRange(UserDetail.Modules.Split(','));
        }
Esempio n. 3
0
        private void btnDeleteForever_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count < 1)
                return;

            var srNos = new List<long>();
            for (int i = 0; i < dataGridView1.SelectedRows.Count; i++)
            {
                srNos.Add(Convert.ToInt64(dataGridView1.SelectedRows[i].Cells["SrNo"].Value));
            }

            var result = MessageBox.Show(string.Format("Do you Delete Forever SrNos : {0}",
                                            string.Join(",", srNos.Select(x => x.ToString()).ToArray())),
                                                                        "Delete Alert", MessageBoxButtons.YesNo);

            if (result != DialogResult.Yes)
                return;

            if (HomePage.UserDetail.UserId != "admin")
            {
                MessageBox.Show(@"Only admin can delete data", @"Authentication Error", MessageBoxButtons.OK);
                return;
            }

            // ask for password
            Loginfrm frm = new Loginfrm(HomePage.UserDetail);
            frm.ShowDialog();
            if (!frm.IsLogedIn)
                return;

            // delete forever candidate
            var candidates = uniDb.CandidateDetails.Where(x => srNos.Contains(x.SrNo)).ToList();

            uniDb.CandidateDetails.DeleteAllOnSubmit(candidates);
            uniDb.SubmitChanges();

            uniDb.Refresh(System.Data.Linq.RefreshMode.KeepChanges);
            BindGridView();
        }
Esempio n. 4
0
        private void buttonRestore_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count < 1)
                return;

            var srNos = new List<long>();
            for (int i = 0; i < dataGridView1.SelectedRows.Count; i++)
            {
                srNos.Add(Convert.ToInt64(dataGridView1.SelectedRows[i].Cells["SrNo"].Value));
            }

            var result = MessageBox.Show(string.Format("Do you want to Restore SrNos : {0}",
                                            string.Join(",", srNos.Select(x => x.ToString()).ToArray())),
                                                                        "Restore Alert", MessageBoxButtons.YesNo);

            if (result != DialogResult.Yes)
                return;

            // ask for password
            Loginfrm frm = new Loginfrm(HomePage.ExecutiveName);
            frm.ShowDialog();
            if (!frm.IsLogedIn)
                return;

            // restore candidate
            var candidates = uniDb.CandidateDetails.Where(x => srNos.Contains(x.SrNo)).ToList();

            foreach (var candidate in candidates)
            {
                candidate.IsDeleted = false;
                candidate.ExecutiveName = HomePage.ExecutiveName;
            }
            uniDb.SubmitChanges();

            uniDb.Refresh(System.Data.Linq.RefreshMode.KeepChanges);
            BindGridView();
        }
Esempio n. 5
0
        private void toolStripComboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            // ask for password
            var frmLogin = new Loginfrm(HomePage.UserDetail);
            frmLogin.ShowDialog();

            if (!frmLogin.IsLogedIn)
                return;

            var selectedSrNos = _reportForm.GetSelectedSrNo();
            var uniDb = new UniDBDataContext();
            var selectedCustomers = uniDb.CustomerDetails.Where(x => selectedSrNos.Contains(x.SrNo));
            //uniDb.CustomerDetails.DeleteAllOnSubmit(selectedCustomers);

            if (toolStripComboBox1.Text != UniEnums.CompanyType.Customer.ToString())
            {
                var query = uniDb.VendorDetails.Where(x => x.VendorType == toolStripComboBox1.Text);
                var srNo = query.Any() ? query.Max(c => c.SrNo) : 0;

                var newVendors = new List<VendorDetail>();
                foreach (var customer in selectedCustomers)
                {
                    srNo++;
                    newVendors.Add(new VendorDetail()
                    {
                        SrNo = srNo,
                        AnnualTurnover = customer.AnnualTurnover,
                        BusinessType = customer.BusinessType,
                        CompanyName = customer.CompanyName,
                        ContactPerson = customer.ContactPerson,
                        Email = customer.Email,
                        EstablishedYear = customer.EstablishedYear,
                        ExecutiveName = customer.ExecutiveName,
                        Expert = customer.Expert,
                        FactoryAddress = customer.FactoryAddress,
                        IsDeleted = customer.IsDeleted,
                        MobileNo = customer.MobileNo,
                        Networking = customer.Networking,
                        NoOfEmployees = customer.NoOfEmployees,
                        Note = customer.Note,
                        OfficeAddress = customer.OfficeAddress,
                        PhoneNo = customer.PhoneNo,
                        ProcessedDate = customer.ProcessedDate,
                        Profile1 = customer.Profile1,
                        Profile2 = customer.Profile2,
                        Sector = customer.Sector,
                        Source = customer.Source,
                        Website = customer.Website,
                        VendorType = toolStripComboBox1.Text,
                    });
                    uniDb.VendorDetails.InsertAllOnSubmit(newVendors);
                }
            }
            else
            {
                var srNo = uniDb.CustomerDetails.Any(c => c.CompanyType == UniEnums.CompanyType.Customer.ToString())
                            ? uniDb.CustomerDetails.Where(c => c.CompanyType == UniEnums.CompanyType.Customer.ToString())
                                                   .Max(c => c.SrNo)
                            : 0;

                var newCustomers = new List<CustomerDetail>();
                foreach (var customer in selectedCustomers)
                {
                    srNo++;
                    newCustomers.Add(new CustomerDetail()
                    {
                        SrNo = srNo,
                        CompanyType = UniEnums.CompanyType.Customer.ToString(),
                        AnnualTurnover = customer.AnnualTurnover,
                        BusinessType = customer.BusinessType,
                        CompanyName = customer.CompanyName,
                        ContactPerson = customer.ContactPerson,
                        Email = customer.Email,
                        EstablishedYear = customer.EstablishedYear,
                        ExecutiveName = customer.ExecutiveName,
                        Expert = customer.Expert,
                        FactoryAddress = customer.FactoryAddress,
                        IsDeleted = customer.IsDeleted,
                        MobileNo = customer.MobileNo,
                        Networking = customer.Networking,
                        NoOfEmployees = customer.NoOfEmployees,
                        Note = customer.Note,
                        OfficeAddress = customer.OfficeAddress,
                        PhoneNo = customer.PhoneNo,
                        ProcessedDate = customer.ProcessedDate,
                        Profile1 = customer.Profile1,
                        Profile2 = customer.Profile2,
                        Sector = customer.Sector,
                        Source = customer.Source,
                        Website = customer.Website
                    });
                }
                uniDb.CustomerDetails.InsertAllOnSubmit(newCustomers);
            }

            uniDb.SubmitChanges();
            RefreshGrid();
        }
Esempio n. 6
0
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            // ask for password
            Loginfrm frm = new Loginfrm(HomePage.UserDetail);
            frm.ShowDialog();

            if (!frm.IsLogedIn)
                return;

            CommanFuction.Export_To_Excel2<CustomerDetail>(_pagination.ReportData.ToList(), "Customer Report");
        }
Esempio n. 7
0
        private void bindingNavigatorEditItem_Click(object sender, EventArgs e)
        {
            var srNos = GetSelectedSrNo();
            if (!srNos.Any())
                return;

            var srNo = srNos[0];

            // ask for password
            Loginfrm frmLogin = new Loginfrm(HomePage.UserDetail);
            frmLogin.ShowDialog();

            if (!frmLogin.IsLogedIn)
                return;

            var frm = new AddNewCompany(srNo, _companyType);
            frm.ShowDialog();

            _uniDb.Refresh(System.Data.Linq.RefreshMode.KeepChanges, _pagination.PageData);
            BindGridView();
            BindControls();
        }
Esempio n. 8
0
        private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)
        {
            var srNos = GetSelectedSrNo();
            if (!srNos.Any())
                return;

            var result = MessageBox.Show(string.Format("Do you want to delete SrNos : {0}",
                                            string.Join(",", srNos.Select(x => x.ToString()).ToArray())),
                                                                        "Delete Alert", MessageBoxButtons.YesNo);

            if (result != DialogResult.Yes)
                return;

            // ask for password
            Loginfrm frm = new Loginfrm(HomePage.UserDetail);
            frm.ShowDialog();

            if (!frm.IsLogedIn)
                return;

            var deleteReasionfrm = new DeleteReasionfrm();
            deleteReasionfrm.ShowDialog();

            if (string.IsNullOrEmpty(DeleteReasionfrm.DeleteReasion))
                return;

            var companys = _uniDb.CustomerDetails.Where(x => srNos.Contains(x.SrNo) && x.CompanyType == _companyType.ToString()).ToList();

            foreach (var company in companys)
            {
                company.IsDeleted = true;
                company.ExecutiveName = HomePage.UserDetail.UserId;
                company.ModifiedDateTime = DateTime.Now;
                company.DeletedReason = DeleteReasionfrm.DeleteReasion;
            }
            _uniDb.SubmitChanges();

            _uniDb.Refresh(System.Data.Linq.RefreshMode.KeepChanges, _pagination.PageData);
            BindGridView();
            BindControls();
        }
Esempio n. 9
0
        private void recalculateAgeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Loginfrm frm = new Loginfrm(HomePage.UserDetail);
            frm.ShowDialog();

            if (!frm.IsLogedIn)
                return;

            uniDb.ReCalculateAge();
            uniDb.Refresh(System.Data.Linq.RefreshMode.KeepChanges, pagination.PageData);
            BindGridView();
            MessageBox.Show("Age Recalculate Successfull", "Success Message", MessageBoxButtons.OK);
        }
Esempio n. 10
0
        private void printToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // ask for password
            Loginfrm frmLogin = new Loginfrm(HomePage.UserDetail);
            frmLogin.ShowDialog();

            if (!frmLogin.IsLogedIn)
                return;

            var frm = new CandidateRDLSReportPrint(pagination.ReportData);
            frm.ShowDialog();
        }
Esempio n. 11
0
        private void btnExportExcel_Click(object sender, EventArgs e)
        {
            var hasPermition = HomePage.UserDetail.Modules.Split(',').ToList().Contains(UniEnums.Modules.ExportExcel.ToString());

            if (!hasPermition)
            {
                MessageBox.Show("You don't have access to this module", "Access Message", MessageBoxButtons.OK);
                return;
            }

            Loginfrm frm = new Loginfrm(HomePage.UserDetail);
            frm.ShowDialog();

            if (!frm.IsLogedIn)
                return;

            CommanFuction.Export_To_Excel2<CandidateDetail>(pagination.ReportData.ToList(), "Candidate Report");
            //CommanFuction.Export_To_Excel(ref dataGridView1, "Candidate Report");
        }
Esempio n. 12
0
        private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count < 1)
                return;

            var srNos = new List<long>();
            for (int i = 0; i < dataGridView1.SelectedRows.Count; i++)
            {
                srNos.Add(Convert.ToInt64(dataGridView1.SelectedRows[i].Cells["SrNo"].Value));
            }

            var result = MessageBox.Show(string.Format("Do you want to delete SrNos : {0}",
                                            string.Join(",", srNos.Select(x => x.ToString()).ToArray())),
                                                                        "Delete Alert", MessageBoxButtons.YesNo);

            if (result != DialogResult.Yes)
                return;

            // ask for password
            Loginfrm frm = new Loginfrm(HomePage.UserDetail);
            frm.ShowDialog();

            if (!frm.IsLogedIn)
                return;

            var deleteReasionfrm = new DeleteReasionfrm();
            deleteReasionfrm.ShowDialog();

            if (string.IsNullOrEmpty(DeleteReasionfrm.DeleteReasion))
                return;

            var candidates = uniDb.CandidateDetails.Where(x => srNos.Contains(x.SrNo)).ToList();

            foreach (var candidate in candidates)
            {
                candidate.IsDeleted = true;
                candidate.ExecutiveName = HomePage.UserDetail.UserId;
                candidate.ModifiedDateTime = DateTime.Now;
                candidate.DeletedReason = DeleteReasionfrm.DeleteReasion;
            }
            uniDb.SubmitChanges();

            uniDb.Refresh(System.Data.Linq.RefreshMode.KeepChanges, pagination.PageData);
            BindGridView();
        }
Esempio n. 13
0
        private void bindingNavigatorEditItem_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count < 1)
                return;

            var srNo = Convert.ToInt64(dataGridView1.SelectedRows[0].Cells["SrNo"].Value);

            // ask for password
            Loginfrm frmLogin = new Loginfrm(HomePage.ExecutiveName);
            frmLogin.ShowDialog();

            if (!frmLogin.IsLogedIn)
                return;

            var frm = new Candidatefrm(srNo);
            frm.ShowDialog();

            uniDb.Refresh(System.Data.Linq.RefreshMode.KeepChanges, pagination.PageData);
            BindGridView();
        }