当前位置: 首页>>代码示例>>C#>>正文


C# Company.Update方法代码示例

本文整理汇总了C#中Company.Update方法的典型用法代码示例。如果您正苦于以下问题:C# Company.Update方法的具体用法?C# Company.Update怎么用?C# Company.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Company的用法示例。


在下文中一共展示了Company.Update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btnDelete_Click

 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         Company comp = new Company();
         comp.CompanyId = int.Parse(txtCompanyID.Text);
         comp.isDeleted = true;
         comp.CompanyName = txtName.Text;
         comp.ModifiedAccount = this.User.Identity.Name;
         comp.Update();
         Search();
         panelEdit.Visible = false;
         panelMain.Visible = true;
     }
     catch (Exception ex)
     {
         RegisterStartupScript("alert(\"" + GetJSMessage(GetResource("Title_Error"), ex.Message) + "\");");
         logger.Error("Erorr btnDelete_click", ex);
     }
 }
开发者ID:dtafe,项目名称:WorkNC,代码行数:20,代码来源:MstCompany.aspx.cs

示例2: btnSave_Click

        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {

                if (btnDelete.Enabled == false)
                {
                    List<Company> listComp = new List<Company>();
                    listComp = Company.GetAll().Where(l => l.CompanyName.Trim().ToLower() == txtName.Text.Trim().ToLower()).ToList();
                    if (listComp.Count > 0)
                    {
                        RegisterStartupScript("alert(\"" + GetJSMessage(GetResource("Title_Error"), string.Format(GetResource("CheckName"), lblCompanyName.Text)) + "\");");
                        return;
                    }
                    Company comp = new Company();
                    comp.CompanyId = Convert.ToInt32(txtCompanyID.Text);
                    comp.CompanyName = txtName.Text;
                    if(txtAddress1.Text != "")
                       comp.Address1 = txtAddress1.Text;
                    if (txtAddress2.Text != "")
                      comp.Address2 = txtAddress2.Text;
                    if (txtTEL.Text != "")
                       comp.TEL = txtTEL.Text;
                    if (txtFAX.Text != "")
                       comp.FAX = txtFAX.Text;
                    comp.isDeleted = false;
                    comp.CreateAccount = comp.ModifiedAccount = this.User.Identity.Name;
                    comp.Insert();
                }
                else
                {

                    Company comp = new Company();
                    comp.CompanyId = int.Parse(txtCompanyID.Text);
                    comp = comp.GetByPrimaryKey();
                    if (comp.CompanyName.Trim() != txtName.Text.Trim())
                    {
                        List<Company> listComp = new List<Company>();
                        listComp = Company.GetAll().Where(l => l.CompanyName.Trim().ToLower() == txtName.Text.Trim().ToLower()).ToList();
                        if (listComp.Count > 0)
                        {
                            RegisterStartupScript("alert(\"" + GetJSMessage(GetResource("Title_Error"), string.Format(GetResource("CheckName"), lblCompanyName.Text)) + "\");");
                            return;
                        }
                    }
                    comp.ModifiedAccount = this.User.Identity.Name;
                    comp.CompanyId = int.Parse(txtCompanyID.Text);
                    comp.CompanyName = txtName.Text;
                    if (txtAddress1.Text != "")
                        comp.Address1 = txtAddress1.Text;
                    if (txtAddress2.Text != "")
                        comp.Address2 = txtAddress2.Text;
                    if (txtTEL.Text != "")
                        comp.TEL = txtTEL.Text;
                    if (txtFAX.Text != "")
                        comp.FAX = txtFAX.Text;
                    comp.Update();
                }
                panelEdit.Visible = false;
                panelMain.Visible = true;
                Search();
            }
            catch (Exception ex)
            {
                RegisterStartupScript("alert(\"" + GetJSMessage(GetResource("Title_Error"), ex.Message) + "\");");
                logger.Error("Erorr btnSave_click", ex);
            }
        }
开发者ID:dtafe,项目名称:WorkNC,代码行数:68,代码来源:MstCompany.aspx.cs

示例3: Index

        public ActionResult Index(CompanyCreateCommand command)
        {
            return ExecuteInExplicitTransaction(
                action: () =>
                {
                    var company = new Company();

                    company.Update(command);
                    RavenSession.Store(company);
                    RavenSession.SaveChanges();

                    _tenants.SetCompanyId(Request.Url, company.Id);

                    CheckSynchronization(company.Id);
                    HackLevels(company.Id);
                    HackDivisions(company.Id, command);
                },
                onsuccess: () => RedirectToAction("Index"));
        }
开发者ID:kijanawoodard,项目名称:AllStarScore,代码行数:19,代码来源:SuperAdminController.cs


注:本文中的Company.Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。