public IHttpActionResult AddAccount(AccountEntity account) { bool isAddSuccess = false; ResultEntity result = new ResultEntity(); try { ACCOUNT temp = account.ToACCOUNT(); //记录添加用户信息 temp.Account_AddUser = account.AddUser.ID; //记录添加公司信息 temp.Account_Company = account.Company.ID; isAddSuccess = dal.AddAccount(temp); result.Data = account; } catch (Exception e) { result.Message = e.Message; NtripProxyLogger.LogExceptionIntoFile("调用接口api/Account/AddAccount异常,异常信息为:" + e.Message); } result.IsSuccess = isAddSuccess; return(Json <ResultEntity>(result)); }
public void AddAccount(AccountDTO account) { data.AddAccount(account); }
public int AddAccount(AccountDTO accountDTO) { return(accountDAL.AddAccount(accountDTO)); }
private void btn_add_Click(object sender, EventArgs e) { Image myImg; //新增数据 AccountModel AM = new AccountModel(); AM.Account_ID = Guid.NewGuid().ToString(); if (txtBox_Account_Name.Text == "") { AM.Account_Name = null; } else { AM.Account_Name = txtBox_Account_Name.Text; } if (txtbox_Account_Password.Text == "") { AM.Account_Password = null; } else { AM.Account_Password = txtbox_Account_Password.Text; } AM.Account_Time = DateTime.Now; AM.Name = txtbox_Name.Text; AM.TEL = txtbox_Tel.Text; AM.Company = txtbox_Company.Text; if (AccountPicAddress == "") { AM.Account_Picture = ""; } else { try { AM.Account_Picture = AM.Account_Name + ".jpg"; //将这个图片存起来 myImg = Image.FromFile(AccountPicAddress); myImg.Save("AccountPic//" + AM.Account_Picture, System.Drawing.Imaging.ImageFormat.Jpeg); myImg.Dispose(); } catch (Exception ex) { AM.Account_Picture = ""; } } if (comboBox_IsUse.Text == "是") { AM.Account_IsUse = 0; } else { AM.Account_IsUse = 1; } if (comboBox_Permission.Text == "APP操作员") { AM.Account_Permission = 1; } else if (comboBox_Permission.Text == "APP管理员") { AM.Account_Permission = 0; } else { AM.Account_Permission = 2; } AM.Sign = 1; AM.Last_Operate_Date = DateTime.Now; AM.Last_Operate_Type = 0; string Error_message; AccDAL.AddAccount(AM, out Error_message); if (Error_message != "") { MessageBox.Show(Error_message); System.IO.File.Delete(AccountPicAddress); } else { //更新表DGV_Account AccDAL.SelectAccount(out Account); DGV_Account.DataSource = Account; Account = null; } AccountPicAddress = ""; }