public static int Insert(int parent_organisation_id, bool use_parent_offernig_prices, int organisation_type_id, int organisation_customer_type_id, string name, string acn, string abn, bool is_debtor, bool is_creditor, string bpay_account, int weeks_per_service_cycle, DateTime start_date, DateTime end_date, string comment, int free_services, bool excl_sun, bool excl_mon, bool excl_tue, bool excl_wed, bool excl_thu, bool excl_fri, bool excl_sat, TimeSpan sun_start_time, TimeSpan sun_end_time, TimeSpan mon_start_time, TimeSpan mon_end_time, TimeSpan tue_start_time, TimeSpan tue_end_time, TimeSpan wed_start_time, TimeSpan wed_end_time, TimeSpan thu_start_time, TimeSpan thu_end_time, TimeSpan fri_start_time, TimeSpan fri_end_time, TimeSpan sat_start_time, TimeSpan sat_end_time, TimeSpan sun_lunch_start_time, TimeSpan sun_lunch_end_time, TimeSpan mon_lunch_start_time, TimeSpan mon_lunch_end_time, TimeSpan tue_lunch_start_time, TimeSpan tue_lunch_end_time, TimeSpan wed_lunch_start_time, TimeSpan wed_lunch_end_time, TimeSpan thu_lunch_start_time, TimeSpan thu_lunch_end_time, TimeSpan fri_lunch_start_time, TimeSpan fri_lunch_end_time, TimeSpan sat_lunch_start_time, TimeSpan sat_lunch_end_time, DateTime last_batch_run) { int entityID = EntityDB.Insert(); name = name.Replace("'", "''"); acn = acn.Replace("'", "''"); abn = abn.Replace("'", "''"); bpay_account = bpay_account.Replace("'", "''"); comment = comment.Replace("'", "''"); string sql = "INSERT INTO Organisation (entity_id,parent_organisation_id,use_parent_offernig_prices,organisation_type_id,organisation_customer_type_id,name,acn,abn,is_debtor,is_creditor,bpay_account,weeks_per_service_cycle,start_date,end_date,comment,free_services,excl_sun,excl_mon,excl_tue,excl_wed,excl_thu,excl_fri,excl_sat,sun_start_time,sun_end_time,mon_start_time,mon_end_time,tue_start_time,tue_end_time,wed_start_time,wed_end_time,thu_start_time,thu_end_time,fri_start_time,fri_end_time,sat_start_time,sat_end_time,sun_lunch_start_time,sun_lunch_end_time,mon_lunch_start_time,mon_lunch_end_time,tue_lunch_start_time,tue_lunch_end_time,wed_lunch_start_time,wed_lunch_end_time,thu_lunch_start_time,thu_lunch_end_time,fri_lunch_start_time,fri_lunch_end_time,sat_lunch_start_time,sat_lunch_end_time,last_batch_run) VALUES (" + entityID.ToString() + "," + (parent_organisation_id == 0 ? "NULL" : parent_organisation_id.ToString()) + "," + (use_parent_offernig_prices ? "1" : "0") + "," + organisation_type_id + "," + organisation_customer_type_id + ",'" + name + "'," + "'" + acn + "'," + "'" + abn + "'," + (is_debtor ? "1," : "0,") + (is_creditor ? "1," : "0,") + "'" + bpay_account + "'," + weeks_per_service_cycle + "," + (start_date == DateTime.MinValue ? "NULL" : "'" + start_date.ToString("yyyy-MM-dd HH:mm:ss") + "'") + "," + (end_date == DateTime.MinValue ? "NULL" : "'" + end_date.ToString("yyyy-MM-dd HH:mm:ss") + "'") + "," + "'" + comment + "'," + "" + free_services + "," + (excl_sun ? "1," : "0,") + (excl_mon ? "1," : "0,") + (excl_tue ? "1," : "0,") + (excl_wed ? "1," : "0,") + (excl_thu ? "1," : "0,") + (excl_fri ? "1," : "0,") + (excl_sat ? "1," : "0,") + "'" + sun_start_time.ToString() + "'," + "'" + sun_end_time.ToString() + "'," + "'" + mon_start_time.ToString() + "'," + "'" + mon_end_time.ToString() + "'," + "'" + tue_start_time.ToString() + "'," + "'" + tue_end_time.ToString() + "'," + "'" + wed_start_time.ToString() + "'," + "'" + wed_end_time.ToString() + "'," + "'" + thu_start_time.ToString() + "'," + "'" + thu_end_time.ToString() + "'," + "'" + fri_start_time.ToString() + "'," + "'" + fri_end_time.ToString() + "'," + "'" + sat_start_time.ToString() + "'," + "'" + sat_end_time.ToString() + "'," + "'" + sun_lunch_start_time.ToString() + "'," + "'" + sun_lunch_end_time.ToString() + "'," + "'" + mon_lunch_start_time.ToString() + "'," + "'" + mon_lunch_end_time.ToString() + "'," + "'" + tue_lunch_start_time.ToString() + "'," + "'" + tue_lunch_end_time.ToString() + "'," + "'" + wed_lunch_start_time.ToString() + "'," + "'" + wed_lunch_end_time.ToString() + "'," + "'" + thu_lunch_start_time.ToString() + "'," + "'" + thu_lunch_end_time.ToString() + "'," + "'" + fri_lunch_start_time.ToString() + "'," + "'" + fri_lunch_end_time.ToString() + "'," + "'" + sat_lunch_start_time.ToString() + "'," + "'" + sat_lunch_end_time.ToString() + "'," + (last_batch_run == DateTime.MinValue ? "NULL" : "'" + last_batch_run.ToString("yyyy-MM-dd HH:mm:ss") + "'") + ");SELECT SCOPE_IDENTITY();"; return(Convert.ToInt32(DBBase.ExecuteSingleResult(sql))); }
public static int Insert(string name, int site_type_id, string abn, string acn, string tfn, string asic, bool is_provider, string bank_bpay, string bank_bsb, string bank_account, string bank_direct_debit_userid, string bank_username, decimal oustanding_balance_warning, bool print_epc, bool excl_sun, bool excl_mon, bool excl_tue, bool excl_wed, bool excl_thu, bool excl_fri, bool excl_sat, TimeSpan day_start_time, TimeSpan lunch_start_time, TimeSpan lunch_end_time, TimeSpan day_end_time, DateTime fiscal_yr_end, int num_booking_months_to_get) { int entityID = EntityDB.Insert(); name = name.Replace("'", "''"); abn = abn.Replace("'", "''"); acn = acn.Replace("'", "''"); tfn = tfn.Replace("'", "''"); asic = asic.Replace("'", "''"); bank_bpay = bank_bpay.Replace("'", "''"); bank_bsb = bank_bsb.Replace("'", "''"); bank_account = bank_account.Replace("'", "''"); bank_direct_debit_userid = bank_direct_debit_userid.Replace("'", "''"); bank_username = bank_username.Replace("'", "''"); string sql = "INSERT INTO Site (entity_id,name,site_type_id,abn,acn,tfn,asic,is_provider,bank_bpay,bank_bsb,bank_account,bank_direct_debit_userid,bank_username,oustanding_balance_warning,print_epc,excl_sun,excl_mon,excl_tue,excl_wed,excl_thu,excl_fri,excl_sat,day_start_time,lunch_start_time,lunch_end_time,day_end_time,fiscal_yr_end,num_booking_months_to_get) VALUES (" + entityID + "" + "'" + name + "'," + site_type_id + ",'" + abn + "'," + "'" + acn + "'," + "'" + tfn + "'," + "'" + asic + "'," + (is_provider ? "1," : "0,") + "'" + bank_bpay + "'," + "'" + bank_bsb + "'," + "'" + bank_account + "'," + "'" + bank_direct_debit_userid + "'," + "'" + bank_username + "'," + "" + oustanding_balance_warning + "," + (print_epc ? "1," : "0,") + (excl_sun ? "1," : "0,") + (excl_mon ? "1," : "0,") + (excl_tue ? "1," : "0,") + (excl_wed ? "1," : "0,") + (excl_thu ? "1," : "0,") + (excl_fri ? "1," : "0,") + (excl_sat ? "1," : "0,") + "'" + day_start_time.ToString() + "'," + "'" + lunch_start_time.ToString() + "'," + "'" + lunch_end_time.ToString() + "'," + "'" + day_end_time.ToString() + "'," + "'" + fiscal_yr_end.ToString("yyyy-MM-dd HH:mm:ss") + "'," + "" + num_booking_months_to_get + "" + ");SELECT SCOPE_IDENTITY();"; return(Convert.ToInt32(DBBase.ExecuteSingleResult(sql))); }
public static int Insert(int added_by, int title_id, string firstname, string middlename, string surname, string nickname, string gender, DateTime dob) { if (added_by < 0) { throw new CustomMessageException("Support staff can not add people to the system. To do this, login as a standard user"); } int entityID = EntityDB.Insert(); firstname = firstname.Trim().Replace("'", "''"); middlename = middlename.Trim().Replace("'", "''"); surname = surname.Trim().Replace("'", "''"); nickname = nickname.Trim().Replace("'", "''"); gender = gender.Replace("'", "''"); string sql = "INSERT INTO Person (entity_id,added_by,title_id,firstname,middlename,surname,nickname,gender,dob) VALUES (" + entityID.ToString() + "," + added_by + "," + title_id + "," + "'" + firstname + "'," + "'" + middlename + "'," + "'" + surname + "'," + "'" + nickname + "'," + "'" + gender + "'," + (dob == DateTime.MinValue ? "NULL" : "'" + dob.ToString("yyyy-MM-dd HH:mm:ss") + "'") + ");SELECT SCOPE_IDENTITY();"; return(Convert.ToInt32(DBBase.ExecuteSingleResult(sql))); }