public void ConvertNullSDKToAPI() { sdkSubAccount = null; converter = new SubAccountConverter(sdkSubAccount); Assert.IsNull(converter.ToAPISubAccount()); }
protected void Delete_Click(object sender, EventArgs e) { if (EditFlag == true) { Sub_Account = new SubAccount(); Sub_Account_List = new List <SubAccount>(); AccountIDTxt.Text = SubAccountManulID.ToString(); int AccountID = int.Parse(AccountIDTxt.Text); try { Sub_Account = db.SubAccount.ToList().Where(s => s.ID == AccountID).FirstOrDefault();// Sub_Account.GetSubAccount_ByID(AccountID).ElementAtOrDefault(0); if (Sub_Account != null) { db.SubAccount.Remove(Sub_Account); db.SaveChanges(); } AddErrorTxt.Text = "تم الحذف"; AddErrorTxt.ForeColor = System.Drawing.Color.Green; Initialize_Page(); } catch (Exception ex) { AddErrorTxt.Text = "حدث خطأ لا يمكن الحذف"; AddErrorTxt.ForeColor = System.Drawing.Color.Red; } } else { AddErrorTxt.Text = "من فضلك ابحث عن حساب اولا"; AddErrorTxt.ForeColor = System.Drawing.Color.Red; } }
public void Initialize_Page() { EditFlag = false; AccountNameTxt.Text = ""; BalanceTxt.Text = ""; string date = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day; DateTxt.Text = date; Sub_Account = new SubAccount(); // user = new User(); AccountNoForSearchDrop.DataSource = db.SubAccount.ToList().Where(o => o.MainAccount_id == 1101).ToList();// Sub_Account.GetAllSubAccountStartBy(1101); AccountNoForSearchDrop.DataTextField = "name"; AccountNoForSearchDrop.DataValueField = "ID"; AccountNoForSearchDrop.DataBind(); //اسم المبيعات بيتاخد من ليس اليوزر SalesUesrId.DataSource = db.AspUser.ToList(); // user.Get_AllUser(); SalesUesrId.DataTextField = "Username"; SalesUesrId.DataValueField = "Id"; SalesUesrId.DataBind(); ClearIndxControls(); setAccoutID(); //CheckForPrivilage(); }
public async Task <ActionResult <SubAccount> > PostSubAccount(SubAccount subAccount) { _context.SubAccount.Add(subAccount); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSubAccount", new { id = subAccount.ID }, subAccount)); }
override public void Execute() { SubAccount subAccount = SubAccountBuilder.NewSubAccount() .WithName(NAME) .WithParentAccountId(PARENT_ACCOUNT_ID) .WithLanguage(LANGUAGE) .WithTimezoneId(TIMEZONE_ID) .Build(); //Creates subAccount Account account = ossClient.AccountService.createSubAccount(subAccount); Console.WriteLine(account); SubAccount updateSubAccount = SubAccountBuilder.NewSubAccount() .WithLanguage(UPDATE_LANGUAGE) .WithTimezoneId(UPDATE_TIMEZONE_ID) .Build(); //Updates subAccount ossClient.AccountService.updateSubAccount(updateSubAccount, account.Id); //Lists accessibleAccounts accessibleAccounts = ossClient.AccountService.getAccessibleAccounts(); //Lists subAccounts subAccounts = ossClient.AccountService.getSubAccounts(); }
public async Task <IActionResult> CreateSubAccount(SubAccount subAccount) { string CompId = User.Claims.Where(r => r.Type == "CompanyID").FirstOrDefault().Value; int CompID = Convert.ToInt32(CompId); if (_context.SubAccount.Where(r => r.CompanyID == CompID).Where(r => r.MainAccountID == subAccount.MainAccountID).Where(r => r.SubAccountNumber == subAccount.SubAccountNumber).Any() == true) { ViewData["SameCodeError"] = "Sub Account Code is already assigned to account."; return(View("SubAccounts", await _context.SubAccount.Where(r => r.CompanyID == CompID).Include(r => r.MainAccount).OrderBy(r => r.MainAccount.MainAccountNumber).ToListAsync())); } subAccount.CompanyID = CompID; subAccount.CreationDate = DateTime.Now; subAccount.CreatedBy = User.Identity.Name; if (ModelState.IsValid) { _context.Add(subAccount); await _context.SaveChangesAsync(); return(RedirectToAction("SubAccounts")); } var mainAccList = new List <MainAccount>(); mainAccList = _context.MainAccount.Where(r => r.CompanyID == CompID).ToList(); mainAccList.RemoveAll(r => r.MainAccountNumber == "00"); ViewData["MainAccount"] = new SelectList(mainAccList, "MainAccountID", "AccountName"); return(View(subAccount)); }
public static void Main(string[] args) { //Login Account akount = new Account("Enter your sid here", "Enter your authtoken here", "https://cloud.restcomm.com/restcomm/2012-04-24/"); //prints Sid of Account Console.WriteLine(akount.Properties.sid); List <SubAccount> subaccounts = akount.GetSubAccountList(); Console.WriteLine(subaccounts[0].Properties.sid); //Creates Subaccount SubAccount subaccount = akount.CreateSubAccount("DemoAccounts", "*****@*****.**", "Demo@123"); //prints name of subaccount Console.WriteLine(subaccount.Properties.friendly_name); //Changes the password subaccount.ChangePassword("Demo@123456"); //Closes the subaccount subaccount.CloseSubAccount(); Console.ReadLine(); }
public async Task <IActionResult> PutSubAccount(int id, SubAccount subAccount) { if (id != subAccount.ID) { return(BadRequest()); } _context.Entry(subAccount).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SubAccountExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void CreateSubAount() { SubAccount a = akount.CreateSubAccount("Test", "*****@*****.**", "Demo@1234"); Assert.IsNotEmpty(a.Properties.Sid); a.CloseSubAccount(); }
public void ConvertAPIToSDK() { apiSubAccount = CreateTypicalAPISubAccount(); converter = new SubAccountConverter(apiSubAccount); SubAccount subAccount = converter.ToSDKSubAccount(); Assert.IsNotNull(subAccount); }
public void ConvertSDKToSDK() { sdkSubAccount = CreateTypicalSDKSubAccount(); converter = new SubAccountConverter(sdkSubAccount); SubAccount subAccount = converter.ToSDKSubAccount(); Assert.IsNotNull(subAccount); Assert.AreEqual(sdkSubAccount, subAccount); }
/// <summary> /// Public API for fetching an Agent /// </summary> /// <param name="agent_username">Username of the agent to be fetched.</param> /// <returns>Fetched Agent object</returns> public async Task <Agent> getAgent(string agent_username) { await session.login(); Agent createdAgent = null; HttpResponseMessage httpResponseMessage = null;; try { httpResponseMessage = await this.getAgentOnly(agent_username); var responseJson = await httpResponseMessage.Content.ReadAsStringAsync(); createdAgent = JObject.Parse(responseJson).ToObject <Agent>(); } catch (Exception e) { if (httpResponseMessage.StatusCode.Equals(HttpStatusCode.NotFound)) { Console.WriteLine("Agent " + agent_username + "Not found"); } else { throw e; } } SubAccount subAccount = await session.getSubAccount(); int subAccountId = subAccount.ID; Station createdStation = null; try { httpResponseMessage = await this.getStationOnly(subAccountId); var responseJson = await httpResponseMessage.Content.ReadAsStringAsync(); List <Station> agentStations = JsonConvert.DeserializeObject <IEnumerable <Station> >(responseJson).ToList(); createdStation = agentStations.Single(a => a.agentUsername == agent_username); } catch (Exception e) { if (httpResponseMessage.StatusCode.Equals(HttpStatusCode.NotFound)) { Console.WriteLine("Station for agent " + agent_username + "Not found"); } else { throw e; } } if (createdStation != null) { Console.WriteLine("Agent exist with username " + agent_username + " and station " + createdStation.stationName); } return(createdAgent); }
public static SubAccount SubAccount(int?counter) { var rtValue = new SubAccount(); rtValue.AccountNumber = "Acc" + counter.Extra(); rtValue.Name = "Name" + counter.Extra(); rtValue.SubAccountNumber = "Sub" + counter.Extra(); return(rtValue); }
public void Initialize_Page() { Sub_Account = new SubAccount(); FromDateTxt.Text = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day; ToDateTxt.Text = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day; AccountDropID.DataSource = db.SubAccount.ToList();//.GetAllSub();// GetSubAccount_ByUpID(1101); AccountDropID.DataTextField = "name"; AccountDropID.DataValueField = "ID"; AccountDropID.DataBind(); }
public void Initialize_Page() { Sub_Account = new SubAccount(); ToDateTxt.Text = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day; Dropdownlist1.DataSource = db.MainAccount.ToList();// mainaccount.GetAllMain(); Dropdownlist1.DataTextField = "name"; Dropdownlist1.DataValueField = "ID"; Dropdownlist1.DataBind(); FillDrops(); }
public SubAccount Build() { SubAccount subAccount = new SubAccount(); subAccount.Name = name; subAccount.ParentAccountId = parentAccountId; subAccount.Language = language; subAccount.TimezoneId = timezoneId; return(subAccount); }
public void Initialize_Page() { Sub_Account = new SubAccount(); FromDateTxt.Text = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day; ToDateTxt.Text = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day; AccountDropID.DataSource = db.Cars.ToList(); //db.SubAccount.ToList().Where(s => s.MainAccount_id == 1101).ToList();// Sub_Account.GetSubAccount_ByUpID(1101); AccountDropID.DataTextField = "CarNo"; AccountDropID.DataValueField = "id"; AccountDropID.DataBind(); }
public void SearchFn(int AccountID) { EditFlag = true; AddErrorTxt.Text = ""; Sub_Account = new SubAccount(); Sub_Account_List = new List <SubAccount>(); int level = 4; Sub_Account = db.SubAccount.ToList().Where(s => s.ID == AccountID).FirstOrDefault(); // Sub_Account.GetSubAccount_ByID(AccountID).ElementAtOrDefault(0); level = (int)Sub_Account.Level; SubAccount Sub_Account1 = db.SubAccount.ToList().Where(s => s.ID == AccountID).FirstOrDefault(); // Sub_Account.GetSubAccount_ByID(AccountID).ElementAtOrDefault(0); if (Sub_Account1 != null) { AccountNoForSearchDrop.SelectedValue = Sub_Account1.ID.ToString(); } AccountIDTxt.Text = Sub_Account1.ID.ToString(); SubAccountManulID = int.Parse(AccountIDTxt.Text); AccountNameTxt.Text = Sub_Account1.name; DateTxt.Text = ExtendedMethod.ParseDateToString((DateTime)Sub_Account1.RegisterDate); AccountStateDrop.SelectedValue = Sub_Account1.BType; BalanceTxt.Text = Sub_Account1.ABalance.ToString(); Indx PersonalIndx = new Indx(); try { PersonalIndx = db.Indx.ToList().Where(i => i.Sub_ID == Int64.Parse(AccountIDTxt.Text)).FirstOrDefault();// PersonalIndx.GetIndx_BySubID(Int64.Parse(AccountIDTxt.Text)).FirstOrDefault(); if (PersonalIndx.ClientCategory != "") { ClientCategoryList.SelectedItem.Text = PersonalIndx.ClientCategory; } if (PersonalIndx.ClientType != "") { ClentTypelist.SelectedItem.Text = PersonalIndx.ClientType; } if (PersonalIndx.SalesUesrId.ToString() != "") { SalesUesrId.SelectedValue = PersonalIndx.SalesUesrId.ToString(); } ResponsiblePersonName.Text = PersonalIndx.ResponsiblePersonName; ResponsiblePersonPhone.Text = PersonalIndx.ResponsiblePersonPhone; AnotherResponsiblePersonPhone.Text = PersonalIndx.AnotherResponsiblePersonPhone; EmailTxt.Text = PersonalIndx.Email;; Addess.Text = PersonalIndx.Address; Sgl_TaxNO.Text = PersonalIndx.Sgl_TaxNO; CommercialDocument.Text = PersonalIndx.CommercialDocument; TaxDocument.Text = PersonalIndx.TaxDocument; PersonalIndx.Sub_ID = Int64.Parse(AccountIDTxt.Text); } catch (Exception ex) { } OldSubAccountManul = SubAccountManulID; }
public async Task <object> Add(SubAccount model) { SubAccountsDetails subAccountsDetails = new SubAccountsDetails(); subAccountsDetails.User = await _userManager.FindByNameAsync(model.UserName); subAccountsDetails.Name = model.Name; subAccountsDetails.Password = model.Password; subAccountsDetails.Role = "Customer"; return(Ok(model)); }
private async Task <string> chooseSubAccountAppId(string argSubAccountAppId) { if (null == argSubAccountAppId) { SubAccount subAccount = await session.getSubAccount(); string subAccountAppId = subAccount.AppID; return(subAccountAppId); } return(argSubAccountAppId); }
public void Initializ_Page() { //financial Position initial FinancialPos.Checked = false; FinancialPosTypeList.Enabled = false; AddRelatednumList.Enabled = false; // Khzna_Moved = new KhznaMoved(); Sub_Account = new SubAccount(); MonyTypeDrop.SelectedIndex = 0; //رقم الاذن int MoveID = db.KhznaMoved.ToList().Where(o => o.state == false).Max(k => k.ID) + 1;// Khzna_Moved.maxid(0); OperationID.Enabled = false; OperationID.Text = MoveID.ToString(); //القيمة Value.Text = ""; //من FromSubAccountsID.DataSource = db.SubAccount.ToList().Where(o => o.MainAccount_id != 1103).ToList();// Sub_Account.GetAllSubNotKhazna();//.Select(c=>c.name); FromSubAccountsID.DataValueField = "ID"; FromSubAccountsID.DataTextField = "name"; FromSubAccountsID.DataBind(); //الى ToKhaznaDropRow.Visible = true; ToKhaznaDrop.DataSource = db.SubAccount.ToList().Where(o => o.MainAccount_id == 1103).ToList();//Sub_Account.GetSubAccount_ByUpID(1103); ToKhaznaDrop.DataValueField = "ID"; ToKhaznaDrop.DataTextField = "name"; ToKhaznaDrop.DataBind(); //الملاحظات DescTxt.Text = ""; //التاريخ //ReceivedDate.Text = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day; ChecqRow.Visible = false; //BankNameRow.Visible = false; SarfDateTxt.Text = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day; SarfDateRow.Visible = false; Khzna_Moved_List_static = db.KhznaMoved.ToList().Where(k => k.state == false).ToList();// Khzna_Moved.GetKhznaMovedBystate(0); if (Khzna_Moved_List_static.Count > 0) { MonyInSearchBtn.Enabled = true; MonyInsForSerachDrop.DataSource = Khzna_Moved_List_static.Select(KM => KM.ID); MonyInsForSerachDrop.DataBind(); } else { MonyInSearchBtn.Enabled = false; } DeleteMonyInBtn.Enabled = false; ChequeNoTxt.Text = ""; //BankDropID.SelectedIndex = 0; EditFlag = false; //CheckForPrivilage(); }
private SubAccount CreateTypicalSDKSubAccount() { SubAccount subAccount = new SubAccount(); subAccount.Language = SUBACCOUNT_LANGUAGE; subAccount.TimezoneId = SUBACCOUNT_TIMEZONE_ID; subAccount.ParentAccountId = SUBACCOUNT_PARENT_ACCOUNT_ID; subAccount.Name = SUBACCOUNT_NAME; return(subAccount); }
public void Initialize_Page() { Sub_Account = new SubAccount(); FromDateTxt.Text = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day; ToDateTxt.Text = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day; AccountDropID.DataSource = db.SubAccount.ToList().Where(s => s.MainAccount_id == 2103).ToList(); //Sub_Account.GetSubAccount_ByUpID(2103); AccountDropID.DataTextField = "name"; AccountDropID.DataValueField = "ID"; AccountDropID.DataBind(); SuppliersOperationsGrd.Visible = false; }
public IActionResult DeleteSubAccount(long id) { SubAccount fin = SubAccount_repo.Find(id); if (fin == null) { return(NotFound()); } SubAccount_repo.Delete(fin); return(Ok()); }
public void SubAccountListing() { List <SubAccount> subaccountlist = akount.GetSubAccountList(); if (subaccountlist.Count == 0) { SubAccount a = akount.CreateSubAccount("Test", "*****@*****.**", "Demo@1234"); subaccountlist = akount.GetSubAccountList(); Assert.AreNotEqual(subaccountlist.Count, 0); a.CloseSubAccount(); } }
public void ConvertSDKToAPI() { sdkSubAccount = CreateTypicalSDKSubAccount(); converter = new SubAccountConverter(sdkSubAccount); OneSpanSign.API.SubAccount subAccount = converter.ToAPISubAccount(); Assert.IsNotNull(subAccount); Assert.AreEqual(SUBACCOUNT_LANGUAGE, subAccount.Language, "language was not set correctly"); Assert.AreEqual(SUBACCOUNT_NAME, subAccount.Name, "Name was not set correctly"); Assert.AreEqual(SUBACCOUNT_TIMEZONE_ID, subAccount.TimezoneId, "TimezoneId was not set correctly"); Assert.AreEqual(SUBACCOUNT_PARENT_ACCOUNT_ID, subAccount.ParentAccountId, "ParentAccountId was not set correctly"); }
public void CreateSubAccount() { var paradictionary = new Dictionary <string, string>(); paradictionary.Add("FriendlyName", "password"); paradictionary.Add("EmailAddress", "b"); paradictionary.Add("Password", "c"); MockServer.AddPostRequest("/restcomm/2012-04-24/Accounts.json/", paradictionary, loginresponse); SubAccount a = akount.CreateSubAccount("password", "b", "c"); Assert.IsNotNull(a.Properties.friendly_name); }
protected void Delete_Click(object sender, EventArgs e) { if (EditFlag == true) { Main_Account = new MainAccount(); Main_Account_List = new List <MainAccount>(); Sub_Account = new SubAccount(); Sub_Account_List = new List <SubAccount>(); AccountIDTxt.Text = subAccountID.ToString(); int AccountID = int.Parse(AccountIDTxt.Text); try { int level = int.Parse(AccountLevelDrop.SelectedValue); if (level < 4)//Main account { Main_Account = db.MainAccount.Where(main => main.ID == AccountID).FirstOrDefault(); if (Main_Account != null) { db.MainAccount.Remove(Main_Account); db.SaveChanges(); } } else//SubAccount { Sub_Account = db.SubAccount.Where(sub => sub.ID == AccountID).FirstOrDefault(); if (Sub_Account != null) { db.SubAccount.Remove(Sub_Account); db.SaveChanges(); } } AddErrorTxt.Text = "تم الحذف"; AddErrorTxt.ForeColor = System.Drawing.Color.Green; Initialize_Page(); } catch (Exception ex) { AddErrorTxt.Text = " حدث خطأ لا يمكن الحذف من فضلك تأكد من مسح الحسابات الفرعية منه"; AddErrorTxt.ForeColor = System.Drawing.Color.Red; } } else { AddErrorTxt.Text = "من فضلك ابحث عن حساب اولا"; AddErrorTxt.ForeColor = System.Drawing.Color.Red; } }
public void Initialize_Page() { Sub_Account = new SubAccount(); ToDateTxt.Text = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day; AccountDropID.DataSource = db.SubAccount.ToList().Where(o => o.MainAccount_id == 1103).ToList();// Sub_Account.GetSubAccount_ByUpID(1103); AccountDropID.DataTextField = "name"; AccountDropID.DataValueField = "ID"; AccountDropID.DataBind(); EntryGrdV.DataSource = null; EntryGrdV.DataBind(); SaveBtn.Visible = false; Khazna_Moved_List = new List <KhznaMoved>(); NewEntryTxtID.Text = ""; TotalText.Text = ""; }
public void setAccoutID() { Sub_Account = new SubAccount(); try { Int64 AccountID = (Int64)db.SubAccount.ToList().Max(o => o.MainAccount_id) + 1; if (AccountID == 1) { AccountID = int.Parse(2103.ToString() + "0001"); } AccountIDTxt.Text = AccountID.ToString(); SubAccountManulID = int.Parse(AccountIDTxt.Text); } catch (Exception ex) { } }
public void Setup() { authentication = new Authentication(apiKey: MonitisAccountInformation.ApiKey, secretKey: MonitisAccountInformation.SekretKey); subAccount=new SubAccount(); subAccount.SetAuthenticationParams(authentication); //Add 1 subaccount for test, if no subaccount exist var subAccounts = subAccount.GetSubAccounts(); int countOfSubAccounts = subAccounts.Length; if (countOfSubAccounts == 0) AddSubAccount(OutputType.JSON); //Cannot be more than 5 subaccounts else if (countOfSubAccounts==5) { subAccount.DeleteSubAccount(subAccounts.Last().id); } }
public void InsertAccountTest() { SubAccount account = new SubAccount() { AccountNumber = "MK0003", AccountName = "Mikel Account 2", ContactId = 1, ContactRole = "Owner/Operator", BillingMethod = BillingMethod.CreditCard, EmailBillDataFile = true, EmailBill = true, PostBill = true, BillingAddressType = BillingAddressType.Physical, Password = "******", IsInvoiceRoot = false, MasterAccountId = 1, HasRequestedInvoicing = true }; accountRepository.InsertAccount(account); Assert.IsNotNull(account.Id); AirtimeBillingDataContext db = DbFactory.GetDataContext(); var saved = db.Accounts.Where(a => a.AccountId == account.Id.Value).SingleOrDefault(); Assert.IsNotNull(saved); Assert.AreEqual(account.AccountNumber, saved.AccountNumber, "Account Number"); Assert.AreEqual(account.AccountName, saved.AccountName, "Account Name"); Assert.AreEqual(account.ContactId, saved.ContactId, "Contact Id"); Assert.AreEqual(account.ContactRole, saved.ContactRole, "Contact Role"); Assert.AreEqual((int)account.BillingMethod, saved.BillingMethod, "Billing Method"); Assert.AreEqual(account.EmailBillDataFile, saved.EmailBillDataFile, "Email Bill Data File"); Assert.AreEqual(account.EmailBill, saved.EmailBill, "Email Bill"); Assert.AreEqual(account.PostBill, saved.PostBill, "Post Bill"); Assert.AreEqual((int)account.BillingAddressType, saved.BillingAddressType, "Billing Address Type"); Assert.AreEqual(account.Password, saved.Password, "Password"); Assert.AreEqual(account.IsInvoiceRoot, saved.IsInvoiceRoot, "Is Invoice Root"); Assert.AreEqual(account.HasRequestedInvoicing, saved.HasRequestedInvoicing, "Has Requested Invoicing"); }
public static SubAccount SubAccount(int? counter) { var rtValue = new SubAccount(); rtValue.AccountNumber = "Acc" + counter.Extra(); rtValue.Name = "Name" + counter.Extra(); rtValue.SubAccountNumber = "Sub" + counter.Extra(); return rtValue; }