public ActionResult AddCom()
 {
     teethLabEntities db = new teethLabEntities();
     string name = Request.Form["name"];
     company comp = new company();
     comp.name = name;
     db.companies.Add(comp);
     db.SaveChanges();
     return Redirect(Url.Action("viewAllCompanies", "Company"));
 }
        public ActionResult Create([Bind(Include = "id,company_name,city,adress,web_adress,company_login,company_password,inn,personal_account,registration_date,paying_time,company_status,category")] company company)
        {
            var Categories = db.categories.ToList();

            this.ViewData["cat"] = Categories;
            if (ModelState.IsValid)
            {
                db.companies.Add(company);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.category       = new SelectList(db.categories, "id", "name", company.category);
            ViewBag.city           = new SelectList(db.cities, "id", "name", company.city);
            ViewBag.company_status = new SelectList(db.company_status, "id", "name", company.company_status);
            return(View(company));
        }
        // GET: companies/Details/5
        public ActionResult Details(long?id)
        {
            var Categories = db.categories.ToList();

            this.ViewData["cat"] = Categories;
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            company company = db.companies.Find(id);

            if (company == null)
            {
                return(HttpNotFound());
            }
            return(View(company));
        }
        // GET: companies/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                // return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
                return(View("Error"));
            }
            //company company = db.companies.Find(id);
            company company = db.companies.SingleOrDefault(c => c.companyID == id);

            if (company == null)
            {
                //return HttpNotFound();
                return(View("Error"));
            }
            return(View("Edit", company));
        }
Exemple #5
0
        public IActionResult deactivate(int id, [FromBody] company value)
        {
            var company = _context.company.Where(c => c.companyId == id).FirstOrDefault <company>();

            if (company != null)
            {
                company.isActive = false;

                _context.SaveChanges();

                return(Ok(company));
            }
            else
            {
                return(NotFound());
            }
        }
Exemple #6
0
        public ActionResult CreateEdit(company company, HttpPostedFileBase company_logo, FormCollection frmUser)
        {
            try
            {
                string  AWSProfileName     = STUtil.GetWebConfigValue("AWSProfileName");
                string  SystemImagePath    = STUtil.GetWebConfigValue("SystemImagePath");
                company CompanyInformation = db.companies.Find(company.company_id);
                if (company_logo != null)
                {
                    string GenFileName       = STUtil.GetTodayDate().ToString("yyyyMMdd") + "_" + CompanyInformation.company_id.ToString() + "_" + Path.GetFileName(company_logo.FileName).Replace(" ", "_");
                    String companyFolderName = CompanyInformation.company_folder_name.ToString().Replace("/", "");
                    //// AWSUtil.UploadFile(company_logo.InputStream, AWSProfileName, companyFolderName, GenFileName);
                    CompanyInformation.company_logo = GenFileName;
                    UploadFile(companyFolderName, company_logo);
                }
                CompanyInformation.business_name = company.business_name;
                CompanyInformation.licence_no    = company.licence_no;
                //CompanyInformation.application_type_id = company.application_type_id;
                CompanyInformation.time_zone    = company.time_zone;
                CompanyInformation.country_code = company.country_code;
                CompanyInformation.phone        = company.phone;
                CompanyInformation.state_id     = company.state_id;
                CompanyInformation.city         = company.city;
                CompanyInformation.address      = company.address;
                CompanyInformation.zip          = company.zip;
                CompanyInformation.is_active    = company.is_active;

                db.Entry(CompanyInformation).State = System.Data.Entity.EntityState.Modified;
                result.Message = string.Format(BaseConst.MSG_SUCCESS_UPDATE, "Company");
                STUtil.SetSessionValue(UserInfo.IsCompanyAddUpdate.ToString(), "0");
                db.SaveChanges();

                #region FolderCreation
                string ImagePath = STUtil.GetWebConfigValue("ImagePath");
                //AWSUtil.FolderCreation(AWSProfileName, companyInfo.company_folder_name);
                #endregion

                STUtil.SetSessionValue(UserInfo.IsCompanyAddUpdate.ToString(), "1");
            }
            catch (Exception ex)
            {
                STUtil.SetSessionValue(UserInfo.IsCompanyAddUpdate.ToString(), "1");
                result.Message = ex.Message;
            }
            return(RedirectToAction("EditCompany", "Company", new { id = company.company_id, Result = result.Message, MessageType = result.MessageType }));
        }
Exemple #7
0
        public void CreatePostInvalid()
        {
            // arrange
            company c = new company
            {
                CEO  = "CEO name",
                Name = "Camera Comanpy"
            };

            controller.ModelState.AddModelError("key", "cannot add order");

            // act
            var actual = (ViewResult)controller.Create(c);

            // assert
            Assert.AreEqual("Create", actual.ViewName);
        }
        public ActionResult Save(string contact)
        {
            JsonSerializerSettings setting = new JsonSerializerSettings();
            user _user = new user();

            _user = JsonConvert.DeserializeObject <user>(contact);

            if (_user != null)
            {
                if (_user.Id > 0)
                {
                    Uof.IuserService.UpdateEntity(_user);
                    AddLog("修改用户 用户ID:" + _user.Id.ToString(), "修改用户", "成功");
                }
                else
                {
                    _user = Uof.IuserService.AddEntity(_user);
                    AddLog("添加用户 用户ID:" + _user.Id.ToString(), "添加用户", "成功");
                }
                if (_user.is_admin.HasValue && _user.is_admin.Value == 1)
                {
                    company com = null;
                    if (_user.company_id.HasValue)
                    {
                        com = Uof.IcompanyService.GetById(_user.company_id.Value);
                    }
                    if (com != null)
                    {
                        com.contact_name = _user.real_name;
                        com.email        = _user.email;
                        com.phone        = _user.phone;
                        com.mobile       = _user.mobile;
                        com.user_id      = _user.Id;
                        Uof.IcompanyService.UpdateEntity(com);
                    }
                }
                var obj = new
                {
                    user_id = _user.Id,
                    result  = true
                };
                return(Json(obj));
            }
            return(Json(new { result = false }));
        }
Exemple #9
0
        /// <summary>
        /// Firmayi kaydet.
        /// </summary>
        /// <param name="mail"></param>
        /// <param name="password"></param>
        /// <param name="name"></param>
        /// <param name="companytitle"></param>
        /// <param name="companysector"></param>
        /// <returns></returns>
        public string Register(dynamic jsonData)
        {
            string mail          = jsonData.mail;
            string password      = jsonData.password;
            string name          = jsonData.name;
            string companyTitle  = jsonData.companytitle;
            string companySector = jsonData.companysector;

            staff checkStaff = EntityConnectionService.Staff.GetSingle(x => x.mail.Equals(mail));

            if (checkStaff != null)
            {
                return(Helper.GetResult(false, "0x0004"));
            }

            company company = new company();

            company.sector = companySector;
            company.title  = companyTitle;
            if (!EntityConnectionService.Company.Add(company))
            {
                return(Helper.GetResult(false, "0x0015"));
            }

            checkStaff = new staff
            {
                compid   = company.compid,
                isadmin  = "X",
                mail     = mail,
                password = password.GetMd5Hash(),
                name     = name,
                authkey  = Helper.RandomString(18),
            };

            if (!EntityConnectionService.Staff.Add(checkStaff))
            {
                return(Helper.GetResult(false, "0x0016"));
            }

            dynamic data = new ExpandoObject();

            data.company = company;
            data.staff   = checkStaff;
            return(Helper.GetResult(true, data));
        }
Exemple #10
0
        public List <object> ModifyCompany(string id, string companyName, string trueName, string userName, string password, string email, string phone, string privor, string sf)
        {
            List <object> result = new List <object>();

            if (base.SearchCount(d => d.admin_CompanyID == id && d.admin_IsDel == false) != 0)
            {
                if (companyName.Length <= 32 && trueName.Length <= 10 && CheckDataOperation.CheckData(userName, @"^[A-Za-z0-9]{0,25}$") && CheckDataOperation.CheckData(password, @"^[A-Za-z0-9]{0,25}$") && CheckDataOperation.CheckData(email, @"^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$") && CheckDataOperation.CheckData(phone, @"^[0-9]{7,11}$"))
                {
                    try
                    {
                        admin a = base.Search(d => d.admin_CompanyID == id && d.admin_IsDel == false)[0];
                        a.admin_Email    = email;
                        a.admin_Password = password;
                        a.admin_PhoneNum = phone;
                        a.admin_TrueName = trueName;
                        a.admin_Username = userName;
                        base.Modify(a, new string[] { "admin_Email", "admin_Password", "admin_PhoneNum", "admin_TrueName", "admin_Username", });
                        Company cy = new Company();
                        company c  = cy.Search(d => d.company_Id == id && d.company_IsDel == false)[0];
                        c.company_Name     = companyName;
                        c.company_Province = sf;
                        c.company_Trade    = privor;
                        cy.Modify(c, new string[] { "company_Name", "company_Province", "company_Trade" });
                        result.Add(0);
                        result.Add("保存成功!");
                    }
                    catch
                    {
                        result.Add(0);
                        result.Add("保存失败!数据不合法.....");
                    }
                }
                else
                {
                    result.Add(0);
                    result.Add("保存失败!数据不合法.....");
                }
            }
            else
            {
                result.Add(0);
                result.Add("保存失败!公司不存在.....");
            }
            return(result);
        }
Exemple #11
0
        private company GetCompany(int principalId)
        {
            company qcompany = new company();

            if (!companies.TryGetValue(principalId, out qcompany))
            {
                string select_str = "select id,title, betRate , defaultBetSetting from [lottery].[dbo].[company] with(nolock)";
                string where_str  = " Where principalId = @principalId";
                qcompany = conn.Query <company>(select_str + where_str, new { principalId = principalId }).FirstOrDefault();

                if (qcompany != null)
                {
                    companies.Add(principalId, qcompany);
                }
            }

            return(qcompany);
        }
Exemple #12
0
        public async Task <ActionResult> Activate(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            company company = await db.company.FindAsync(id);

            if (company == null)
            {
                return(HttpNotFound());
            }

            company.DeletionDatetime = null;
            await db.SaveChangesAsync();

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
Exemple #13
0
        public ActionResult Mediators(company company)
        {
            var cm = db.company.FirstOrDefault(x => x.id == company.id);

            cm.cc_campus_alert_manager_email      = company.cc_campus_alert_manager_email;
            cm.cc_campus_alert_manager_first_name = company.cc_campus_alert_manager_first_name;
            cm.cc_campus_alert_manager_last_name  = company.cc_campus_alert_manager_last_name;
            cm.cc_campus_alert_manager_phone      = company.cc_campus_alert_manager_phone;

            cm.cc_daily_crime_log_manager_email      = company.cc_daily_crime_log_manager_email;
            cm.cc_daily_crime_log_manager_first_name = company.cc_daily_crime_log_manager_first_name;
            cm.cc_daily_crime_log_manager_last_name  = company.cc_daily_crime_log_manager_last_name;
            cm.cc_daily_crime_log_manager_phone      = company.cc_daily_crime_log_manager_phone;

            db.SaveChanges();

            return(RedirectToAction("Mediators"));
        }
Exemple #14
0
        public IActionResult Post([FromBody] company value)
        {
            var company = new company();

            company.name     = value.name;
            company.isActive = true;
            if (value.currency != null)
            {
                company.currencyId = value.currency.currencyId;
            }

            _context.company.Add(company);
            _context.SaveChanges();

            var send = _context.company.Where(c => c.companyId == company.companyId).FirstOrDefault <company>();

            return(Ok(send));
        }
Exemple #15
0
        public List <company> GetLst(company model, int?page, int numberRecord, out int totalRecord)
        {
            //throw new NotImplementedException();
            var a = (from u in _db.companies
                     where (string.IsNullOrEmpty(model.company_cd) || u.company_cd.Equals(model.company_cd)) &&
                     (string.IsNullOrEmpty(model.company_name) || u.company_name.Contains(model.company_name)) &&
                     (string.IsNullOrEmpty(model.company_short_name) || u.company_name.Equals(model.company_name)) &&
                     (string.IsNullOrEmpty(model.address) || u.address.Equals(model.address)) &&
                     (string.IsNullOrEmpty(model.tel) || u.tel.Equals(model.tel)) &&
                     (string.IsNullOrEmpty(model.fax) || u.fax.Equals(model.fax)) &&
                     (string.IsNullOrEmpty(model.phone) || u.phone.Equals(model.phone)) &&
                     u.del_flg.Equals(false)
                     select u);

            totalRecord = a.Count();

            return(a.ToList().Skip((page.GetValueOrDefault() - 1) * numberRecord).Take(numberRecord).ToList());
        }
Exemple #16
0
        private void LoadRecord(company Company)
        {
            materialSingleLineTextField1.Text  = Company.name;
            materialSingleLineTextField2.Text  = Company.add1;
            materialSingleLineTextField3.Text  = Company.add2;
            materialSingleLineTextField4.Text  = Company.add3;
            materialSingleLineTextField5.Text  = Company.county;
            materialSingleLineTextField6.Text  = Company.city;
            materialSingleLineTextField7.Text  = Company.postcode;
            materialSingleLineTextField8.Text  = Company.country;
            materialSingleLineTextField9.Text  = Company.telephone;
            materialSingleLineTextField10.Text = Company.email;
            materialSingleLineTextField11.Text = Company.vat;
            this.Tag = Company;

            pictureBox1.Image    = Sql.ByteToImage(Company.logo);
            pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
        }
Exemple #17
0
        //
        // GET: /Company/
        #region 暂时包起来吧

        public ActionResult Index(string id)
        {
            Companyhandling ch = new Companyhandling();

            //如果公司Id不存在

            if (!ch.IsheadCompanyIdExist(id))
            {
                ViewBag.id = id;
                return(View("NotFind"));
            }
            company com = ch.SearchCompany(id);

            ViewBag.company_Name  = com.company_Name;
            ViewBag.id            = id;
            ViewBag.companyStatus = new Companyhandling().GetCompnayStatus(id);
            return(View());
        }
Exemple #18
0
        //Редактирование компании. Возвращает логическое значение = отредактирована ли она
        public bool EditCompanyInDB(int companyId, company newCompanyData)
        {
            var thisCompany = GetCompanyFromDB(companyId);

            using (var ctx = new DataContext()) {
                try {
                    ctx.companies.Attach(thisCompany);
                    thisCompany.name            = newCompanyData.name;
                    thisCompany.foundation_year = newCompanyData.foundation_year;
                    thisCompany.address         = newCompanyData.address;
                    ctx.SaveChanges();
                }
                catch {
                    return(false);
                }
            }
            return(true);
        }
Exemple #19
0
        public company ShowDialog(company company, bool isNew, List <company> companies)
        {
            this.companies = companies;
            UpdatedUI(company);
            _okAction.Content = isNew ? "ADD" : "Search";
            _okAction.Click  += (s, e) =>
            {
                if (isNew)
                {
                    if (int.TryParse(_companyID.Text, out int ID) &&
                        !string.IsNullOrEmpty(_companyName.Text))
                    {
                        company.ID   = ID;
                        company.Name = _companyName.Text;
                    }
                    this.Close();
                }
                else
                {
                    company searchResult = null;
                    if (int.TryParse(_companyID.Text, out int ID))
                    {
                        searchResult = companies.FirstOrDefault(x => x.ID == ID);
                    }
                    else if (!string.IsNullOrEmpty(_companyName.Text))
                    {
                        searchResult = companies.FirstOrDefault(x => string.Equals(x.ID, ID));
                    }
                    if (searchResult != null)
                    {
                        UpdatedUI(searchResult);
                    }
                }
            };

            _cancleAction.Click += (s, e) =>
            {
                company = null;
                this.Close();
            };

            ShowDialog();
            return(company);
        }
        public HttpResponseMessage getCompanyList()
        {
            DataTable dt = new BLL.handleCompany().GetCompanyList();
            Object    data;

            if (dt.Rows.Count >= 0)
            {
                List <company> list = new List <company>();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    company company = new company();
                    company.id          = dt.Rows[i]["id"].ToString();
                    company.companyId   = dt.Rows[i]["companyId"].ToString();
                    company.culture     = dt.Rows[i]["culture"].ToString();
                    company.photo       = dt.Rows[i]["photo"].ToString();
                    company.create_time = dt.Rows[i]["create_time"].ToString();

                    list.Add(company);
                }


                data = new
                {
                    success  = true,
                    backData = list
                };
            }
            else
            {
                data = new
                {
                    success = false,
                    backMsg = "数据异常"
                };
            }

            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string json = serializer.Serialize(data);

            return(new HttpResponseMessage
            {
                Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json")
            });
        }
Exemple #21
0
        public IActionResult Put(int id, [FromBody] company value)
        {
            var company = _context.company.Where(c => c.companyId == id).FirstOrDefault <company>();

            if (company != null)
            {
                company.name = value.name;

                _context.SaveChanges();

                var send = _context.company.Where(c => c.companyId == company.companyId).FirstOrDefault <company>();

                return(Ok(send));
            }
            else
            {
                return(NotFound());
            }
        }
Exemple #22
0
        private void RunAllInsuranceThreading()
        {
            company   c  = new company();
            DataTable dt = c.GetAllData("name");
            List <provider_eligibility_restrictions> allRestrictions = provider_eligibility_restrictions.GetAllDataAsList();

            foreach (DataRow aRow in dt.Rows)
            {
                string newProvider = provider_eligibility_restrictions.FindEligibilityRestrictions(providerFilter, aRow["name"].ToString(), dos, allRestrictions, "");

                Invoke((MethodInvoker) delegate
                {
                    dgvResults.Rows.Add(new object[] { providerFilter, aRow["name"].ToString(), dos.ToShortDateString(),
                                                       newProvider, newProvider == "" ? "" : "*", 0 });
                });
            }

            Invoke((MethodInvoker) delegate { btnRunTests.Enabled = true; btnRunTestAllInsurance.Enabled = true; });
        }
        public ActionResult CreateEditClient(user user, HttpPostedFileBase user_photo, FormCollection frmAdminUser)
        {
            var isRole = frmAdminUser["IsJob"];
            var JobId  = frmAdminUser["hdnJobId"] == ""?0:Convert.ToInt32(frmAdminUser["hdnJobId"]);

            try
            {
                user.role_bit = (Int32)Role.Client;
                user.role_id  = db.roles.AsEnumerable().Where(x => x.role_bit == (Int32)Role.Client && x.company_id == (Int32)SessionUtil.GetCompanyID()).FirstOrDefault().role_id;
                var role = db.roles.AsEnumerable().Where(x => x.company_id == user.company_id && x.role_bit == (Int32)Role.Client && x.is_active).ToList();
                user.role_id = role.Count > 0 ? role.Select(x => x.role_id).FirstOrDefault() : 0;
                var     userdata           = db.users.Find(user.user_id);
                company CompanyInformation = db.companies.Find(user.company_id);
                if (user_photo != null)
                {
                    string AWSProfileName    = STUtil.GetWebConfigValue("AWSProfileName");
                    string GenFileName       = STUtil.GetTodayDate().ToString("yyyyMMdd") + "_" + CompanyInformation.company_id.ToString() + "_" + Path.GetFileName(user_photo.FileName).Replace(" ", "_");
                    String companyFolderName = CompanyInformation.company_folder_name.ToString().Replace("/", "");
                    //// AWSUtil.UploadFile(user_photo.InputStream, AWSProfileName, companyFolderName, GenFileName);
                    user.user_photo = GenFileName;
                    UploadFile(SessionUtil.GetCompanyFolderName().ToString(), user_photo);
                }
                else
                {
                    user.user_photo = userdata != null ? userdata.user_photo : "NA.jpg";
                }
                user.parent_user_id = SessionUtil.GetUserID();
                result = userUtil.PostUserEdit(user);
            }
            catch (Exception ex)
            {
                result.Message     = ex.Message;
                result.MessageType = MessageType.Error;
            }
            if (string.IsNullOrEmpty(isRole))
            {
                return(RedirectToAction("Index", "Client", new { Result = result.Message, MessageType = result.MessageType }));
            }
            else
            {
                return(RedirectToAction("CreateEditJob", "Job", new { id = JobId, Result = result.Message, MessageType = result.MessageType }));
            }
        }
Exemple #24
0
 public bool addLogoCompany(int companyCode, string pathLogo)
 {
     try
     {
         company logoCompany = db.company.FirstOrDefault(item => (item.id == companyCode));
         logoCompany.path_en = pathLogo;
         logoCompany.path_fr = pathLogo;
         logoCompany.path_es = pathLogo;
         logoCompany.path_ar = pathLogo;
         db.company.AddOrUpdate(logoCompany);
         db.SaveChanges();
     }
     catch (System.Data.DataException ex)
     {
         logger.Error(ex.ToString());
         return(false);
     }
     return(true);
 }
Exemple #25
0
        public ActionResult Edit(company company)
        {
            var co = db.company.FirstOrDefault(x => x.companyId == company.companyId);

            if (co != null)
            {
                co.companyName    = company.companyName;
                co.companyAddress = company.companyAddress;
                co.companyPhone   = company.companyPhone;
                co.businessID     = company.businessID;
                db.SaveChanges();
                return(RedirectToAction("Index", "CompanyList"));
            }
            else
            {
                ViewBag.Warning = "Düzenleme gerçekleştirilemedi.";
                return(View());
            }
        }
Exemple #26
0
        private void LoadInsurance()
        {
            clbInsuranceGroups.Items.Clear();
            insurance_company_group workingGroup = new insurance_company_group();

            foreach (DataRow aRow in workingGroup.GetAllData("name").Rows)
            {
                workingGroup = new insurance_company_group(aRow);
                clbInsuranceGroups.Items.Add(workingGroup, false);
            }

            company c = new company();

            foreach (DataRow aRow in c.GetAllData("name").Rows)
            {
                c = new company(aRow);
                clbInsurance.Items.Add(c, false);
            }
        }
Exemple #27
0
        public BaseModel()  //Конструктор – для экземпляра класса
        {
            // Users region
            User        = new user();
            Users       = new List <user>();
            Company     = new company();
            Companies   = new List <company>();
            Departments = new List <department>();

            // Document region
            Documents        = new List <document>();
            DocumentsHistory = new List <document>();
            DocumentsInbox   = new List <document>();

            //ChatModel region
            conversation = new conversation();
            message      = new message();
            ChatModel    = new ChatModel();
        }
        public ActionResult RegisterStore(User regUser)
        {
            //Check Model state is valid or not
            if (ModelState.IsValid)
            {
                String md5password = Utility.Encode(regUser.password);

                using (var contxt = new DBContext())
                {
                    //Set Datetime
                    regUser.created_at       = DateTime.Now;
                    regUser.password         = md5password;
                    regUser.confirm_password = md5password;
                    //Add New User
                    contxt.users.Add(regUser);
                    contxt.SaveChanges();

                    //Get Current User ID
                    int user_id = regUser.id;

                    //Save into Company Table
                    company cmpMdl = new company();
                    cmpMdl.name       = regUser.Company_Name;
                    cmpMdl.user_id    = regUser.id;
                    cmpMdl.created_at = DateTime.Now;
                    contxt.companies.Add(cmpMdl);
                    contxt.SaveChanges();
                }
                //Set temp data Success registration message
                TempData["reg_message"] = Utility.SUCCESS_MESSAGE + " You have been Registered Successfully ,Please login";
                return(RedirectToAction("Register"));
            }
            else
            {
                string errors = errorstate.errors(ModelState);
                //Set temp data for wrong credentials
                TempData["reg_message"] = Utility.FAILED_MESSAGE + "" + errors;

                //redirect back to Registration page
                return(RedirectToAction("Register"));
            }
        }
Exemple #29
0
        private void dataGridView1_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
        {
            int id = Convert.ToInt32(dataGridView1.CurrentRow.Cells["companyIdDataGridViewTextBoxColumn"].Value);

            // updating
            if (e.ColumnIndex == 3)
            {
                formDTO.op = CrudOpr.Update;

                ViewCompany findCompany = dto.db.ViewCompanies.SingleOrDefault(o => o.companyId == id);
                formDTO.obj = findCompany;

                CreateUpdateCompanyForm form = new CreateUpdateCompanyForm(this, formDTO);
                form.Show();
            }

            // deleting
            if (e.ColumnIndex == 4)
            {
                // Запрашиваем подтверждение
                string message = "Do you want to delete?";
                string caption = "Y/n";
                var    result  = MessageBox.Show(message, caption,
                                                 MessageBoxButtons.YesNo,
                                                 MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    company c = new company();
                    c.companyId = id;
                    // deleting
                    if (crud.delete(c))
                    {
                        MessageBox.Show("Company was deleted!");
                        resetCbData();
                    }
                    else
                    {
                        MessageBox.Show("Deleting was denied");
                    }
                }
            }
        }
        /**
         * PUT request that updates a company
         */
        public Response updateCompany(int id_company, company cop)
        {
            Response res = new Response();

            res.success = true;
            res.code    = "1";
            res.message = "SUCCESSFUL";
            try
            {
                var query = "SELECT updateCompany(" + id_company + ", '" + cop.name + "');";
                _context.Database.SqlQuery <Boolean>(query).FirstOrDefault();
            }
            catch (NpgsqlException ex)
            {
                res.success = false;
                res.code    = ex.Code;
                res.message = ex.BaseMessage;
            }
            return(res);
        }
Exemple #31
0
        public Form1()
        {
            InitializeComponent();
            company companylist = new company
            {
                Name     = "美佳",
                Address  = "台中市台灣大道上",
                Employee = new List <string>
                {
                    "hugo",
                    "fish",
                    "helen"
                }
            };

            //轉成JSON格式
            string json = TransToJson(companylist);

            ImportToRdis(json);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.Request.QueryString["user"] != null)
     {
         strUid = this.Request.QueryString["user"].ToString();
     }
     else
     {
         Response.Write("<script>alert('对不起,参数有误!请联系管理员!');</script>");
         Response.Redirect("index.aspx?rend=" + System.Guid.NewGuid().ToString());
         return;
     }
     if (this.Request.QueryString["type"] != null)
     {
         strType = this.Request.QueryString["type"].ToString();
     }
     else
     {
         Response.Write("<script>alert('对不起,参数有误!请联系管理员!');</script>");
         Response.Redirect("index.aspx?rend=" + System.Guid.NewGuid().ToString());
         return;
     }
     if (this.Request.QueryString["ren"] != null)
     {
         strID = this.Request.QueryString["ren"].ToString();
     }
     else
     {
         Response.Write("<script>alert('对不起,参数有误!请联系管理员!');</script>");
         Response.Redirect("index.aspx?rend=" + System.Guid.NewGuid().ToString());
         return;
     }
     if (strType == "1")
     {
         personal personal = new personal();
         personal.yzid = strID;
         personal.loginId = strUid;
         DataSet dtSet = personal.GetAuthenticationList();
         if (dtSet.Tables[0].Rows.Count > 0)
         {
             personal.ifEnable = "1";
             personal.id = dtSet.Tables[0].Rows[0]["id"].ToString();
             personal.authenticationTime = DateTime.Now;
             personal.UpdateAuthenticationList();
         }
     }
     else if (strType == "2")
     {
         investor investor = new investor();
         investor.yzid = strID;
         investor.loginId = strUid;
         DataSet dtSet = investor.GetAuthenticationList();
         if (dtSet.Tables[0].Rows.Count > 0)
         {
             investor.ifEnable = "1";
             investor.id = dtSet.Tables[0].Rows[0]["id"].ToString();
             investor.authenticationTime = DateTime.Now;
             investor.UpdateAuthenticationList();
         }
     }
     else if (strType == "3")
     {
         company company = new company();
         company.yzid = strID;
         company.loginId = strUid;
         DataSet dtSet = company.GetAuthenticationList();
         if (dtSet.Tables[0].Rows.Count > 0)
         {
             company.ifEnable = "1";
             company.id = dtSet.Tables[0].Rows[0]["id"].ToString();
             company.authenticationTime = DateTime.Now;
             company.UpdateAuthenticationList();
         }
     }
     else
     {
         Response.Write("<script>alert('对不起,参数有误!请联系管理员!');</script>");
         Response.Redirect("index.aspx?rend=" + System.Guid.NewGuid().ToString());
         return;
     }
 }
Exemple #33
0
        /// <summary>
        /// Load the model with data (row from the DB)
        /// </summary>
        /// <param name="CompanyId"></param>
        /// <returns></returns>
        public override bool Load(int CompanyId)
        {
            CurrentConnection = new DatabaseDataContext();
            var q = from x in CurrentConnection.companies where x.id.Equals(CompanyId) && x.deleted.Equals(0) select x;
            CurrentRow = q.FirstOrDefault();

            return true;
        }
Exemple #34
0
 protected void btn_login_Click(object sender, EventArgs e)
 {
     string CheckCode = this.txtCheckCode.Value.Trim();  //验证码
     if (String.Compare(Request.Cookies["ValidateCode"].Value, CheckCode, true) != 0)
     {
         Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>tip('验证码输入不正确,请重新输入!');</script>");
         return;
     }
     if (this.st_type.Value == "1")
     {
         personal personal = new personal();
         personal.loginId = this.txtUid.Value.Trim();
         personal.pwd = this.txtLogPwd.Value.Trim();
         personal.ifEnable = "1";
         if (personal.userIfEnable())
         {
             Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>tip('该用户没有认证,请查看邮箱认证用户!');</script>");
             return;
         }
         else
         {
             DataSet dtSet = personal.userLogin();
             if (dtSet.Tables[0].Rows.Count > 0)
             {
                 Session["uid"] = dtSet.Tables[0].Rows[0]["id"].ToString();
                 Session["uname"] = dtSet.Tables[0].Rows[0]["name"].ToString();
                 Session["loginId"] = dtSet.Tables[0].Rows[0]["loginId"].ToString();
                 Session["utype"] = "1";
                 this.lb_showLogin.Text = "<a href=\"javascript:void(0)\" class=\"Logo\"  onclick=\"loginOut();\"  id=\"loginOut\">注销</a><a href=\"javascript:void(0)\" class=\"Rion\" id=\"User\"> 欢迎你," + dtSet.Tables[0].Rows[0]["name"].ToString() + "</a>";
             }
             else
             {
                 Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>tip('用户名或密码输入错,请重新输入!');</script>");
                 return;
             }
         }
     }
     else if (this.st_type.Value == "2")
     {
         investor investor = new investor();
         investor.loginId = this.txtUid.Value.Trim();
         investor.pwd = this.txtLogPwd.Value.Trim();
         investor.ifEnable = "1";
         if (investor.userIfEnable())
         {
             Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>tip('该用户没有认证,请查看邮箱认证用户!');</script>");
             return;
         }
         else
         {
             DataSet dtSet = investor.userLogin();
             if (dtSet.Tables[0].Rows.Count > 0)
             {
                 Session["uid"] = dtSet.Tables[0].Rows[0]["id"].ToString();
                 Session["uname"] = dtSet.Tables[0].Rows[0]["name"].ToString();
                 Session["loginId"] = dtSet.Tables[0].Rows[0]["loginId"].ToString();
                 Session["utype"] = "2";
                 this.lb_showLogin.Text = "<a href=\"javascript:void(0)\" class=\"Logo\"  onclick=\"loginOut();\"  id=\"loginOut\">注销</a><a href=\"javascript:void(0)\" class=\"Rion\" id=\"User\"> 欢迎你," + dtSet.Tables[0].Rows[0]["name"].ToString() + "</a>";
             }
             else
             {
                 Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>tip('用户名或密码输入错,请重新输入!');</script>");
                 return;
             }
         }
     }
     else if (this.st_type.Value == "3")
     {
         company company = new company();
         company.loginId = this.txtUid.Value.Trim();
         company.pwd = this.txtLogPwd.Value.Trim();
         company.ifEnable = "1";
         if (company.userIfEnable())
         {
             Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>tip('该用户没有认证,请查看邮箱认证用户!');</script>");
             return;
         }
         else
         {
             DataSet dtSet = company.userLogin();
             if (dtSet.Tables[0].Rows.Count > 0)
             {
                 Session["uid"] = dtSet.Tables[0].Rows[0]["id"].ToString();
                 Session["uname"] = dtSet.Tables[0].Rows[0]["name"].ToString();
                 Session["loginId"] = dtSet.Tables[0].Rows[0]["loginId"].ToString();
                 Session["utype"] = "3";
                 this.lb_showLogin.Text = "<a href=\"javascript:void(0)\" class=\"Logo\"  onclick=\"loginOut();\"  id=\"loginOut\">注销</a><a href=\"javascript:void(0)\" class=\"Rion\" id=\"User\"> 欢迎你," + dtSet.Tables[0].Rows[0]["name"].ToString() + "</a>";
             }
             else
             {
                 Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>tip('用户名或密码输入错,请重新输入!');</script>");
                 return;
             }
         }
     }
 }
 public Int64 AddCompany(string companyname)
 {
     using (OnlineShoppingDataClassesDataContext osdb = new OnlineShoppingDataClassesDataContext())
     {
         company c = new company
         {
             companyname = companyname
         };
         osdb.companies.InsertOnSubmit(c);
         osdb.SubmitChanges();
         return c.companyID;
     }
 }
Exemple #36
0
 private void addCompany(string strYzid)
 {
     company company = new company();
     company.id = System.Guid.NewGuid().ToString();
     company.loginId = this.txtEmail.Value;
     company.pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.txtPwd.Value, "MD5");
     company.name = this.txtName.Value;
     company.telNumber = "";
     company.phoneNumber = "";
     company.companyNmae = "";
     company.address = "";
     company.contact = "";
     company.ifEnable = "0";
     company.detail = "";
     company.scale = "";
     company.capital = 0;
     company.legalPerson = "";
     company.type = "";
     company.eamil = this.txtEmail.Value;
     company.yzid = strYzid;
     company.createTime = DateTime.Now;
     company.Add();
 }
Exemple #37
0
 /// <summary>
 /// Creates a new row in the database
 /// </summary>
 /// <returns>Insert ID of the new row</returns>
 public override int New()
 {
     base.New();
     CurrentRow = new company();
     CurrentConnection.companies.InsertOnSubmit(CurrentRow);
     CurrentConnection.SubmitChanges();
     return Save();
 }
Exemple #38
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.Session["uid"] == null || this.Session["uid"].ToString() == "")
        {
            this.lb_showLogin.Text = "<a href=\"javascript:void(0)\" class=\"Logo\" id=\"User_Register\">注册</a>";
            this.lb_showLogin.Text += "<a href=\"javascript:void(0)\" class=\"Rion\" id=\"User_Login\">登录</a>";

        }
        else if (this.Session["uname"] != null)
        {
            this.lb_showLogin.Text = "<a href=\"javascript:void(0)\" class=\"Logo\" onclick=\"loginOut();\" id=\"loginOut\">注销</a>  <a href=\"javascript:void(0)\" class=\"Rion\" id=\"User\">欢迎你," + this.Session["uname"].ToString() + "</a>";
            if (this.Session["utype"] != null)
            {
                if (this.Session["utype"].ToString() == "1")
                {
                    personal personal = new personal();
                    personal.GetModel(this.Session["uid"].ToString().Trim()); ;
                    this.lb_name.Text = personal.name;
                    this.lb_email.Text = personal.email;
                    this.lb_type.Text = "个人/创客";
                }
                else if (this.Session["utype"].ToString() == "2")
                {
                    investor investor = new investor();
                    investor.GetModel(this.Session["uid"].ToString().Trim()); ;
                    this.lb_name.Text = investor.name;
                    this.lb_email.Text = investor.eamil;
                    this.lb_type.Text = "投资人";
                }
                else if (this.Session["utype"].ToString() == "3")
                {
                    company company = new company();
                    company.GetModel(this.Session["uid"].ToString().Trim()); ;
                    this.lb_name.Text = company.name;
                    this.lb_email.Text = company.eamil;
                    this.lb_type.Text = "企业";
                }
            }
        }
    }