public IActionResult PurchaseRateApplicability(List <PurchaseRateApplicability> PurchaseRateApplicabilityList) { Unions UnionsModel = GetLastRecord <Unions>("tbl_unions"); QueryParam Query = new QueryParam { Fields = "*" }; IEnumerable <Shift> shiftList = NewRepo.FindAll <Shift>(Query); int code = NewRepo.Find <int>(new QueryParam { DirectQuery = "select IFNULL(max(rate_app_code),0) from tbl_purchase_rate_applicability" }); foreach (PurchaseRateApplicability PurchaseRateApplicabilityModel in PurchaseRateApplicabilityList) { Data = new List <ModelParameter>(); if (PurchaseRateApplicabilityModel.module_name.ToLower() == "dcs") { if (PurchaseRateApplicabilityModel.rate_for == "farmer_collection") { PurchaseRateApplicabilityModel.rate_app_code = (code + 1).ToString(); PurchaseRateApplicabilityModel.ref_code = PurchaseRateApplicabilityModel.applicability_unique_code; PurchaseRateApplicabilityModel.originating_org_code = PurchaseRateApplicabilityModel.union_code = UnionsModel.union_code; PurchaseRateApplicabilityModel.dcs_code = PurchaseRateApplicabilityModel.module_code; PurchaseRateApplicabilityModel.shift_code = shiftList.Where(x => x.short_name.ToLower() == PurchaseRateApplicabilityModel.shift.ToLower()).Select(x => x.id).FirstOrDefault(); string time = PurchaseRateApplicabilityModel.wef_date.ToString("yyyy-MM-dd") + " " + shiftList.Where(x => x.short_name.ToLower() == PurchaseRateApplicabilityModel.shift.ToLower()).Select(x => x.shift_time.ToString(@"hh\:mm\:ss")).FirstOrDefault(); PurchaseRateApplicabilityModel.wef_date = DateHelper.ParseDate(time); Data.Add(new ModelParameter { SaveModel = PurchaseRateApplicabilityModel, ValidateModel = new PurchaseRateApplicabilityValidator() }); SaveData(PurchaseRateApplicabilityModel.applicability_unique_code); } } } return(new CustomResult("success", _response)); }
public static Unions CreateUnions(string unionId) { Unions unions = new Unions(); unions.UnionId = unionId; return(unions); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (DepartureSearches != null) { hashCode = hashCode * 59 + DepartureSearches.GetHashCode(); } if (ArrivalSearches != null) { hashCode = hashCode * 59 + ArrivalSearches.GetHashCode(); } if (Unions != null) { hashCode = hashCode * 59 + Unions.GetHashCode(); } if (Intersections != null) { hashCode = hashCode * 59 + Intersections.GetHashCode(); } return(hashCode); } }
public static IEnumerable <UnionInfo> Cast(this Unions src) { foreach (UnionInfo item in src) { yield return(item); } }
public void ClearResults() { Clubs.Clear(); Persons.Clear(); Competitions.Clear(); Unions.Clear(); }
async Task ExecuteLoadSearchResultsCommand(string term) { IsBusy = true; try { var results = await SportnetStore.GetSearchResults(term); Clubs.Clear(); Persons.Clear(); Competitions.Clear(); Unions.Clear(); foreach (var item in results) { switch (item.Type) { case "person": Persons.Add(item); break; case "club": Clubs.Add(item); break; case "competition": Competitions.Add(item); break; case "union": Unions.Add(item); break; default: break; } } IsLoaded = true; } catch (Exception ex) { Debug.WriteLine(ex); var log = new ErrorLog() { ExceptionType = ex.GetType().ToString(), Status = ErrorLog.LogStatus.Unread, Message = ex.Message, ObjectId = term, Action = "Searching", Datetime = DateTime.Now, }; await LogError(log); } finally { IsBusy = false; } }
public IActionResult SaveMpp(List <Dcs> DcsList) { Unions UnionsModel = GetLastRecord <Unions>("tbl_unions"); MccPlant MccPlantModel = GetLastRecord <MccPlant>("tbl_mcc_plant"); foreach (Dcs DcsModel in DcsList) { Data = new List <ModelParameter>(); if (DcsModel.dcs_code != "") { Dcs NewModel = NewRepo.FindByKey <Dcs>(DcsModel.dcs_code); if (NewModel == null) { if (UnionsModel.has_mcc == true) { DcsModel.mcc_plant_code = MccPlantModel.mcc_plant_code; } else { DcsModel.mcc_plant_code = DcsModel.bmc_code; } DcsModel.ref_code = DcsModel.dcs_code.PadLeft(15, '0'); DcsModel.originating_org_code = DcsModel.union_code = MccPlantModel.union_code; DcsModel.plant_code = MccPlantModel.plant_code; DcsModel.x_col1 = SetDcsXcol(DcsModel.allow_multiple_milktype); Data.Add(new ModelParameter { SaveModel = DcsModel, ValidateModel = new DcsValidator() }); } else { NewModel.dcs_name = DcsModel.dcs_name; NewModel.bmc_code = DcsModel.bmc_code; NewModel.route_code = DcsModel.route_code; NewModel.is_active = DcsModel.is_active; NewModel.contact_person = DcsModel.contact_person; NewModel.mobile_no = DcsModel.mobile_no; NewModel.allow_multiple_milktype = DcsModel.allow_multiple_milktype; NewModel.x_col1 = SetDcsXcol(DcsModel.allow_multiple_milktype); NewModel.model_operation = "update"; Data.Add(new ModelParameter { SaveModel = NewModel, ValidateModel = new DcsValidator() }); } SaveData(DcsModel.dcs_code); } else { _response.Add(new CustomResponse { status = "300", msg = "error:dcs_code" }); } } return(new CustomResult("success", _response)); }
public SelectClause GetSingleSelect() { var union = Unions.Single(); if (union.Type.HasValue) { throw new InvalidOperationException("Assertion failure. Expected single select without unions"); } return(union.SelectClause); }
void Awake() { #region Singleton if (s_Instance != null) { Destroy(gameObject); return; } s_Instance = this; #endregion }
/// <summary> /// Adds a UNION ALL clause to the query, which is used to combine the results of two or more /// SELECT statements and it does not remove duplicate rows between the various SELECT statements. /// </summary> /// <param name="query">The query to compound in this query statement</param> /// <returns>Returns this instance of <see cref="SelectQueryBuilder"/></returns> public SelectQueryBuilder UnionAll(SelectQueryBuilder query) { var statement = new UnionStatement() { Type = UnionType.UnionAll, Query = query }; Unions.Add(statement); return(this); }
/// <summary> /// Adds an INTERSECT operator to the query, which returns the intersection of 2 or more datasets /// </summary> /// <param name="table">The table to intersect</param> /// <returns>Returns a new instance of <see cref="SelectQueryBuilder"/> for the union query.</returns> public SelectQueryBuilder Intersect(string table) { var statement = new UnionStatement() { Type = UnionType.Intersect, Query = new SelectQueryBuilder(Context).From(table) }; Unions.Add(statement); return(statement.Query); }
/// <summary> /// Adds an INTERSECT operator to the query, which returns the intersection of 2 or more datasets /// </summary> /// <param name="query">The query to compound in this query statement</param> /// <returns>Returns this instance of <see cref="SelectQueryBuilder"/></returns> public SelectQueryBuilder Intersect(SelectQueryBuilder query) { var statement = new UnionStatement() { Type = UnionType.Intersect, Query = query }; Unions.Add(statement); return(this); }
public IActionResult SaveRoute(List <Route> RouteList) { Unions UnionsModel = GetLastRecord <Unions>("tbl_unions"); foreach (Route RouteModel in RouteList) { Data = new List <ModelParameter>(); if (RouteModel.route_code != "") { Route NewModel = NewRepo.FindByKey <Route>(RouteModel.route_code); if (RouteModel.route_type == null || RouteModel.route_type == "") { RouteModel.route_type = "Can"; } if (NewModel == null) { RouteModel.vehicle_type_code = (RouteModel.route_type == "Can") ? 1 : 2; RouteModel.to_dest = RouteModel.bmc_code; RouteModel.to_type = "bmc"; RouteModel.ref_code = RouteModel.route_code; RouteModel.union_code = RouteModel.originating_org_code = UnionsModel.union_code; Data.Add(new ModelParameter { SaveModel = RouteModel, ValidateModel = new RouteValidator() }); } else { NewModel.vehicle_type_code = (RouteModel.route_type == "Can") ? 1 : 2; NewModel.to_dest = RouteModel.bmc_code; NewModel.bmc_code = RouteModel.bmc_code; NewModel.route_name = RouteModel.route_name; NewModel.is_active = RouteModel.is_active; NewModel.route_supervisor_name = RouteModel.route_supervisor_name; NewModel.contact_no = RouteModel.contact_no; NewModel.model_operation = "update"; Data.Add(new ModelParameter { SaveModel = NewModel, ValidateModel = new RouteValidator() }); } SaveData(RouteModel.route_code); } else { _response.Add(new CustomResponse { status = "300", msg = "error:route_code" }); } } return(new CustomResult("success", _response)); }
///<inheritdoc/> public bool Equals(SelectQuery other) { bool equals = false; if (other != null && other.PageSize == PageSize && other.PageIndex == PageIndex && other.Alias == Alias) { equals = Columns.SequenceEqual(other.Columns) && ((WhereCriteria == null && other.WhereCriteria == null) || WhereCriteria.Equals(other.WhereCriteria)) && Tables.SequenceEqual(other.Tables) && Unions.SequenceEqual(other.Unions) && Sorts.SequenceEqual(other?.Sorts); } return(equals); }
public int CountComponents(int n, int[][] edges) { Unions dsu = new Unions(n); foreach (var edge in edges) { dsu.Union(edge[0], edge[1]); } ISet <int> roots = new HashSet <int>(); for (int i = 0; i < n; i++) { roots.Add(dsu.Find(i)); } return(roots.Count); }
/// <summary> /// Returns true if RequestTimeMap instances are equal /// </summary> /// <param name="other">Instance of RequestTimeMap to be compared</param> /// <returns>Boolean</returns> public bool Equals(RequestTimeMap other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( DepartureSearches == other.DepartureSearches || DepartureSearches != null && other.DepartureSearches != null && DepartureSearches.SequenceEqual(other.DepartureSearches) ) && ( ArrivalSearches == other.ArrivalSearches || ArrivalSearches != null && other.ArrivalSearches != null && ArrivalSearches.SequenceEqual(other.ArrivalSearches) ) && ( Unions == other.Unions || Unions != null && other.Unions != null && Unions.SequenceEqual(other.Unions) ) && ( Intersections == other.Intersections || Intersections != null && other.Intersections != null && Intersections.SequenceEqual(other.Intersections) )); }
/// <summary> /// Union /// </summary> /// <returns></returns> public virtual QueryDTO Union() { if (OrderBys != null) { throw new DTOException("使用Union不能使用Order By"); } Union union = new Union(); union.QueryWhere = QueryWhere; union.QueryHaving = QueryHaving; union.Selects = Selects; union.GroupBys = GroupBys; union.OrderBys = OrderBys; union.Joins = Joins; union.DTOtype = DTOtype; Unions.Add(union); Selects = null; QueryWhere = null; QueryHaving = null; GroupBys = null; OrderBys = null; Joins = null; return(this); }
public IActionResult SaveMember(List <Member> MemberList) { Unions UnionsModel = GetLastRecord <Unions>("tbl_unions"); foreach (Member MemberModel in MemberList) { Data = new List <ModelParameter>(); if (MemberModel.member_unique_code.Trim() != "") { if (MemberModel.member_code.Length > 4) { return(new CustomResult("success", new CustomResponse { status = "300", msg = "error:member_code:Max Length Should be 4" })); } WelcomeParamStationResult _welcome = NewRepo.Find <WelcomeParamStationResult>(new QueryParam { Fields = "welcome_param_station_result.id,welcome_param_id,station_code,param_value", Join = new List <JoinParameter> { new JoinParameter { table = "welcome_params", condition = "welcome_params.id=welcome_param_id and param_name=\"NameFlag\"" }, new JoinParameter { table = "tbl_dcs", condition = "tbl_dcs.ref_code=welcome_param_station_result.station_code" } }, Where = new List <ConditionParameter> { Condition("tbl_dcs.dcs_code", MemberModel.dcs_code) } }); if (_welcome != null) { _welcome.model_operation = "update"; _welcome.param_value = "Y"; Data.Add(new ModelParameter { SaveModel = _welcome, ValidateModel = null }); } Member NewModel = NewRepo.Find <Member>(new QueryParam { Where = new List <ConditionParameter> { Condition("ref_code", MemberModel.member_unique_code) } }); if (NewModel == null) { MemberModel.ex_member_code = MemberModel.member_code; MemberModel.member_code = MemberModel.dcs_code + MemberModel.member_code.PadLeft(4, '0'); MemberModel.originating_org_code = UnionsModel.union_code; MemberModel.ref_code = MemberModel.member_unique_code; Data.Add(new ModelParameter { SaveModel = MemberModel, ValidateModel = new MemberValidator() }); } else { NewModel.member_unique_code = MemberModel.member_unique_code; NewModel.dcs_code = MemberModel.dcs_code; NewModel.member_name = MemberModel.member_name; NewModel.is_active = MemberModel.is_active; NewModel.mobile_no = MemberModel.mobile_no; NewModel.model_operation = "update"; Data.Add(new ModelParameter { SaveModel = NewModel, ValidateModel = new MemberValidator() }); } SaveData(MemberModel.member_unique_code); } else { _response.Add(new CustomResponse { status = "300", msg = "error:member_unique_code:require" }); } } return(new CustomResult("success", _response)); }
public override string ToString() { return(string.Format("{0}.{1} ORDER BY {2}", typeof(SqlQuery).Name, Unions.JoinStrings(" "), OrderBy)); }
public JsonResult GetUnions(UnionsFilter filter) { Unions unions = new Unions(); return(Json(unions.GetUnions(filter), JsonRequestBehavior.AllowGet)); }
public void AddUnion(SelectQuery union, bool isAll) { Unions.Add(new SqlUnion(union, isAll)); }
public JsonResult GetUnionAll() { Unions unions = new Unions(); return(Json(unions.GetUnionAll(), JsonRequestBehavior.AllowGet)); }
public IActionResult SaveBmc(List <Bmc> BmcList) { Unions UnionsModel = GetLastRecord <Unions>("tbl_unions"); Plant PlantModel = GetLastRecord <Plant>("tbl_plant"); MccPlant MccModel = GetLastRecord <MccPlant>("tbl_mcc_plant"); foreach (Bmc BmcModel in BmcList) { Data = new List <ModelParameter>(); if (BmcModel.bmc_code != "") { Bmc NewModel = NewRepo.FindByKey <Bmc>(BmcModel.bmc_code); if (NewModel == null) { BmcModel.ref_code = BmcModel.bmc_code; BmcModel.union_code = BmcModel.originating_org_code = UnionsModel.union_code; BmcModel.plant_code = PlantModel.plant_code; if (UnionsModel.has_bmc == true && UnionsModel.has_mcc == false) { BmcModel.mcc_plant_code = BmcModel.bmc_code; MccPlant MccPlantModel = new MccPlant { mcc_plant_code = BmcModel.bmc_code, plant_code = PlantModel.plant_code, name = BmcModel.bmc_name, ref_code = BmcModel.ref_code, contact_person = BmcModel.bmc_incharge_name, mobile_no = BmcModel.contact_no }; MccPlantModel.union_code = MccPlantModel.originating_org_code = BmcModel.union_code; Data.Add(new ModelParameter { SaveModel = MccPlantModel, ValidateModel = new MccPlantValidator() }); } else { BmcModel.mcc_plant_code = MccModel.mcc_plant_code; } Data.Add(new ModelParameter { SaveModel = BmcModel, ValidateModel = new BmcValidator() }); } else { if (UnionsModel.has_bmc == true && UnionsModel.has_mcc == false) { MccPlant MccPlantModel = NewRepo.FindByKey <MccPlant>(BmcModel.bmc_code); MccPlantModel.name = BmcModel.bmc_name; MccPlantModel.contact_person = BmcModel.bmc_incharge_name; MccPlantModel.mobile_no = BmcModel.contact_no; MccPlantModel.model_operation = "update"; Data.Add(new ModelParameter { SaveModel = MccPlantModel, ValidateModel = new MccPlantValidator() }); } NewModel.bmc_name = BmcModel.bmc_name; NewModel.is_active = BmcModel.is_active; NewModel.bmc_incharge_name = BmcModel.bmc_incharge_name; NewModel.contact_no = BmcModel.contact_no; NewModel.model_operation = "update"; Data.Add(new ModelParameter { SaveModel = NewModel, ValidateModel = new BmcValidator() }); } SaveData(BmcModel.bmc_code); } else { _response.Add(new CustomResponse { status = "300", msg = "error:bmc_code" }); } } return(new CustomResult("success", _response)); }
public IActionResult SaveCustomer(List <CustomerMaster> CustomerMasterList) { Unions UnionsModel = GetLastRecord <Unions>("tbl_unions"); QueryParam Query = new QueryParam { Fields = "*", Table = "tbl_customer_type" }; List <CustomerType> CustomerTypeList = NewRepo.FindAll <CustomerType>(Query).ToList(); foreach (CustomerMaster CustomerMasterModel in CustomerMasterList) { Data = new List <ModelParameter>(); if (CustomerMasterModel.customer_unique_code.Trim() != "") { string prefix = CustomerTypeList.Where(x => x.customer_type == CustomerMasterModel.customer_type).Select(x => x.code_prefix).FirstOrDefault(); if (CheckPrefix(prefix, CustomerMasterModel.customer_code)) { CustomerMaster NewModel = NewRepo.Find <CustomerMaster>(new QueryParam { Where = new List <ConditionParameter> { Condition("ref_code", CustomerMasterModel.customer_unique_code) } }); if (NewModel == null) { CustomerMasterModel.ref_code = CustomerMasterModel.customer_unique_code; CustomerMasterModel.x_col1 = SetDcsXcol(CustomerMasterModel.allow_multiple_milktype); CustomerMasterModel.originating_org_code = CustomerMasterModel.union_code = UnionsModel.union_code; Data.Add(new ModelParameter { SaveModel = CustomerMasterModel, ValidateModel = new CustomerMasterValidator() }); } else { NewModel.customer_unique_code = CustomerMasterModel.customer_unique_code; NewModel.bmc_code = CustomerMasterModel.bmc_code; NewModel.x_col1 = SetDcsXcol(CustomerMasterModel.allow_multiple_milktype); NewModel.route_code = CustomerMasterModel.route_code; NewModel.customer_name = CustomerMasterModel.customer_name; NewModel.is_active = CustomerMasterModel.is_active; NewModel.mobile_no = CustomerMasterModel.mobile_no; NewModel.customer_type = CustomerMasterModel.customer_type; NewModel.model_operation = "update"; Data.Add(new ModelParameter { SaveModel = NewModel, ValidateModel = new CustomerMasterValidator() }); } SaveData(CustomerMasterModel.customer_unique_code); } else { _response.Add(new CustomResponse { status = "300", msg = "error:customer_code:Invalid Code" }); } } else { _response.Add(new CustomResponse { status = "300", msg = "error:customer_unique_code:Require" }); } } return(new CustomResult("success", _response)); }
public Query Union(Query query) { Unions.Add(query); return(this); }