public DirectResponse DoAddUser(string userName, string fullName, string company, string location, string batch, string role, string companies) { var dataUser = new data_UserCreateRequest(); dataUser.Username = userName; dataUser.FullName = fullName; dataUser.Company = company; dataUser.Location = location; dataUser.Batch = batch; dataUser.Role = role; dataUser.Companies = companies; BSL_GLXAccountClient client = new BSL_GLXAccountClient(); string mess = client.createUser(dataUser); DirectResponse dr = new DirectResponse(); if (mess == "") { dr.Success = true; dr.Result = String.Format("{{Message:'{0}'}}", ""); } else { dr.Success = false; dr.ErrorMessage = mess; } return(dr); }
public string createUser(data_UserCreateRequest request) { //if (CheckExistsItem(request.Username, request.Company)) // return "The account and company is already existed."; //if (bllocationAndAccount.CheckExistsLocationAndAccount(request.Username, request.Location)) // return "The account and location is already existed."; //if (bllRequisitionWkshName.CheckExistsUserWkshName(request.Username, request.Batch)) // return "The account and worksheet name is already existed."; //Account table var account = new DAL.LinqToSql.Account(); account.UID = Guid.NewGuid(); account.Account1 = request.Username; account.FullName = request.FullName; //GLXAccount var gLXAccount = new DAL.LinqToSql.GLXAccount(); gLXAccount.UID = Guid.NewGuid(); gLXAccount.Account = request.Username; gLXAccount.Company = request.Company; //LocationAndAccount var locationAndAccount = new DAL.LinqToSql.LocationAndAccount(); locationAndAccount.UID = Guid.NewGuid(); locationAndAccount.Account = request.Username; locationAndAccount.Location = request.Location; //Requisition Wksh. Name var RequisitionWkshName = new DAL.LinqToSql.Requisition_Wksh__Name(); RequisitionWkshName.UID = Guid.NewGuid(); RequisitionWkshName.Account = request.Username; RequisitionWkshName.Company = request.Company; RequisitionWkshName.Name = request.Batch; RequisitionWkshName.Worksheet_Template_Name = "REQ."; try { if (!CheckExistsAccount(request.Username)) { db_Account.Accounts.InsertOnSubmit(account); } if (!CheckExistsItem(request.Username, request.Company)) { db.GLXAccounts.InsertOnSubmit(gLXAccount); } if (!bllocationAndAccount.CheckExistsLocationAndAccount(request.Username, request.Location)) { db_Location.LocationAndAccounts.InsertOnSubmit(locationAndAccount); } if (!bllRequisitionWkshName.CheckExistsUserWkshName(request.Company, request.Username, request.Batch)) { db_Req.Requisition_Wksh__Names.InsertOnSubmit(RequisitionWkshName); } db_Account.SubmitChanges(); db.SubmitChanges(); db_Location.SubmitChanges(); db_Req.SubmitChanges(); GrantPermission(request.Username, request.Companies, request.Role); } catch (Exception e) { return(e.Message); } return(""); }
public string createUser(data_UserCreateRequest request) { return(bll.createUser(request)); }