/// <summary>
        /// Page Load Event, pulls Customer data from QuickBooks using SDK and Binds it to Grid
        /// </summary>
        /// <param name="sender">Sender of the event.</param>
        /// <param name="e">Event Args.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session.Keys.Count > 0)
            {
                realmId = HttpContext.Current.Session["realm"].ToString();
                accessToken = HttpContext.Current.Session["accessToken"].ToString();
                accessTokenSecret = HttpContext.Current.Session["accessTokenSecret"].ToString();
                consumerKey = ConfigurationManager.AppSettings["consumerKey"].ToString(CultureInfo.InvariantCulture);
                consumerSecret = ConfigurationManager.AppSettings["consumerSecret"];
                dataSourcetype = HttpContext.Current.Session["dataSource"].ToString().ToLower() == "qbd" ? IntuitServicesType.QBD : IntuitServicesType.QBO;

                OAuthRequestValidator oauthValidator =  new OAuthRequestValidator(accessToken, accessTokenSecret, consumerKey, consumerSecret);
                ServiceContext context = new ServiceContext(oauthValidator, realmId, dataSourcetype);
                DataServices commonService = new DataServices(context);

                try
                {
                    switch(dataSourcetype)
                    {
                        case IntuitServicesType.QBD:
                            var qbdCustomerQuery = new Intuit.Ipp.Data.Qbd.CustomerQuery();
                            qbdCustomerQuery.ItemElementName = Intuit.Ipp.Data.Qbd.ItemChoiceType4.StartPage;
                            qbdCustomerQuery.Item = "1";
                            qbdCustomerQuery.ChunkSize = "10";
                            var qbdCustomers = qbdCustomerQuery.ExecuteQuery<Intuit.Ipp.Data.Qbd.Customer>(context).ToList();
                            grdQuickBooksCustomers.DataSource = qbdCustomers;
                            break;
                        case IntuitServicesType.QBO:
                            var qboCustomer = new Intuit.Ipp.Data.Qbo.Customer();
                            var qboCustomers = commonService.FindAll(qboCustomer, 1, 10).ToList();
                            grdQuickBooksCustomers.DataSource = qboCustomers;
                            break;
                    }

                    grdQuickBooksCustomers.DataBind();

                    if (grdQuickBooksCustomers.Rows.Count > 0)
                    {
                        GridLocation.Visible = true;
                        MessageLocation.Visible = false;
                    }
                    else
                    {
                        GridLocation.Visible = false;
                        MessageLocation.Visible = true;
                    }
                }
                catch (Intuit.Ipp.Exception.InvalidTokenException)
                {
                    //Remove the Oauth access token from the OauthAccessTokenStorage.xml
                    OauthAccessTokenStorageHelper.RemoveInvalidOauthAccessToken(Session["FriendlyEmail"].ToString(), Page);

                    Session["show"] = true;
                    Response.Redirect("~/Default.aspx");
                }
            }
        }
        /// <summary>
        /// Page Load Event, pulls Customer data from QuickBooks using SDK and Binds it to Grid
        /// </summary>
        /// <param name="sender">Sender of the event.</param>
        /// <param name="e">Event Args.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session.Keys.Count > 0)
            {
                String realmId = HttpContext.Current.Session["realm"].ToString();
                String accessToken = HttpContext.Current.Session["accessToken"].ToString();
                String accessTokenSecret = HttpContext.Current.Session["accessTokenSecret"].ToString();
                String consumerKey = ConfigurationManager.AppSettings["consumerKey"].ToString(CultureInfo.InvariantCulture);
                String consumerSecret = ConfigurationManager.AppSettings["consumerSecret"].ToString(CultureInfo.InvariantCulture);
                IntuitServicesType intuitServiceType = (IntuitServicesType)HttpContext.Current.Session["intuitServiceType"];

                OAuthRequestValidator oauthValidator = new OAuthRequestValidator(accessToken, accessTokenSecret, consumerKey, consumerSecret);
                ServiceContext context = new ServiceContext(oauthValidator, realmId, intuitServiceType);
                DataServices commonService = new DataServices(context);

                try
                {
                    switch(intuitServiceType )
                    {
                        case IntuitServicesType.QBO:
                            Intuit.Ipp.Data.Qbo.Customer qboCustomer = new Intuit.Ipp.Data.Qbo.Customer();
                            IEnumerable<Intuit.Ipp.Data.Qbo.Customer> qboCustomers =  commonService.FindAll(qboCustomer, 1, 10) as IEnumerable<Intuit.Ipp.Data.Qbo.Customer>;
                            grdQuickBooksCustomers.DataSource = qboCustomers;
                            break;
                        case IntuitServicesType.QBD:
                            //FindAll() is a GET operation for QBD, so we need to use the respective Query object instead to POST the start page and records per page (ChunkSize).
                            Intuit.Ipp.Data.Qbd.CustomerQuery qbdCustomerQuery = new Intuit.Ipp.Data.Qbd.CustomerQuery();
                            qbdCustomerQuery.ItemElementName = Intuit.Ipp.Data.Qbd.ItemChoiceType4.StartPage;
                            qbdCustomerQuery.Item = "1";
                            qbdCustomerQuery.ChunkSize = "10";
                            IEnumerable<Intuit.Ipp.Data.Qbd.Customer> qbdCustomers = qbdCustomerQuery.ExecuteQuery<Intuit.Ipp.Data.Qbd.Customer>(context) as IEnumerable<Intuit.Ipp.Data.Qbd.Customer>;
                            grdQuickBooksCustomers.DataSource = qbdCustomers;
                            break;
                        default:
                            throw new Exception("Data Source not defined.");
                    }

                    grdQuickBooksCustomers.DataBind();
                    if (grdQuickBooksCustomers.Rows.Count > 0)
                    {
                        GridLocation.Visible = true;
                        MessageLocation.Visible = false;
                    }
                    else
                    {
                        GridLocation.Visible = false;
                        MessageLocation.Visible = true;
                    }
                }
                catch
                {
                    throw;
                }
            }
        }
예제 #3
0
		/// <summary>
		/// Creates an instance of JobProductVm with given model, parent and data service
		/// </summary>
		/// <param name="model"></param>
		/// <param name="parentVm"></param>
		/// <param name="jobDataService"></param>
		public JobProductVm(Model.Product model, ProductGroupVm parentVm, DataServices.JobDataService jobDataService)
			: base(model, parentVm)
		{
			CreateNewJob = new Commands.Command
				(vm =>
					{
						var job = Soheil.Core.ViewModels.PP.Editor.PPEditorJob.CreateForProduct(model, jobDataService);
						((Soheil.Core.ViewModels.PP.Editor.JobEditorVm)vm).JobList.Add(job);
					}
				);
		}
예제 #4
0
		public static PPEditorJob CreateForProduct(Model.Product productModel, DataServices.JobDataService jobDataService)
		{
			return new PPEditorJob(new Model.Job
			{
				Code = productModel.Code,
				Deadline = DateTime.Now.AddMonths(1),
				FPC = productModel.DefaultFpc,
				ProductRework = productModel.MainProductRework,
				Quantity = 0,
				ReleaseTime = DateTime.Now,
				Weight = 1,
			}, jobDataService);
		}
예제 #5
0
		/// <summary>
		/// Creates an instance of JobProductGroupVm with given model and data service
		/// </summary>
		/// <param name="model">products and product reworks of this model are also in use</param>
		/// <param name="jobDataService"></param>
		public JobProductGroupVm(Model.ProductGroup model, DataServices.JobDataService jobDataService)
		{
			if (model == null) return;
			_id = model.Id;
			Name = model.Name;
			Code = model.Code;

			foreach (var p_model in model.Products)
			{
				var p = new JobProductVm(p_model, this, jobDataService);
				Products.Add(p);
			}

		}
예제 #6
0
		public ConnectorVm(Model.Connector model, StateVm start, StateVm end, DataServices.ConnectorDataService connectorDataService, bool isLoose = false)
		{
			Model = model;
			Start = start;
			End = end;
			IsLoose = isLoose;
			DeleteCommand = new Commands.Command(o =>
			{
				if(Model != null)
					connectorDataService.DeleteModel(Model);
				if (ConnectorRemoved != null) 
					ConnectorRemoved();
			});
		}
예제 #7
0
		public PPEditorJob(Model.Job model, DataServices.JobDataService jobDataService)
		{
			_jobDataService = jobDataService;
			Replications.Add(model);

			Deadline = model.Deadline;
			ReleaseDT = model.ReleaseTime;
			Code = model.Code;
			Quantity = model.Quantity;
			Weight = model.Weight;
			Description = model.Description;
			FpcId = model.FPC.Id;
			Product = new ProductVm(model.ProductRework.Product, null);
			ProductRework = new ProductReworkVm(model.ProductRework, Product);

			initializeCommands();
		}
예제 #8
0
        public ActionResult Details(string Id)
        {
            DetailViewModel model = new DetailViewModel(Id);

            // set counter property for popu
            SetViewedProductCounter();

            // check cookie if has AssistKey, use to add to  facet, else generate new
            string _assistKey    = null;
            var    hasCookiedKey = GetCookie("Canvas.Ecomm.AssistKey");

            if (hasCookiedKey != null)
            {
                _assistKey = hasCookiedKey;
            }
            else
            {
                _assistKey = RandomStrings(6);
                SetCookie("Canvas.Ecomm.AssistKey", _assistKey, false);
            }


            var existingProducts = GetCookie("Canvas.Ecomm.Products");

            if (existingProducts != null)
            {
                existingProducts = existingProducts.Trim() + "," + model.Product.SKU;
                SetCookie("Canvas.Ecomm.Products", existingProducts, true);
            }
            else
            {
                existingProducts = model.Product.SKU;
                SetCookie("Canvas.Ecomm.Products", existingProducts, true);
            }

            //set xconnect custom facet with product info, using AssistKey
            // Save product viewed to xconnect facet

            //find record
            //if exists, increment view count
            //else add to data
            var uniqueId = string.Format("{0}-{1}-{2}", _assistKey, model.Product.ID, model.Product.SKU);

            if (DataServices.Exists(uniqueId))
            {
                var drX = DataServices.Find(uniqueId);
                drX.EngagementScore = drX.EngagementScore + 1;
                DataServices.Update(drX);
            }
            else
            {
                var dr = new DataRecord {
                    ID = uniqueId, AssistKey = _assistKey, Product = model.Product, EngagementScore = 1
                };
                DataServices.Add(dr);
            }



            return(View(model));
        }
예제 #9
0
        public DataServices getDataService()
        {
            if (qbds == null)
            {
                qbds = new DataServices(getServiceContext());
            }

            return qbds;
        }
예제 #10
0
 private static string GetMapInfoFromService(String servicename, String serviceitem, String serviceparams)
 {
     return(DataServices.CallService(servicename, serviceitem, serviceparams));
 }
 public EmployeesController(DataServices services)
 {
     _services = services;
 }
예제 #12
0
파일: frm_JEM.cs 프로젝트: ubaidmughal/SAP
        private void fillJeDetailHead(string docNum, int RowNum)
        {
            txDS.Value   = "0.00";
            txCS.Value   = "0.00";
            txDD.Value   = "";
            txDN.Value   = "";
            txRem.Value  = "";
            txRef1.Value = "";
            txRef2.Value = "";
            txPJ.Value   = "";
            txCJ.Value   = "";
            dtDet.Rows.Clear();
            string jeType = "PP";

            if (optPP.Selected)
            {
                jeType = "PP";
            }
            if (optPC.Selected)
            {
                jeType = "PC";
            }
            if (optC.Selected)
            {
                jeType = "C";
            }
            try
            {
                if (jeType == "C")
                {
                    btPost.Item.Enabled = false;
                }
                else
                {
                    btPost.Item.Enabled = true;
                }
            }
            catch { }
            if (RowNum > 0)
            {
                txRem.Value  = Convert.ToString(dtHead.GetValue("cRemarks", RowNum - 1));
                txRef1.Value = Convert.ToString(dtHead.GetValue("cNum", RowNum - 1));
                txPJ.Value   = Convert.ToString(dtHead.GetValue("cPostedJE", RowNum - 1));
                txCJ.Value   = Convert.ToString(dtHead.GetValue("cCanceledJE", RowNum - 1));
                oForm.DataSources.UserDataSources.Item("txDD").ValueEx = Convert.ToDateTime(dtHead.GetValue("cDate", RowNum - 1)).ToString("yyyyMMdd");
            }
            chkPost.Checked = false;
            dtPendingJEs.Rows.Clear();
            DataServices ds = new DataServices(Program.strConMena);


            string strSelect = " Select MenaCode as lineType ,acctCode,acctName,debit ,credit , project ,ocr1 ,ocr2 ,ocr3 ,ocr4 ,ocr5 from [dbo].[JE_PRL_getJEDetRows]('" + docNum + "') ";

            dtDet.Rows.Clear();

            System.Data.DataTable dtRows = ds.getDataTable(strSelect, "Filling Detail");
            if (dtRows != null && dtRows.Rows.Count > 0)
            {
                int    i      = 0;
                double debit  = 0.00;
                double credit = 0.00;
                foreach (DataRow dr in dtRows.Rows)
                {
                    double lineDebit  = 0.00;
                    double lineCredit = 0.00;

                    lineDebit  = Convert.ToDouble(dr["debit"].ToString());
                    lineCredit = Convert.ToDouble(dr["credit"].ToString());
                    debit     += lineDebit;
                    credit    += lineCredit;
                    dtDet.Rows.Add(1);
                    dtDet.SetValue("cNum", i, i.ToString());
                    dtDet.SetValue("cType", i, Convert.ToString(dr["lineType"].ToString()));
                    dtDet.SetValue("cCode", i, Convert.ToString(Program.objHrmsUI.getAcctSys(dr["lineType"].ToString().Replace("-", ""))));
                    dtDet.SetValue("cName", i, Convert.ToString(Program.objHrmsUI.getAcctName(dr["lineType"].ToString().Replace("-", ""))));
                    dtDet.SetValue("cDebit", i, Convert.ToString(dr["debit"].ToString()));
                    dtDet.SetValue("cCredit", i, Convert.ToString(dr["credit"].ToString()));
                    dtDet.SetValue("cProject", i, Convert.ToString(dr["project"].ToString()));
                    dtDet.SetValue("cOcr1", i, Convert.ToString(dr["ocr1"].ToString()));
                    dtDet.SetValue("cOcr2", i, Convert.ToString(dr["ocr2"].ToString()));
                    dtDet.SetValue("cOcr3", i, Convert.ToString(dr["ocr3"].ToString()));
                    dtDet.SetValue("cOcr4", i, Convert.ToString(dr["ocr4"].ToString()));
                    dtDet.SetValue("cOcr5", i, Convert.ToString(dr["ocr5"].ToString()));

                    i++;
                }
                mtDet.LoadFromDataSource();
                txDS.Value = debit.ToString();
                txCS.Value = credit.ToString();
            }
            mtDet.LoadFromDataSource();
        }
예제 #13
0
        private async Task <IEnumerable <ElementDto> > InitElements()
        {
            IEnumerable <ElementDto> value = await DataServices.GetHelperDataServices().GetAsyncHelper <ElementDto>(GenericSql.ElementsSummaryQuery);

            return(value);
        }
예제 #14
0
 public MappedWriteHandler(DataServices dataServices)
 {
     this.dataServices = dataServices;
 }
예제 #15
0
 public ModerationServices(DataServices dataServices)
 {
     _dataServices = dataServices;
 }
        private Tuple <string, string> PostObjectHandler(string synapsenamespace, string synapseentityname, string data, dynamic connectionObj = null, dynamic transactionObj = null)
        {
            //27Feb2020-RK
            //RMF1 - Remove Feature- check if all relations have a key column value supplied in the post request

            //RMF1
            //DataTable dtRel = SynapseEntityHelperServices.GetEntityRelations(synapsenamespace, synapseentityname);

            string keyAttribute = SynapseEntityHelperServices.GetEntityKeyAttribute(synapsenamespace, synapseentityname);

            StringBuilder sb = new StringBuilder();

            //dynamic dObj = JObject.Parse(data);
            var dataDict = JsonConvert.DeserializeObject <Dictionary <string, object> >(data);

            StringBuilder sbCols    = new StringBuilder();
            StringBuilder sbParams  = new StringBuilder();
            var           paramList = new List <KeyValuePair <string, object> >();

            string keyValue = "";

            // int iRelationMatches = 0;
            int iKeyMatches = 0;

            var count = dataDict.Count();

            //RK: 08012019 set_createdby : userid from access token
            #region set_createdby
            var useridClaim = User.FindFirst(_configuration["SynapseCore:Settings:TokenUserIdClaimType"]);
            var userid      = "unknown";

            if (useridClaim != null)
            {
                userid = useridClaim.Value;
            }
            else if (dataDict.ContainsKey("_createdby"))
            {
                userid = Convert.ToString(dataDict["_createdby"]);
            }

            //check if dataDict has _createdby key
            if (dataDict.ContainsKey("_createdby"))
            {
                //update they key value to userid from toke
                dataDict["_createdby"] = userid;
            }
            else
            {
                //add _createdby key and set value to userid from token
                dataDict.Add("_createdby", userid);
            }
            #endregion

            foreach (KeyValuePair <string, object> item in dataDict)
            {
                //Count if Key Attribute matches item.Key
                var a = item.Key;
                var b = a;

                if (keyAttribute == item.Key)
                {
                    keyValue = item.Value.ToString();
                    iKeyMatches++;
                }

                //Count all Key Columns
                //RMF1

                /*  foreach (DataRow row in dtRel.Rows)
                 * {
                 *    sb.Append(row[0].ToString() + ",");
                 *    if (item.Key == row[0].ToString())
                 *    {
                 *        iRelationMatches++;
                 *    }
                 * }*/

                if (item.Value != null)
                {
                    sbCols.Append(item.Key + ",");
                    sbParams.Append("@p_" + item.Key + ",");
                    paramList.Insert(0, new KeyValuePair <string, object>("p_" + item.Key, item.Value));
                }
                else //Check it is not a key or relation column that is null
                {
                    if (keyAttribute == item.Key)
                    {
                        throw new InterneuronBusinessException(errorCode: 400, errorMessage: "No value supplied for Key Attribute: " + keyAttribute, "Client Error");
                    }

                    //Relations
                    //RMF1

                    /* foreach (DataRow row in dtRel.Rows)
                     * {
                     *   if (item.Key == row[0].ToString())
                     *   {
                     *       throw new InterneuronBusinessException(errorCode: 400, errorMessage: "No values supplpied for relation: " + item.Key, "Client Error");
                     *
                     *   }
                     * }*/
                }
            }

            //RMF1

            /*if (iRelationMatches < dtRel.Rows.Count)
             * {
             *  throw new InterneuronBusinessException(errorCode: 400, errorMessage: "Not all relations have values specified.Please ensure that you have values are specified for all of the following fields: " + StringManipulationServices.TrimEnd(sb.ToString(), ","), "Client Error");
             *
             * }*/


            if (iKeyMatches < 1)
            {
                throw new InterneuronBusinessException(errorCode: 400, errorMessage: "No value supplied for Key Attribute: " + keyAttribute, "Client Error");
            }

            string strCols = "INSERT INTO entitystore." + synapsenamespace + "_" + synapseentityname + "(" +
                             sbCols.ToString().TrimEnd(',') +
                             ") ";
            string strParams = " VALUES (" +
                               sbParams.ToString().TrimEnd(',') +
                               ") RETURNING _sequenceid;";
            var sql = strCols + strParams;

            DataSet ds = new DataSet();
            ds = DataServices.DataSetFromSQL(sql, paramList, existingCon: connectionObj);
            DataTable dt = ds.Tables[0];
            int       id = System.Convert.ToInt32(dt.Rows[0][0].ToString());

            //Delete all occurances from entitystorematerialised
            string sqlDelete = "DELETE FROM entitystorematerialised." + synapsenamespace + "_" + synapseentityname + " WHERE " + keyAttribute + " = @keyValue;";

            var paramListDelete = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("keyValue", keyValue)
            };

            DataServices.executeSQLStatement(sqlDelete, paramListDelete, existingCon: connectionObj);


            //Get all the entity's columns
            string entityCols          = "";
            string sqlEntityCols       = "SELECT entitysettings.getentityattributestring(@synapsenamespace, @synapseentityname, 1)";
            var    paramListEntityCols = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("synapsenamespace", synapsenamespace),
                new KeyValuePair <string, object>("synapseentityname", synapseentityname)
            };

            DataSet dsEntityCols = new DataSet();
            dsEntityCols = DataServices.DataSetFromSQL(sqlEntityCols, paramListEntityCols, existingCon: connectionObj);
            DataTable dtEntityCols = dsEntityCols.Tables[0];
            entityCols = dtEntityCols.Rows[0][0].ToString();


            //Insert the newly inserted record into the materialised entity
            string sqlMaterialisedInsert = string.Empty;

            if (connectionObj == null)
            {
                sqlMaterialisedInsert = "INSERT INTO entitystorematerialised." + synapsenamespace + "_" + synapseentityname + "(" +
                                        entityCols +
                                        ") "
                                        +
                                        " SELECT " +
                                        entityCols +
                                        " FROM entityview." + synapsenamespace + "_" + synapseentityname
                                        + " WHERE " + keyAttribute + " = @keyValue;";
            }
            else
            {
                sqlMaterialisedInsert = "INSERT INTO entitystorematerialised." + synapsenamespace + "_" + synapseentityname + "(" +
                                        entityCols +
                                        ") "
                                        +
                                        " SELECT " +
                                        entityCols +
                                        " FROM entityview." + synapsenamespace + "_" + synapseentityname
                                        + " WHERE " + keyAttribute + " = @keyValue RETURNING *;";
            }


            var paramListMaterialisedInsert = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("keyValue", keyValue)
            };

            //DataServices.executeSQLStatement(sqlMaterialisedInsert, paramListMaterialisedInsert, existingCon: connectionObj);

            var insertedDataInMaterial = string.Empty;

            if (connectionObj == null)
            {
                DataServices.executeSQLStatement(sqlMaterialisedInsert, paramListMaterialisedInsert);
            }
            else
            {
                DataSet dsMaterilaized = DataServices.DataSetFromSQL(sqlMaterialisedInsert, paramListMaterialisedInsert, existingCon: connectionObj);
                insertedDataInMaterial = DataServices.ConvertDataTabletoJSONString(dsMaterilaized.Tables[0]);
            }


            //Get the return object
            //return GetReturnObjectByID(synapsenamespace, synapseentityname, id);

            string returnedData = string.Empty;

            if (connectionObj == null)
            {
                returnedData = GetReturnObjectByID(synapsenamespace, synapseentityname, id);
            }

            return(new Tuple <string, string>(returnedData, insertedDataInMaterial));
        }
        public string GetListByPost(string synapsenamespace, string synapseentityname, string returnsystemattributes, string orderby, string limit, string offset, string filter, [FromBody] string data)
        {
            dynamic       results          = JsonConvert.DeserializeObject <dynamic>(data);
            string        filters          = results[0].filters.ToString();
            StringBuilder filtersToApplySB = new StringBuilder();

            filtersToApplySB.Append(" WHERE 1 = 1 ");
            JArray obj = Newtonsoft.Json.JsonConvert.DeserializeObject <JArray>(filters);

            foreach (var filterApplied in obj)
            {
                filtersToApplySB.Append(" AND (" + (string)filterApplied["filterClause"] + ")");
            }

            string filtersSQL = filtersToApplySB.ToString();

            string filterparams      = results[1].filterparams.ToString();
            var    paramListFromPost = new List <KeyValuePair <string, object> >();
            JArray objParams         = Newtonsoft.Json.JsonConvert.DeserializeObject <JArray>(filterparams);

            foreach (var paramApplied in objParams)
            {
                if (paramApplied["paramValue"].Type == JTokenType.Date)
                {
                    var temp = (DateTime)paramApplied["paramValue"];

                    var value = temp.ToString("yyyy-MM-ddTHH:mm:ss");

                    paramListFromPost.Insert(0, new KeyValuePair <string, object>((string)paramApplied["paramName"], value));
                }
                else
                {
                    paramListFromPost.Insert(0, new KeyValuePair <string, object>((string)paramApplied["paramName"], (string)paramApplied["paramValue"]));
                }
            }



            string limitString = "";

            if (!string.IsNullOrEmpty(limit))
            {
                limitString = " LIMIT " + limit;
            }
            string orderBySting = "";

            if (!string.IsNullOrEmpty(orderby))
            {
                orderBySting = " ORDER BY " + orderby;
            }

            string offsetString = "";

            if (!string.IsNullOrEmpty(offset))
            {
                offsetString = " OFFSET " + offset;
            }

            if (string.IsNullOrWhiteSpace(returnsystemattributes))
            {
                returnsystemattributes = "0";
            }

            string fieldList = SynapseEntityHelperServices.GetEntityAttributes(synapsenamespace, synapseentityname, returnsystemattributes);

            if (string.IsNullOrEmpty(fieldList))
            {
                fieldList = " * ";
            }

            //Stub for later use
            string filterString = "";

            if (!string.IsNullOrEmpty(filter))
            {
                filterString = " AND " + filter;
            }

            string sql = "SELECT * FROM (SELECT " + fieldList + " FROM entitystorematerialised." + synapsenamespace + "_" + synapseentityname + " WHERE 1=1 " + filterString + orderBySting + limitString + offsetString + ") entview " + filtersSQL + ";";

            DataSet ds = new DataSet();

            ds = DataServices.DataSetFromSQL(sql, paramListFromPost);
            DataTable dt   = ds.Tables[0];
            var       json = DataServices.ConvertDataTabletoJSONString(dt);

            return(json);
        }
예제 #18
0
파일: App.cs 프로젝트: Rom3n/hakaton
 public App()
 {
     DialogService.Init(this);
     NavigationService.Init(this);
     DataServices.Init(true);
 }
예제 #19
0
        // move to the master view model or to a data layer
        private async Task AssistQueryRequestHandlerDo(string assistTableName, string assistQuery)
        {
            IHelperDataServices helperDataServices = DataServices.GetHelperDataServices();
            object  currentView       = null;
            IMapper mapper            = MapperField.GetMapper();
            var     assistDataService = DataServices.GetAssistDataServices();
            var     resultData        = await assistDataService.Mapper.ExecuteAssistGeneric(assistTableName.ToUpper(), assistQuery);

            switch (assistTableName)
            {
            case "TIPOCOMI":
            {
                BrokerTypeDto = (IEnumerable <CommissionTypeViewObject>)(resultData);
                break;
            }

            case "PAIS":
            {
                IEnumerable <CountryViewObject> countryDtos = (IEnumerable <CountryViewObject>)(resultData);
                Country     = countryDtos;
                currentView = countryDtos;
                break;
            }

            case "PROVINCIA":
            {
                Province = (IEnumerable <ProvinceViewObject>)resultData;
                break;
            }

            case "PROVINCE_BRANCHES":
            {
                var provDtos = (IEnumerable <ProvinceViewObject>)resultData;

                currentView = provDtos;
                break;
            }

            case "POBLACIONES":
            {
                var prov = (IEnumerable <CityViewObject>)resultData;
                CityDto     = prov;
                currentView = CityDto;
                break;
            }

            case "PRODUCTS":
            {
                IEnumerable <ProductsViewObject> productDto = (IEnumerable <ProductsViewObject>)(resultData);
                Products    = productDto;
                currentView = productDto;
                break;
            }

            case "VENDEDOR":
            {
                IEnumerable <ResellerViewObject> vendedorDto = (IEnumerable <ResellerViewObject>)(resultData);
                Vendedor    = vendedorDto;
                currentView = Vendedor;
                break;
            }

            case "MARKET_ASSIST":
            {
                IEnumerable <MarketViewObject> mercadoDtos = (IEnumerable <MarketViewObject>)(resultData);
                Mercado     = mercadoDtos;
                currentView = Mercado;
                break;
            }

            case "BUSINESS_ASSIST":
            {
                IEnumerable <BusinessViewObject> negocios = (IEnumerable <BusinessViewObject>)(resultData);
                Negocio     = negocios;
                currentView = Negocio;
                break;
            }

            case "CLIENT_ASSIST_COMI":
            {
                ClientOne   = (IEnumerable <ClientViewObject>)(resultData);
                currentView = ClientOne;

                break;
            }

            case "CHANNEL_TYPE":
            {
                IEnumerable <ChannelViewObject> cli = (IEnumerable <ChannelViewObject>)(resultData);
                Canal       = cli;
                currentView = Canal;
                break;
            }

            case "TIPOCOMISION":
            {
                IEnumerable <CommissionTypeViewObject> cli = (IEnumerable <CommissionTypeViewObject>)(resultData);

                TipoComission = cli;
                currentView   = TipoComission;
                break;
            }

            case "OFFICE_ZONE_ASSIST":
            {
                IEnumerable <ZonaOfiViewObject> cli = (IEnumerable <ZonaOfiViewObject>)(resultData);
                Offices     = cli;
                currentView = Offices;
                break;
            }

            case "CLIENT_BUDGET":
            {
                IEnumerable <BudgetKeyViewObject> cli = (IEnumerable <BudgetKeyViewObject>)(resultData);
                Clavepto    = cli;
                currentView = Clavepto;
                break;
            }

            case "ORIGIN_ASSIST":
            {
                IEnumerable <OrigenViewObject> cli = (IEnumerable <OrigenViewObject>)(resultData);

                Origen      = cli;
                currentView = Origen;
                break;
            }

            case "IDIOMAS":
            {
                IEnumerable <LanguageViewObject> cli = (IEnumerable <LanguageViewObject>)(resultData);
                Language    = cli;
                currentView = Language;
                break;
            }
            }

            UpdateCollections(currentView, assistTableName, ref _leftObservableCollection);
            LeftValueCollection = _leftObservableCollection;
        }
예제 #20
0
        public ActionResult LoadObjectGrid(string objecttypeid, string roleid)
        {
            string sql = "";

            if (objecttypeid == "1")
            {
                sql = @"SELECT roleprevilage_id as id,applicationname as name,permission_type
                        FROM rbac.roleprevilages rp	 join entitystorematerialised.meta_application a on a.application_id = rp.objectid
                        join  rbac.premissions p on p.permission_id=rp.permissionid
                        inner join rbac.objecttypes ot on ot.objecttypeid=rp.objecttypeid  where objecttype='Application'";
            }
            else if (objecttypeid == "2")
            {
                sql = @"SELECT roleprevilage_id as id,modulename as name,permission_type
                            FROM rbac.roleprevilages rp	join entitystorematerialised.meta_module a on a.module_id=rp.objectid
                            join  rbac.premissions p on p.permission_id=rp.permissionid
                            inner join rbac.objecttypes ot on ot.objecttypeid=rp.objecttypeid  where objecttype='Module'";
            }
            else if (objecttypeid == "3")
            {
                sql = @"SELECT roleprevilage_id as id,actionname as name,permission_type
                            FROM rbac.roleprevilages rp	join  rbac.action a on a.action_id=rp.objectid
                            join  rbac.premissions p on p.permission_id=rp.permissionid
                            inner join rbac.objecttypes ot on ot.objecttypeid=rp.objecttypeid  where objecttype='Action'";
            }
            else if (objecttypeid == "4")
            {
                sql = @"SELECT roleprevilage_id as id,entityname as name,permission_type
                            FROM rbac.roleprevilages rp	join  entitysettings.entitymanager a on a.entityid=rp.objectid
                            join  rbac.premissions p on p.permission_id=rp.permissionid
                            inner join rbac.objecttypes ot on ot.objecttypeid=rp.objecttypeid  where objecttype='Entity'";
            }
            else if (objecttypeid == "5")
            {
                sql = @"SELECT roleprevilage_id as id,listname as name ,permission_type
                            FROM rbac.roleprevilages rp	join listsettings.listmanager a on a.list_id=rp.objectid
                            join  rbac.premissions p on p.permission_id=rp.permissionid
                            inner join rbac.objecttypes ot on ot.objecttypeid=rp.objecttypeid  where objecttype='List'";
            }
            else if (objecttypeid == "6")
            {
                sql = @"SELECT roleprevilage_id as id,personaname as name,permission_type
                        FROM rbac.roleprevilages rp	join entitystorematerialised.meta_persona a on a.persona_id=rp.objectid
                        join  rbac.premissions p on p.permission_id=rp.permissionid
                        inner join rbac.objecttypes ot on ot.objecttypeid=rp.objecttypeid  where objecttype='Persona'";
            }
            DataSet ds = DataServices.DataSetFromSQL(sql + " and roleid='" + roleid + "' order by name");

            List <RollGridModel> ObjList = new List <RollGridModel>();

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                ObjList.Add(new RollGridModel()
                {
                    objectname       = row["name"].ToString(),
                    permission_type  = row["permission_type"].ToString(),
                    roleprevilage_id = row["id"].ToString()
                });
            }

            return(Json(JsonConvert.SerializeObject(ObjList)));
        }
        /// <summary>
        /// Initializes this <see cref="LocalOutputAdapter"/>.
        /// </summary>
        /// <exception cref="ArgumentException"><b>InstanceName</b> is missing from the <see cref="AdapterBase.Settings"/>.</exception>
        public override void Initialize()
        {
            base.Initialize();

            Dictionary<string, string> settings = Settings;
            string setting;
            ulong badDataMessageInterval;

            // Validate settings.
            if (!settings.TryGetValue("instanceName", out m_instanceName) || string.IsNullOrWhiteSpace(m_instanceName))
                m_instanceName = Name.ToLower();

            // Track instance in static dictionary
            Instances[InstanceName] = this;

            if (!settings.TryGetValue("archivePath", out m_archivePath))
                m_archivePath = FilePath.GetAbsolutePath(FilePath.AddPathSuffix("Archive"));

            if (settings.TryGetValue("refreshMetadata", out setting) || settings.TryGetValue("autoRefreshMetadata", out setting))
                m_autoRefreshMetadata = setting.ParseBoolean();

            if (settings.TryGetValue("badDataMessageInterval", out setting) && ulong.TryParse(setting, out badDataMessageInterval))
                m_badDataMessageInterval = badDataMessageInterval;

            //if (settings.TryGetValue("useNamespaceReservation", out setting))
            //    m_useNamespaceReservation = setting.ParseBoolean();
            //else
            //    m_useNamespaceReservation = false;

            // Initialize metadata file.
            m_instanceName = m_instanceName.ToLower();
            m_archive.MetadataFile.FileName = Path.Combine(m_archivePath, m_instanceName + "_dbase.dat");
            m_archive.MetadataFile.PersistSettings = true;
            m_archive.MetadataFile.SettingsCategory = m_instanceName + m_archive.MetadataFile.SettingsCategory;
            m_archive.MetadataFile.FileAccessMode = FileAccess.ReadWrite;
            m_archive.MetadataFile.Initialize();

            // Initialize state file.
            m_archive.StateFile.FileName = Path.Combine(m_archivePath, m_instanceName + "_startup.dat");
            m_archive.StateFile.PersistSettings = true;
            m_archive.StateFile.SettingsCategory = m_instanceName + m_archive.StateFile.SettingsCategory;
            m_archive.StateFile.FileAccessMode = FileAccess.ReadWrite;
            m_archive.StateFile.Initialize();

            // Initialize intercom file.
            m_archive.IntercomFile.FileName = Path.Combine(m_archivePath, "scratch.dat");
            m_archive.IntercomFile.PersistSettings = true;
            m_archive.IntercomFile.SettingsCategory = m_instanceName + m_archive.IntercomFile.SettingsCategory;
            m_archive.IntercomFile.FileAccessMode = FileAccess.ReadWrite;
            m_archive.IntercomFile.Initialize();

            // Initialize data archive file.           
            m_archive.FileName = Path.Combine(m_archivePath, m_instanceName + "_archive.d");
            m_archive.FileSize = 100;
            m_archive.CompressData = false;
            m_archive.PersistSettings = true;
            m_archive.SettingsCategory = m_instanceName + m_archive.SettingsCategory;

            m_archive.RolloverStart += m_archive_RolloverStart;
            m_archive.RolloverComplete += m_archive_RolloverComplete;
            m_archive.RolloverException += m_archive_RolloverException;

            m_archive.DataReadException += m_archive_DataReadException;
            m_archive.DataWriteException += m_archive_DataWriteException;

            m_archive.OffloadStart += m_archive_OffloadStart;
            m_archive.OffloadComplete += m_archive_OffloadComplete;
            m_archive.OffloadException += m_archive_OffloadException;

            m_archive.OrphanDataReceived += m_archive_OrphanDataReceived;
            m_archive.FutureDataReceived += m_archive_FutureDataReceived;
            m_archive.OutOfSequenceDataReceived += m_archive_OutOfSequenceDataReceived;

            m_archive.Initialize();

            // Provide web service support.
            m_dataServices = new DataServices();
            m_dataServices.AdapterCreated += DataServices_AdapterCreated;
            m_dataServices.AdapterLoaded += DataServices_AdapterLoaded;
            m_dataServices.AdapterUnloaded += DataServices_AdapterUnloaded;
            m_dataServices.AdapterLoadException += AdapterLoader_AdapterLoadException;

            // Provide metadata sync support.
            m_metadataProviders = new MetadataProviders();
            m_metadataProviders.AdapterCreated += MetadataProviders_AdapterCreated;
            m_metadataProviders.AdapterLoaded += MetadataProviders_AdapterLoaded;
            m_metadataProviders.AdapterUnloaded += MetadataProviders_AdapterUnloaded;
            m_metadataProviders.AdapterLoadException += AdapterLoader_AdapterLoadException;

            // Provide archive replication support.
            m_replicationProviders = new ReplicationProviders();
            m_replicationProviders.AdapterCreated += ReplicationProviders_AdapterCreated;
            m_replicationProviders.AdapterLoaded += ReplicationProviders_AdapterLoaded;
            m_replicationProviders.AdapterUnloaded += ReplicationProviders_AdapterUnloaded;
            m_replicationProviders.AdapterLoadException += AdapterLoader_AdapterLoadException;
        }
예제 #22
0
 public StoreController()
 {
     ds = DataServices.Instance;
 }
예제 #23
0
        protected Downloader(IReadOnlyList <string> testInfo, LevelTestingServer server, DataServices dataSvc)
        {
            DataSvc = dataSvc;
            DateTime time  = Convert.ToDateTime(testInfo[1]);
            string   title = testInfo[2].Substring(0, testInfo[2].IndexOf(" "));

            DemoName   = $"{time:MM_dd_yyyy}_{title}";
            FtpPath    = server.FtpPath;
            LocalPath  = $"{DataSvc.DemoPath}\\{time:yyyy}\\{time:MM} - " + $"{time:MMMM}\\{DemoName}";
            WorkshopId = Regex.Match(testInfo[6], @"\d+$").Value;
        }
        public string GetObjectWithInsert(string synapsenamespace, string synapseentityname, string synapseattributename, string attributevalue, string keyvalue, string returnsystemattributes)
        {
            if (string.IsNullOrWhiteSpace(returnsystemattributes))
            {
                returnsystemattributes = "0";
            }


            if (string.IsNullOrWhiteSpace(keyvalue))
            {
                keyvalue = System.Guid.NewGuid().ToString();
            }


            string sqlCount       = "SELECT COUNT(*) AS entityRecords FROM entitystorematerialised." + synapsenamespace + "_" + synapseentityname + " WHERE " + synapseattributename + " = @p_keyAttributeValue;";
            var    paramListCount = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("p_keyAttributeValue", attributevalue)
            };


            int iCount = 0;

            DataSet dsCount = new DataSet();

            try
            {
                dsCount = DataServices.DataSetFromSQL(sqlCount, paramListCount);
                DataTable dt1 = dsCount.Tables[0];
                iCount = System.Convert.ToInt32(dt1.Rows[0]["entityRecords"].ToString());
            }
            catch (Exception ex)
            {
                iCount = 0;
            }

            if (iCount == 0)
            {
                //insert to return row
                string keyAttribute = SynapseEntityHelperServices.GetEntityKeyAttribute(synapsenamespace, synapseentityname);

                StringBuilder sb = new StringBuilder();
                StringBuilder sb_materialised = new StringBuilder();

                var paramListInsert = new List <KeyValuePair <string, object> >();
                var paramListInsert_materialised = new List <KeyValuePair <string, object> >();

                if (keyAttribute == synapseattributename)  //Only insert attributevalue
                {
                    sb.Append("INSERT INTO entitystore." + synapsenamespace + "_" + synapseentityname);
                    sb.Append(" (" + keyAttribute + ")");
                    sb.Append(" VALUES (@keyvalue)");
                    paramListInsert = new List <KeyValuePair <string, object> >()
                    {
                        new KeyValuePair <string, object>("keyvalue", attributevalue)
                    };

                    sb_materialised.Append("INSERT INTO entitystorematerialised." + synapsenamespace + "_" + synapseentityname);
                    sb_materialised.Append(" (" + keyAttribute + ")");
                    sb_materialised.Append(" VALUES (@keyvalue)");
                    paramListInsert_materialised = new List <KeyValuePair <string, object> >()
                    {
                        new KeyValuePair <string, object>("keyvalue", attributevalue)
                    };
                }
                else
                {
                    sb.Append("INSERT INTO entitystore." + synapsenamespace + "_" + synapseentityname);
                    sb.Append(" (" + keyAttribute + "," + synapseattributename + ")");
                    sb.Append(" VALUES (@keyvalue, @synapseattributevalue)");
                    paramListInsert = new List <KeyValuePair <string, object> >()
                    {
                        new KeyValuePair <string, object>("keyvalue", keyvalue),
                        new KeyValuePair <string, object>("synapseattributevalue", attributevalue)
                    };


                    sb_materialised.Append("INSERT INTO entitystorematerialised." + synapsenamespace + "_" + synapseentityname);
                    sb_materialised.Append(" (" + keyAttribute + "," + synapseattributename + ")");
                    sb_materialised.Append(" VALUES (@keyvalue, @synapseattributevalue)");
                    paramListInsert_materialised = new List <KeyValuePair <string, object> >()
                    {
                        new KeyValuePair <string, object>("keyvalue", keyvalue),
                        new KeyValuePair <string, object>("synapseattributevalue", attributevalue)
                    };
                }
                DataServices.executeSQLStatement(sb.ToString(), paramListInsert);
                DataServices.executeSQLStatement(sb_materialised.ToString(), paramListInsert_materialised);
            }

            string fieldList = SynapseEntityHelperServices.GetEntityAttributes(synapsenamespace, synapseentityname, returnsystemattributes);

            if (string.IsNullOrEmpty(fieldList))
            {
                fieldList = " * ";
            }


            string sql       = "SELECT " + fieldList + " FROM entitystorematerialised." + synapsenamespace + "_" + synapseentityname + " WHERE " + synapseattributename + " = @p_keyAttributeValue LIMIT 1;";
            var    paramList = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("p_keyAttributeValue", attributevalue)
            };



            DataSet ds = new DataSet();

            ds = DataServices.DataSetFromSQL(sql, paramList);
            DataTable dt   = ds.Tables[0];
            var       json = DataServices.ConvertDataTabletoJSONObject(dt);

            return(json);
        }
예제 #25
0
        public void CreateAssessment()
        {
            var services = new DataServices();

            services.CreateAssessment("testAssessment");
        }
 /// <summary>
 /// Cập nhật những thay đổi
 /// </summary>
 /// <returns>Kết quả cập nhật có bao nhiêu dòng bị tác động</returns>
 public int CapNhat()
 {
     DataServices.OpenConnection(true);
     return(dataServices.ExecuteUpdate());
 }
예제 #27
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public DataTable GetSchemaGENERAL_CALENDAR_MASTER()
 {
     return(DataServices.ExecuteDataTable(CommandType.Text, "SELECT * FROM  GENERAL_CALENDAR_MASTER WHERE 1=0", null));
 }
예제 #28
0
    public static void Main()
    {
        string sel = "SELECT * FROM ROCKET";

        DataServices.LendReader(sel, new BorrowReader(GetNames));
    }
예제 #29
0
 public void Setup()
 {
     _executor       = SetupSqlQueryExecutor();
     _budgetServices = DataServices.GetBudgetDataServices();
 }
예제 #30
0
 public TestCrudBookingService() : base()
 {
     _bookingDataService = DataServices.GetBookingDataService();
     _mapper             = MapperField.GetMapper();
 }
        public IActionResult SchemaExport()
        {
            string              sql   = @"SELECT entityid as id,entityname as name, synapsenamespacename as synamespace from entitysettings.entitymanager order by synamespace, name";
            DataTable           dt    = new DataTable();
            List <TreeViewNode> nodes = new List <TreeViewNode>();

            dt = DataServices.DataSetFromSQL(sql).Tables[0];
            try
            {
                dt = DataServices.DataSetFromSQL(sql).Tables[0];
                nodes.Add(new TreeViewNode {
                    id = "1", parent = "#", text = "Entities"
                });
                nodes.Add(new TreeViewNode {
                    id = "2", parent = "#", text = "Baseview"
                });
                nodes.Add(new TreeViewNode {
                    id = "3", parent = "#", text = "Lists"
                });
                //Loop and add the Child Nodes.
                foreach (DataRow item in dt.Rows)
                {
                    TreeViewNode node = new TreeViewNode();
                    //node.text = item["name"].ToString();
                    node.text   = item["synamespace"].ToString() + "_" + item["name"].ToString();
                    node.id     = item["id"].ToString();
                    node.parent = "1";
                    nodes.Add(node);
                }
            }
            catch (Exception ex)
            {
            }

            sql = @"SELECT baseview_id as id,baseviewname as name, baseviewnamespace as nspace from listsettings.baseviewmanager order by nspace, baseviewname";
            dt  = new DataTable();
            try
            {
                dt = DataServices.DataSetFromSQL(sql).Tables[0];
            }
            catch (Exception ex)
            {
            }
            foreach (DataRow item in dt.Rows)
            {
                TreeViewNode node = new TreeViewNode();
                //node.text = item["name"].ToString();
                node.text   = item["nspace"].ToString() + "_" + item["name"].ToString();
                node.id     = item["id"].ToString();
                node.parent = "2";
                nodes.Add(node);
            }

            sql = @"SELECT list_id as id,listname as name, listnamespace as lspace from listsettings.listmanager order by lspace, listname";
            dt  = new DataTable();
            try
            {
                dt = DataServices.DataSetFromSQL(sql).Tables[0];
            }
            catch (Exception ex)
            {
            }
            foreach (DataRow item in dt.Rows)
            {
                TreeViewNode node = new TreeViewNode();
                //node.text = item["name"].ToString();
                node.text   = item["lspace"].ToString() + "_" + item["name"].ToString();
                node.id     = item["id"].ToString();
                node.parent = "3";
                nodes.Add(node);
            }
            ViewBag.Json = JsonConvert.SerializeObject(nodes);
            return(View());
        }
예제 #32
0
        // TODO: using the configure
        private async void AssistCommandHelper(object param)
        {
            IDictionary <string, string> values = param as Dictionary <string, string>;
            string assistTableName = values != null && values.ContainsKey("AssistTable") ? values["AssistTable"]  : null;
            string assistQuery     = values.ContainsKey("AssistQuery") ? values["AssistQuery"]  : null;

            /*  ok now i have to handle the assist helper.
             *  The smartest thing is to detect the table from the query.
             */

            var resultMap = await _assistDataService.Mapper.ExecuteAssistGeneric(assistTableName.ToUpper(), assistQuery);

            IMapper             mapper             = MapperField.GetMapper();
            IHelperDataServices helperDataServices = DataServices.GetHelperDataServices();

            if (assistTableName != null)
            {
                assistTableName = assistTableName.ToUpper();

                switch (assistTableName)
                {
                case "ACTIVEHI":
                {
                    ActivityDtos = resultMap as IEnumerable <VehicleActivitiesDto>;
                    break;
                }

                case "PROPIE":
                {
                    OwnerDtos = resultMap as IEnumerable <OwnerDto>;
                    break;
                }

                case "AGENTES":
                {
                    AgentDtos = resultMap as IEnumerable <AgentDto>;
                    break;
                }

                case "ASSURANCE":
                {
                    AssuranceDtos = resultMap as IEnumerable <SupplierSummaryDto>;
                    break;
                }

                case "ASSURANCE_1":
                {
                    AssistancePolicyAssuranceDtos = resultMap as IEnumerable <SupplierSummaryDto>;
                    break;
                }

                case "ASSURANCE_2":
                {
                    AdditionalAssuranceDtos = resultMap as IEnumerable <SupplierSummaryDto>;
                    break;
                }

                case "ASSURANCE_3":
                {
                    AssistanceAssuranceDtos = resultMap as IEnumerable <SupplierSummaryDto>;
                    break;
                }

                case "ASSURANCE_AGENT":
                {
                    AssuranceAgentDtos = resultMap as IEnumerable <SupplierSummaryDto>;
                    break;
                }

                case "PROVEE1":
                {
                    BuyerSupplierDto = resultMap as IEnumerable <SupplierSummaryDto>;
                    break;
                }

                case "PROVEE2":
                {
                    ProveeDto2 = resultMap as IEnumerable <SupplierSummaryDto>;
                    break;
                }

                case "CU1":
                {
                    AccountDtos = resultMap as IEnumerable <AccountDto>;
                    break;
                }

                case "FORMAS":
                {
                    PaymentFormDto = resultMap as IEnumerable <PaymentFormDto>;
                    break;
                }

                case "CLIENTES1":
                {
                    ClientsDto = resultMap as IEnumerable <ClientSummaryExtended>;
                    break;
                }

                case "CLIENT_ASSIST":
                {
                    ClientsDto = resultMap as IEnumerable <ClientSummaryExtended>;
                    break;
                }

                case "ACCOUNT_INMOVILIZADO":
                {
                    AccountDtosImmobilized = resultMap as IEnumerable <AccountDto>;
                    break;
                }

                case "ACCOUNT_PAYMENT_ACCOUNT":
                {
                    AccountDtoPaymentAccount = resultMap as IEnumerable <AccountDto>;
                    break;
                }

                case "ACCOUNT_PREVIUOS_PAYMENT":
                {
                    AccountDtoPreviousRepayment = resultMap as IEnumerable <AccountDto>;

                    break;
                }

                case "ACCOUNT_ACCUMULATED_REPAYMENT":
                {
                    AccountDtoAccmulatedRepayment = resultMap as IEnumerable <AccountDto>;
                    break;
                }

                case "POBLACIONES":
                {
                    CityDto = resultMap as IEnumerable <CityDto>;
                    break;
                }

                case "OFICINA1":
                {
                    OtherOffice1Dto = resultMap as IEnumerable <OfficeDtos>;
                    break;
                }

                case "OFICINA2":
                {
                    OtherOffice2Dto = resultMap as IEnumerable <OfficeDtos>;
                    break;
                }

                case "OFICINA3":
                {
                    OtherOffice3Dto = resultMap as IEnumerable <OfficeDtos>;
                    break;
                }

                case "COLORFL":
                {
                    ColorDtos = resultMap as IEnumerable <ColorDto>;
                    break;
                }

                case "MARCAS":
                {
                    BrandDtos = (IEnumerable <BrandVehicleDto>)resultMap;
                    break;
                }

                case "MODELO":
                {
                    ModelDtos = resultMap as IEnumerable <ModelVehicleDto>;
                    break;
                }

                case "GRUPOS":
                {
                    VehicleGroupDtos = resultMap as IEnumerable <VehicleGroupDto>;
                    break;
                }

                case "SITUATION":
                {
                    CurrentSituationDto = resultMap as IEnumerable <CurrentSituationDto>;
                    break;
                }

                case "ROAD_TAXES_CITY":
                {
                    RoadTaxesCityDto = resultMap as IEnumerable <CityDto>;
                    break;
                }

                case "ROAD_TAXES_ZONAOFI":
                {
                    RoadTaxesOfficeZoneDto = resultMap as IEnumerable <ZonaOfiDto>;
                    break;
                }

                case "RESELLER_ASSIST":
                {
                    ResellerDto = resultMap as IEnumerable <ResellerDto>;
                    break;
                }
                }
            }
        }
예제 #33
0
 /// <summary>
 /// Test wykonywany przy wywo³aniach metod Find.
 /// </summary>
 public void TestFinding()
 {
     DataServices.FindAll(typeof(Rocket));
     DataServices.Find(typeof(Rocket), "Orbit");
 }
예제 #34
0
파일: frm_JEM.cs 프로젝트: ubaidmughal/SAP
        public string postJe()
        {
            long   jdtNum  = 0;
            int    errnum  = 0;
            string errDesc = "";
            string outStr  = "";
            string jeType  = "PP";

            if (optPP.Selected)
            {
                jeType = "PP";
            }
            if (optPC.Selected)
            {
                jeType = "PC";
            }
            if (optC.Selected)
            {
                jeType = "C";
            }

            if (!chkPost.Checked)
            {
                Program.objHrmsUI.oApplication.SetStatusBarMessage("You need to check the approved box before posting");
                return("Error");
            }
            if (txRef1.Value == "")
            {
                Program.objHrmsUI.oApplication.SetStatusBarMessage("Select a transaction to post!");
                return("Error");
            }
            SAPbobsCOM.JournalEntries vJE = (SAPbobsCOM.JournalEntries)Program.objHrmsUI.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalEntries);


            string   Remarks     = txRem.Value.ToString();
            DateTime postingDate = DateTime.ParseExact(txDD.Value, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None);



            try
            {
                vJE.ReferenceDate = postingDate;
                vJE.TaxDate       = postingDate;
                vJE.DueDate       = postingDate;
                if (Remarks.Length > 20)
                {
                    vJE.Memo = Remarks.Substring(0, 20); // dgSales[3, i].Value.ToString().Substring(0, 20);
                }
                else
                {
                    vJE.Memo = Remarks;
                }
                vJE.Reference  = txRef1.Value;
                vJE.Reference2 = txRef2.Value;
                vJE.Reference3 = "PRL";

                for (int i = 0; i < mtDet.RowCount; i++)
                {
                    string codetype = dtDet.GetValue("cType", i);
                    string acctcode = dtDet.GetValue("cCode", i);
                    string acctname = dtDet.GetValue("cName", i);
                    string debit    = Convert.ToString(dtDet.GetValue("cDebit", i));
                    string credit   = Convert.ToString(dtDet.GetValue("cCredit", i));
                    string project  = dtDet.GetValue("cProject", i);
                    string ocr1     = dtDet.GetValue("cOcr1", i);
                    string ocr2     = dtDet.GetValue("cOcr2", i);
                    string ocr3     = dtDet.GetValue("cOcr3", i);
                    string ocr4     = dtDet.GetValue("cOcr4", i);
                    string ocr5     = dtDet.GetValue("cOcr5", i);


                    if (codetype == "GL")
                    {
                        vJE.Lines.AccountCode = acctcode;
                    }
                    else
                    {
                        vJE.Lines.ShortName = acctcode;
                    }
                    if (jeType == "PP")
                    {
                        vJE.Lines.Credit = Convert.ToDouble(credit);
                        vJE.Lines.Debit  = Convert.ToDouble(debit);
                    }
                    else
                    {
                        vJE.Lines.Credit = Convert.ToDouble(debit);
                        vJE.Lines.Debit  = Convert.ToDouble(credit);
                    }
                    vJE.Lines.DueDate        = postingDate;
                    vJE.Lines.ReferenceDate1 = postingDate;
                    vJE.Lines.TaxDate        = postingDate;
                    vJE.Lines.Reference1     = vJE.Reference;
                    vJE.Lines.Reference2     = vJE.Reference2;
                    vJE.Lines.ProjectCode    = project;
                    vJE.Lines.CostingCode    = ocr1;
                    vJE.Lines.CostingCode2   = ocr2;
                    vJE.Lines.CostingCode3   = ocr3;
                    vJE.Lines.CostingCode4   = ocr4;
                    vJE.Lines.CostingCode5   = ocr5;
                    vJE.Lines.Add();
                }
            }
            catch (Exception ex)
            {
                outStr = ex.Message;
            }
            if (vJE.Add() != 0)
            {
                int    erroCode = 0;
                string errDescr = "";
                Program.objHrmsUI.oCompany.GetLastError(out erroCode, out errDescr);
                outStr = "Error:" + errDescr + outStr;
                Program.objHrmsUI.oApplication.SetStatusBarMessage(outStr);
            }
            else
            {
                outStr = Convert.ToString(Program.objHrmsUI.oCompany.GetNewObjectKey());
                DataServices ds = new DataServices(Program.strConMena);
                ds.ExecuteNonQuery("Exec [dbo].[JE_PRL_UpdatedPostedJE] '" + txRef1.Value + "','" + outStr + "','" + jeType + "'  ");

                Program.objHrmsUI.oApplication.SetStatusBarMessage("Journal Entry Created. JE # " + outStr, BoMessageTime.bmt_Medium, false);
                iniUI();
            }
            return(outStr);
        }
예제 #35
0
        public Policy Mine(SessionActivity sessionActivity)
        {
            var dataService = new DataServices();

            return(dataService.GetPolicy(sessionActivity));
        }
 public async void RetrieveDataAsync()
 {
     UserInfo = await DataServices.GetDataAsync();
 }
예제 #37
0
        private void exportBgWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            MySqlConnection serverCon    = null;
            int             affectedRows = 0;

            log.AppendLine("Checking Server Connection...");

            try
            {
                serverCon = new ConnectionManager(
                    Settings.Default.PushServer,
                    Settings.Default.PushServerDB,
                    Settings.Default.PushServerDBPort,
                    Settings.Default.PushServerDBUser,
                    Settings.Default.PushServerDBPassword).
                            getDBConnection();

                log.AppendLine("Server Connection Confirmed...");
            }

            catch (Exception exp)
            {
                log.AppendLine("Unable to continue sync..." + exp.Message);
            }

            if (serverCon.State == ConnectionState.Open)
            {
                int batchSize = 1000;

                try
                {
                    //Determine total number of records pending..
                    log.AppendLine("Checking size of pending data for sync...");
                    int pendingDataSize = DataServices.GetAttendanceClockPendingSyncSize();


                    log.AppendLine("Total logs pending to by synchronised is:" + pendingDataSize);

                    if (pendingDataSize > 0)
                    {
                        //Continue to Process the Sync in Batch until the pending records are all sent to the server..
                        while (affectedRows < pendingDataSize)
                        {
                            attentanceLogs = DataServices.GetAttendanceClockPendingSync(batchSize, 0);
                            log.AppendLine("Loaded " + attentanceLogs.Count() + " Record... Synching.. ");

                            //Create an exit plan for this while loop...
                            if (attentanceLogs.Count < 1)
                            {
                                break;
                            }

                            List <string> processedIds = new List <string>();
                            foreach (AttendanceLog aLog in attentanceLogs)
                            {
                                if (BgWorker.CancellationPending)
                                {
                                    e.Cancel = true;
                                }

                                int result = 0;
                                try
                                {
                                    result = DataServices.LogAttendanceClock(aLog, serverCon);
                                }
                                catch (Exception exp)
                                {
                                    log.AppendLine(exp.Message);
                                }

                                if (result > 0)
                                {
                                    affectedRows += 1;
                                    processedIds.Add(aLog.Id.ToString());
                                }
                                else
                                {
                                    //For every record that is not added to the SErver,
                                    //we need to reduce the size PendingDataSize to revent our loop from going infinite..
                                    pendingDataSize -= 1;
                                }
                            }

                            //Update SyncStatus of Batch records for succesfully processed Ids on local DB
                            DataServices.UpdateAttendanceClockSyncStatus(processedIds.ToArray(), "1");
                        }
                    }

                    log.AppendLine("Completed. " + affectedRows + " Records was Synchronised to the server");
                }
                catch (Exception exp)
                {
                    log.AppendLine(exp.Message);
                }
            }
        }
예제 #38
0
        public async void OnAssistCommand(object command)
        {
            var value = await DataServices.GetHelperDataServices().GetMappedAllAsyncHelper <LanguageViewObject, IDIOMAS>();

            LanguageDto = value;
        }
예제 #39
0
        public TimerService(DiscordSocketClient client, ModerationServices mod, LevelTesting levelTesting, Random rand, DataServices dataServices)
        {
            _dataServices = dataServices;
            _client       = client;
            _mod          = mod;
            _levelTesting = levelTesting;
            _random       = rand;

            //Code inside this will fire ever {updateInterval} seconds
            Timer = new Timer(_ =>
            {
                _levelTesting.Announce();
                _levelTesting.CheckServerReservations();
                _mod.Cycle();
                ChangePlaying();
            },
                              null,
                              TimeSpan.FromSeconds(_dataServices.StartDelay),      // Time that message should fire after bot has started
                              TimeSpan.FromSeconds(_dataServices.UpdateInterval)); // Time after which message should repeat (`Timeout.Infinite` for no repeat)
        }
예제 #40
0
		/// <summary>
		/// This method runs after inserting a setup before this block to declare the errors
		/// </summary>
		/// <param name="result">result of BlockDataService's special operation, containing error messages</param>
		internal void InsertSetupBeforeCallback(DataServices.BlockDataService.InsertSetupBeforeBlockErrors result)
		{
			//exit if saved successfully
			if (result.IsSaved) return;
			//add the basic error message
			Message.AddEmbeddedException("قادر به افزودن آماده سازی نمی باشد.\nبرخی از Taskهای بعدی در این ایستگاه قابل تغییر نیستند.");
			foreach (var error in result.Errors)
			{
				switch (error.Item1)
				{
					case Soheil.Core.DataServices.BlockDataService.InsertSetupBeforeBlockErrors.ErrorSource.Task:
						var task = TaskList.FirstOrDefault(x => x.Id == error.Item3);
						if (task != null) task.Message.AddEmbeddedException(error.Item2);
						else Message.AddEmbeddedException(error.Item2);
						break;
					case Soheil.Core.DataServices.BlockDataService.InsertSetupBeforeBlockErrors.ErrorSource.NPT:
						var npt = Parent[this.RowIndex].NPTs.FirstOrDefault(x => x.Id == error.Item3);
						if (npt != null) npt.Message.AddEmbeddedException(error.Item2);
						else Message.AddEmbeddedException(error.Item2);
						break;
					case Soheil.Core.DataServices.BlockDataService.InsertSetupBeforeBlockErrors.ErrorSource.This:
						Message.AddEmbeddedException(error.Item2);
						break;
					default:
						break;
				}
			}
		}
        /// <summary>
        /// Initializes this <see cref="LocalOutputAdapter"/>.
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();

            //const string errorMessage = "{0} is missing from Settings - Example: instanceName=default; ArchiveDirectories={{c:\\Archive1\\;d:\\Backups2\\}}; dataChannel={{port=9591; interface=0.0.0.0}}";
            Dictionary<string, string> settings = Settings;
            string setting;

            // Validate settings.
            if (!settings.TryGetValue("instanceName", out m_instanceName) || string.IsNullOrWhiteSpace(m_instanceName))
                m_instanceName = Name;

            // Track instance in static dictionary
            Instances[InstanceName] = this;

            if (!settings.TryGetValue("WorkingDirectory", out setting) || string.IsNullOrEmpty(setting))
                setting = "Archive";

            WorkingDirectory = setting;

            if (settings.TryGetValue("ArchiveDirectories", out setting))
                ArchiveDirectories = setting;

            if (settings.TryGetValue("AttachedPaths", out setting))
                AttachedPaths = setting;

            if (!settings.TryGetValue("DataChannel", out m_dataChannel))
                m_dataChannel = DefaultDataChannel;

            double targetFileSize;

            if (!settings.TryGetValue("TargetFileSize", out setting) || !double.TryParse(setting, out targetFileSize))
                targetFileSize = DefaultTargetFileSize;

            if (targetFileSize < 0.1D || targetFileSize > SI2.Tera)
                targetFileSize = DefaultTargetFileSize;

            if (!settings.TryGetValue("MaximumArchiveDays", out setting) || !int.TryParse(setting, out m_maximumArchiveDays))
                m_maximumArchiveDays = DefaultMaximumArchiveDays;

            if (!settings.TryGetValue("DirectoryNamingMode", out setting) || !Enum.TryParse(setting, true, out m_directoryNamingMode))
                DirectoryNamingMode = DefaultDirectoryNamingMode;

            // Handle advanced settings - there are hidden but available from manual entry into connection string
            int stagingCount, diskFlushInterval, cacheFlushInterval;

            if (!settings.TryGetValue("StagingCount", out setting) || !int.TryParse(setting, out stagingCount))
                stagingCount = 3;

            if (!settings.TryGetValue("DiskFlushInterval", out setting) || !int.TryParse(setting, out diskFlushInterval))
                diskFlushInterval = 10000;

            if (!settings.TryGetValue("CacheFlushInterval", out setting) || !int.TryParse(setting, out cacheFlushInterval))
                cacheFlushInterval = 100;

            // Establish archive information for this historian instance
            m_archiveInfo = new HistorianServerDatabaseConfig(InstanceName, WorkingDirectory, true);

            if ((object)m_archiveDirectories != null)
                m_archiveInfo.FinalWritePaths.AddRange(m_archiveDirectories);

            if ((object)m_attachedPaths != null)
                m_archiveInfo.ImportPaths.AddRange(m_attachedPaths);

            m_archiveInfo.TargetFileSize = (long)(targetFileSize * SI.Giga);
            m_archiveInfo.DirectoryMethod = DirectoryNamingMode;
            m_archiveInfo.StagingCount = stagingCount;
            m_archiveInfo.DiskFlushInterval = diskFlushInterval;
            m_archiveInfo.CacheFlushInterval = cacheFlushInterval;

            // Provide web service support
            m_dataServices = new DataServices();
            m_dataServices.AdapterCreated += DataServices_AdapterCreated;
            m_dataServices.AdapterLoaded += DataServices_AdapterLoaded;
            m_dataServices.AdapterUnloaded += DataServices_AdapterUnloaded;
            m_dataServices.AdapterLoadException += AdapterLoader_AdapterLoadException;

            // Provide archive replication support
            m_replicationProviders = new ReplicationProviders();
            m_replicationProviders.AdapterCreated += ReplicationProviders_AdapterCreated;
            m_replicationProviders.AdapterLoaded += ReplicationProviders_AdapterLoaded;
            m_replicationProviders.AdapterUnloaded += ReplicationProviders_AdapterUnloaded;
            m_replicationProviders.AdapterLoadException += AdapterLoader_AdapterLoadException;

            if (MaximumArchiveDays > 0)
            {
                m_dailyTimer = new Timer(Time.SecondsPerDay * 1000.0D);
                m_dailyTimer.AutoReset = true;
                m_dailyTimer.Elapsed += m_dailyTimer_Elapsed;
                m_dailyTimer.Enabled = true;
            }
        }