Пример #1
0
        private void insertCompanyData()
        {
            Persistence pers = new PersistenceImpl();

            var myconf = new MyConfiguration();

            myconf.currentBatch  = "2012-16";
            myconf.currentDegree = "B.TECH";

            var compList = new List <Object>();

            for (int i = 108; i < 109; i++)
            {
                var compObj = new Entity_Company();
                compObj.companyId   = i;
                compObj.companyName = "COMPANY" + i;

                var compDetail = new Entity_CompanyDetails();
                compDetail.DOR         = DateTime.Now.AddDays(20 + i);
                compDetail.host        = "ACET";
                compDetail.myConfigObj = myconf;
                compDetail.staffId     = 1;
                compDetail.status      = 1;
                compDetail.type        = 0;
                compDetail.companyObj  = compObj;

                compList.Add(compDetail);
            }

            pers.bulkInsert(compList);
        }
Пример #2
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            compManager = new CompanyManagerImpl();
            var company = compManager.getCompanyByName(textBox_companyName.Text.Trim());

            if (company == null)
            {
                company             = new Entity_Company();
                company.companyName = textBox_companyName.Text.Trim();
            }

            var dropdownMap = e.Argument as Dictionary <string, int>;

            var compDetails = new Entity_CompanyDetails();

            compDetails.type        = dropdownMap[EnumData.viewCompanyListHeadings.TYPE.ToString()];
            compDetails.host        = textBox_collegeName.Text.Trim();
            compDetails.DOR         = dateTime_dor.Value;
            compDetails.status      = dropdownMap[EnumData.viewCompanyListHeadings.STATUS.ToString()];
            compDetails.myConfigObj = Utility.getConfigObj();
            compDetails.staffId     = Common.loggedUser.staffId;

            if (company.addCompDetailsObj(compDetails))
            {
                e.Result = 0;
            }
            else
            {
                if (compManager.saveNewCompany(company))
                {
                    e.Result = 1;
                }
                else
                {
                    e.Result = 2;
                }
            }
        }