public data_LocationAndAccount(DAL.LinqToSql.LocationAndAccount data) { this.UID = data.UID.ToString(); this.Account = data.Account; this.Location = data.Location; }
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(""); }