Inheritance: MonoBehaviour
        /// <summary>
        ///     The event handler of this entity container which occurs on each
        ///     Request sent to the serivce. 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void ZGWSAMPLE_SRV_SendingRequest(object sender, System.Data.Services.Client.SendingRequestEventArgs e)
        {   
            HttpWebRequest webRequest = e.Request as HttpWebRequest;

            //ADN Modif
            ServiceDetails serviceDetail = null; // ConfigurationReaderHandler.Instance.GetServiceDetails("ZGWSAMPLE_SRV");
            
            if (serviceDetail == null)
            {
                serviceDetail = new ServiceDetails { Url = @"https://sapes1.sapdevcenter.com:443/sap/opu/odata/sap/ZGWSAMPLE_SRV/", Client = "", SSO = "BASIC" };
            }
			string language = System.Globalization.CultureInfo.CurrentUICulture.Name;
            webRequest.Headers["Accept-Language"] = language;
            BusinessConnectivityHelper.HandleSAPConnectivity(serviceDetail,ref webRequest);

			//The Below section helps you handle delta token. If you wish to use the details then pass the AtomDeltaToken back to your application.
            //To enable this section please set the value of "EnableDeltaToken" for the corresponding service to "Enabled".
            if (serviceDetail.HandleDeltaTokenDecision)
				{
					DataService dataService = new DataService();
					if (webRequest.Method == "GET")
						{
							HttpWebRequest clonedWebRequest = webRequest.CloneRequestForXSRFToken(webRequest.RequestUri.AbsoluteUri);
							HttpWebResponse webResponse = clonedWebRequest.GetResponse() as HttpWebResponse;
							if (webResponse.StatusCode == HttpStatusCode.OK)
								{
									string response = webResponse.ReadResponse();
									this.AtomDeltaToken = dataService.ReadResponse<AtomDeltaTokens>(response);
								}
						}
				}
			}
Exemplo n.º 2
0
		public void Test1()
		{
			var ds = new DataService<NorthwindDB>();
			var mp = ds.GetService(typeof(IDataServiceMetadataProvider));


		}
 /// <summary>
 /// Fire up the repos and service context in the constructor.
 /// </summary>
 /// <param name="oAuthorization"></param>
 public SyncService(OAuthorizationdto oAuthorization)
 {
     dataserviceFactory = new DataserviceFactory(oAuthorization);
     dataService = dataserviceFactory.getDataService();
     syncObjects = new Syncdto();
     syncRepository = new SyncRepository();
 }
 public MapViewModel(INavigationResolver resolver, DataService.IGeoDataService service) 
 {
     _resolver = resolver;
     _service = service;
     Issues = new ObservableCollection<DataService.IssueItem>();
     InitData();
 }
Exemplo n.º 5
0
        public void AddRemoveCategory()
        {
            var context = new CoreDataContext();
            var uow = new EntityFrameworkUnitOfWork(context);
            var repo = new EntityFrameworkRepository<Guid, Category, GuidIdInitializer>(context);

            var caregoryService = new DataService<Guid, Category, EntityFrameworkRepository<Guid, Category, GuidIdInitializer>>(uow, repo);

            var newCategory = caregoryService.Add(new Category
            {
                Name = "Computres",
                Categories = new List<Category>
                {
                    new Category { Name = "-DeskTops" },
                    new Category { Name = "-Servers" },
                    new Category { Name = "-Laptops", Categories = new List<Category>
                        {
                            new Category { Name = "--Tablets" },
                            new Category { Name = "--Shmablets" },
                        }
                    },
                }
            });

            var justAdded = caregoryService.Get(c => c.Id == newCategory.Id);
            Assert.AreEqual(justAdded.Categories.Count, newCategory.Categories.Count);

            caregoryService.Remove(justAdded);
            justAdded = caregoryService.Get(c => c.Id == newCategory.Id);
            Assert.IsNull(justAdded);
        }
Exemplo n.º 6
0
 public void TestDeleteValue()
 {
     DataService dataService = new DataService();
     dataService.SetValue("TestKey", "TestValue");
     dataService.DeleteValue("TestKey");
     Assert.IsInstanceOf(typeof(KeyNotFoundException), dataService.GetValue("TestKey").ThrownException);
 }
        public when_a_customer_is_requested()
        {
            fakeDataService = A.Fake<DataService>();
            //A.CallTo(() => fakeDataService.AddMessage()).MustHaveHappened();

            handler = new GetIndex(fakeDataService);
        }
Exemplo n.º 8
0
 public DataTable LayDsLoaiNguoiDung()
 {
     SqlCommand cmd = new SqlCommand("SELECT * FROM LOAINGUOIDUNG");
     DataService dS = new DataService();
     dS.Load(cmd);
     m_LoaiNguoiDungData = dS;
     return m_LoaiNguoiDungData;
 }
Exemplo n.º 9
0
	//Metodo para obtener las  Respuestas desde la base de datos.
	public void getAnswers(){
		ds = new DataService("medicina.db");	/*Especifia nombre de la base de datos*/
		ds.CreateDB ();
		var respuestas=ds.GetRespuestas(); /*El numero 1 es el ID de la pregunta que estamos evaluando*/
		foreach(var respuesta in respuestas){
			answer = respuesta.Texto;
		}
	}
Exemplo n.º 10
0
 public DataTable LayDsKhoanChi(String sqlString)
 {
     SqlCommand cmd = new SqlCommand(sqlString);
     DataService dS = new DataService();
     dS.Load(cmd);
     m_KhoanChiData = dS;
     return m_KhoanChiData;
 }
Exemplo n.º 11
0
 public DataTable LayDsKhoanChi()
 {
     SqlCommand cmd = new SqlCommand(TruyVanChung());
     DataService dS = new DataService();
     dS.Load(cmd);
     m_KhoanChiData = dS;
     return m_KhoanChiData;
 }
Exemplo n.º 12
0
 public int XoaPhieuThu(int SoPT)
 {
     SqlCommand cmd = new SqlCommand("dbo.Delete_PhieuThu");
     cmd.CommandType = CommandType.StoredProcedure;
     cmd.Parameters.Add(new SqlParameter("@SoPT", SoPT));
     DataService dS = new DataService();
     return dS.ExecuteNoneQuery(cmd);
 }
Exemplo n.º 13
0
        public static int CapNhatTimKiemTuDong(Boolean timKiemTuDong)
        {
            DataService m_QuyDinhData = new DataService();
            SqlCommand cmd = new SqlCommand("UPDATE QUYDINH SET TimKiemTuDong= @timKiemTuDong");
            cmd.Parameters.Add("timKiemTuDong", SqlDbType.Bit).Value = timKiemTuDong;

            return m_QuyDinhData.Load(cmd);
        }
Exemplo n.º 14
0
 public DataTable LayDsQuyDinh()
 {
     SqlCommand cmd = new SqlCommand("SELECT * FROM QUYDINH");
     DataService dS = new DataService();
     dS.Load(cmd);
     m_QuyDinhData = dS;
     return m_QuyDinhData;
 }
Exemplo n.º 15
0
 public DataTable LayDsNhanVien(String sqlString)
 {
     SqlCommand cmd = new SqlCommand(sqlString);
     DataService dS = new DataService();
     dS.Load(cmd);
     m_NhanVienData = dS;
     return m_NhanVienData;
 }
Exemplo n.º 16
0
 public DataTable LayDsNhanVien()
 {
     SqlCommand cmd = new SqlCommand(TruyVanChung());
     DataService dS = new DataService();
     dS.Load(cmd);
     m_NhanVienData = dS;
     return m_NhanVienData;
 }
Exemplo n.º 17
0
 void client_GetGestureDataCompleted(object sender, DataService.GetGestureDataCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         gestureInfo = SerializationHelper.Desirialize(e.Result);
         defBuilder.AddGesture(gestureInfo);
     }
 }
Exemplo n.º 18
0
 public int XacNhanPhieuChi(int SoPC)
 {
     SqlCommand cmd = new SqlCommand("dbo.XacNhan_PhieuChi");
     cmd.CommandType = CommandType.StoredProcedure;
     cmd.Parameters.Add(new SqlParameter("@SoPC", SoPC));
     DataService dS = new DataService();
     return dS.ExecuteNoneQuery(cmd);
 }
Exemplo n.º 19
0
 public void ApiOnline()
 {
     Task.Run(async () =>
     {
         var ds = new DataService();
         Assert.IsTrue(await ds.ApiOnline());
     });
 }
Exemplo n.º 20
0
 public SqliteEntityLiteProvider(DataService dataService)
     : base(dataService)
 {
     if (DataService.ProviderName != ProviderName)
     {
         throw new InvalidOperationException(this.GetType().Name + " is for " + ProviderName + ". Not for " + DataService.ProviderName);
     }
 }
Exemplo n.º 21
0
 private void Load_Data()
 {
     DataService dataservice = new DataService();
     dataSet = dataservice.GetSubjectAndWords();
     Page.Session["DataSet"] = dataSet;
     
    
 }
Exemplo n.º 22
0
        static void Main(string[] args)
        {
            DataService dataService = new DataService(new IntData());
            dataService.SendAndReceive();

            dataService.SetData(new StringData());
            dataService.SendAndReceive();
        }
Exemplo n.º 23
0
        public static int CapNhatTaiKhoanCo(Int64 taiKhoanCo)
        {
            DataService m_QuyDinhData = new DataService();
            SqlCommand cmd = new SqlCommand("UPDATE QUYDINH SET TaiKhoanCo = TaiKhoanCo + @taiKhoanCo");
            cmd.Parameters.Add("taiKhoanCo", SqlDbType.BigInt).Value = taiKhoanCo;

            return m_QuyDinhData.Load(cmd);
        }
Exemplo n.º 24
0
	// Use this for initialization
	void Start () {
		var ds = new DataService ("tempDatabase.db");
		ds.CreateDB ();
		var people = ds.GetPersons ();
		ToConsole (people);
		people = ds.GetPersonsNamedRoberto ();
		ToConsole("Searching for Roberto ...");
		ToConsole (people);
	}
Exemplo n.º 25
0
        public static int CapNhatThongTinSaoLuu(int lichSaoLuu, String viTriSaoLuu)
        {
            DataService m_QuyDinhData = new DataService();
            SqlCommand cmd = new SqlCommand("UPDATE QUYDINH SET LichSaoLuu = @lichSaoLuu, ThoiDiemSaoLuuTiepTheo = dateadd(dd, @lichSaoLuu, getdate()), viTriSaoLuu = @viTriSaoLuu");
            cmd.Parameters.Add("lichSaoLuu", SqlDbType.Int).Value = lichSaoLuu;
            cmd.Parameters.Add("viTriSaoLuu", SqlDbType.VarChar).Value = viTriSaoLuu;

            return m_QuyDinhData.Load(cmd);
        }
Exemplo n.º 26
0
        public void DoLiveCycle()
        {
            Task.Run(async () =>
            {
                //arrange
                var usrInfo = new UserInformationEntity()
                {
                    Color = "AF56EB",
                    Name = "TestUser"
                };
                var updateDrinkRequest = new DrinkerRequest(PossibleActions.Update, ApiTestHelper.TestUserGuid)
                {
                    UserInformations = usrInfo
                };
                var existDrinkRequest = new DrinkerRequest(PossibleActions.Exists, ApiTestHelper.TestUserGuid)
                {
                    UserInformations = usrInfo
                };
                var removeDrinkRequest = new DrinkerRequest(PossibleActions.Remove, ApiTestHelper.TestUserGuid)
                {
                    UserInformations = usrInfo
                };
                var ds = new DataService();

                //act
                //check if already exists;
                var res = await ds.PostDrinker(existDrinkRequest);
                ApiAssertHelper.CheckBooleanResponseForFalse(res);

                //add
                res = await ds.PostDrinker(updateDrinkRequest);
                ApiAssertHelper.CheckBooleanResponse(res);

                //check for existence
                var drinker = await ds.GetDrinker(ApiTestHelper.TestUserGuid);
                CheckGetDrinkerResponse(drinker, updateDrinkRequest);

                //update
                updateDrinkRequest.UserInformations.Name = "NewName";
                updateDrinkRequest.UserInformations.Color = "NewColor";
                res = await ds.PostDrinker(updateDrinkRequest);
                ApiAssertHelper.CheckBooleanResponse(res);

                //check for updated values
                drinker = await ds.GetDrinker(ApiTestHelper.TestUserGuid);
                CheckGetDrinkerResponse(drinker, updateDrinkRequest);

                //delete drinker again
                res = await ds.PostDrinker(removeDrinkRequest);
                ApiAssertHelper.CheckBooleanResponse(res);

                //ensure Drinker is deleted;
                res = await ds.PostDrinker(existDrinkRequest);
                ApiAssertHelper.CheckBooleanResponseForFalse(res);
            }).GetAwaiter().GetResult();
        }
Exemplo n.º 27
0
        private void TestForm_Shown(object sender, EventArgs e)
        {
            IDbAdapter adapter = new SQLiteDataAdapter();
            DataService = new DataService {Adapter = adapter};
            Builder = new SQLBuilder(DataService.Adapter);
            Builder.CreateStructure();

            List<Equipment> users = DataService.GetAllForModel(ModelExtensions.CreateInstance<Equipment>);
            Grid.DataSource = users;
        }
Exemplo n.º 28
0
        public DataTable TimTheoMa(String id)
        {
            SqlCommand cmd = new SqlCommand("SELECT * FROM KhoanChi WHERE MaKC LIKE '%' + @id + '%'");
            cmd.Parameters.Add("id", SqlDbType.VarChar).Value = id;

            DataService dS = new DataService();
            dS.Load(cmd);
            m_KhoanChiData = dS;
            return m_KhoanChiData;
        }
Exemplo n.º 29
0
	public void getQuestions(){
		ds= new DataService("medicina.db");
		ds.CreateDB();
		var preguntas= ds.GetPreguntas();
		foreach(var pregunta in preguntas){
			question = pregunta.Texto;
		}


	}
Exemplo n.º 30
0
        public DataTable TimTheoTen(String TenKC)
        {
            SqlCommand cmd = new SqlCommand("SELECT * FROM KhoanChi WHERE TenKC LIKE '%' + @TenKC + '%'");
            cmd.Parameters.Add("TenKC", SqlDbType.NVarChar).Value = TenKC;

            DataService dS = new DataService();
            dS.Load(cmd);
            m_KhoanChiData = dS;
            return m_KhoanChiData;
        }
Exemplo n.º 31
0
        private static void GetTableSchema()
        {
            if (!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("vw_aspnet_Users", TableType.View, DataService.GetInstance("ViewWeb"));
                schema.Columns    = new TableSchema.TableColumnCollection();
                schema.SchemaName = @"dbo";
                //columns

                TableSchema.TableColumn colvarApplicationId = new TableSchema.TableColumn(schema);
                colvarApplicationId.ColumnName    = "ApplicationId";
                colvarApplicationId.DataType      = DbType.Guid;
                colvarApplicationId.MaxLength     = 0;
                colvarApplicationId.AutoIncrement = false;
                colvarApplicationId.IsNullable    = false;
                colvarApplicationId.IsPrimaryKey  = false;
                colvarApplicationId.IsForeignKey  = false;
                colvarApplicationId.IsReadOnly    = false;

                schema.Columns.Add(colvarApplicationId);

                TableSchema.TableColumn colvarUserId = new TableSchema.TableColumn(schema);
                colvarUserId.ColumnName    = "UserId";
                colvarUserId.DataType      = DbType.Guid;
                colvarUserId.MaxLength     = 0;
                colvarUserId.AutoIncrement = false;
                colvarUserId.IsNullable    = false;
                colvarUserId.IsPrimaryKey  = false;
                colvarUserId.IsForeignKey  = false;
                colvarUserId.IsReadOnly    = false;

                schema.Columns.Add(colvarUserId);

                TableSchema.TableColumn colvarUserName = new TableSchema.TableColumn(schema);
                colvarUserName.ColumnName    = "UserName";
                colvarUserName.DataType      = DbType.String;
                colvarUserName.MaxLength     = 256;
                colvarUserName.AutoIncrement = false;
                colvarUserName.IsNullable    = false;
                colvarUserName.IsPrimaryKey  = false;
                colvarUserName.IsForeignKey  = false;
                colvarUserName.IsReadOnly    = false;

                schema.Columns.Add(colvarUserName);

                TableSchema.TableColumn colvarLoweredUserName = new TableSchema.TableColumn(schema);
                colvarLoweredUserName.ColumnName    = "LoweredUserName";
                colvarLoweredUserName.DataType      = DbType.String;
                colvarLoweredUserName.MaxLength     = 256;
                colvarLoweredUserName.AutoIncrement = false;
                colvarLoweredUserName.IsNullable    = false;
                colvarLoweredUserName.IsPrimaryKey  = false;
                colvarLoweredUserName.IsForeignKey  = false;
                colvarLoweredUserName.IsReadOnly    = false;

                schema.Columns.Add(colvarLoweredUserName);

                TableSchema.TableColumn colvarMobileAlias = new TableSchema.TableColumn(schema);
                colvarMobileAlias.ColumnName    = "MobileAlias";
                colvarMobileAlias.DataType      = DbType.String;
                colvarMobileAlias.MaxLength     = 16;
                colvarMobileAlias.AutoIncrement = false;
                colvarMobileAlias.IsNullable    = true;
                colvarMobileAlias.IsPrimaryKey  = false;
                colvarMobileAlias.IsForeignKey  = false;
                colvarMobileAlias.IsReadOnly    = false;

                schema.Columns.Add(colvarMobileAlias);

                TableSchema.TableColumn colvarIsAnonymous = new TableSchema.TableColumn(schema);
                colvarIsAnonymous.ColumnName    = "IsAnonymous";
                colvarIsAnonymous.DataType      = DbType.Boolean;
                colvarIsAnonymous.MaxLength     = 0;
                colvarIsAnonymous.AutoIncrement = false;
                colvarIsAnonymous.IsNullable    = false;
                colvarIsAnonymous.IsPrimaryKey  = false;
                colvarIsAnonymous.IsForeignKey  = false;
                colvarIsAnonymous.IsReadOnly    = false;

                schema.Columns.Add(colvarIsAnonymous);

                TableSchema.TableColumn colvarLastActivityDate = new TableSchema.TableColumn(schema);
                colvarLastActivityDate.ColumnName    = "LastActivityDate";
                colvarLastActivityDate.DataType      = DbType.DateTime;
                colvarLastActivityDate.MaxLength     = 0;
                colvarLastActivityDate.AutoIncrement = false;
                colvarLastActivityDate.IsNullable    = false;
                colvarLastActivityDate.IsPrimaryKey  = false;
                colvarLastActivityDate.IsForeignKey  = false;
                colvarLastActivityDate.IsReadOnly    = false;

                schema.Columns.Add(colvarLastActivityDate);


                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["ViewWeb"].AddSchema("vw_aspnet_Users", schema);
            }
        }
Exemplo n.º 32
0
        private static void GetTableSchema()
        {
            if (!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("SalesReason", TableType.Table, DataService.GetInstance("Default"));
                schema.Columns    = new TableSchema.TableColumnCollection();
                schema.SchemaName = @"Sales";
                //columns

                TableSchema.TableColumn colvarSalesReasonID = new TableSchema.TableColumn(schema);
                colvarSalesReasonID.ColumnName          = "SalesReasonID";
                colvarSalesReasonID.DataType            = DbType.Int32;
                colvarSalesReasonID.MaxLength           = 0;
                colvarSalesReasonID.AutoIncrement       = true;
                colvarSalesReasonID.IsNullable          = false;
                colvarSalesReasonID.IsPrimaryKey        = true;
                colvarSalesReasonID.IsForeignKey        = false;
                colvarSalesReasonID.IsReadOnly          = false;
                colvarSalesReasonID.DefaultSetting      = @"";
                colvarSalesReasonID.ForeignKeyTableName = "";
                schema.Columns.Add(colvarSalesReasonID);

                TableSchema.TableColumn colvarName = new TableSchema.TableColumn(schema);
                colvarName.ColumnName          = "Name";
                colvarName.DataType            = DbType.String;
                colvarName.MaxLength           = 50;
                colvarName.AutoIncrement       = false;
                colvarName.IsNullable          = false;
                colvarName.IsPrimaryKey        = false;
                colvarName.IsForeignKey        = false;
                colvarName.IsReadOnly          = false;
                colvarName.DefaultSetting      = @"";
                colvarName.ForeignKeyTableName = "";
                schema.Columns.Add(colvarName);

                TableSchema.TableColumn colvarReasonType = new TableSchema.TableColumn(schema);
                colvarReasonType.ColumnName          = "ReasonType";
                colvarReasonType.DataType            = DbType.String;
                colvarReasonType.MaxLength           = 50;
                colvarReasonType.AutoIncrement       = false;
                colvarReasonType.IsNullable          = false;
                colvarReasonType.IsPrimaryKey        = false;
                colvarReasonType.IsForeignKey        = false;
                colvarReasonType.IsReadOnly          = false;
                colvarReasonType.DefaultSetting      = @"";
                colvarReasonType.ForeignKeyTableName = "";
                schema.Columns.Add(colvarReasonType);

                TableSchema.TableColumn colvarModifiedDate = new TableSchema.TableColumn(schema);
                colvarModifiedDate.ColumnName    = "ModifiedDate";
                colvarModifiedDate.DataType      = DbType.DateTime;
                colvarModifiedDate.MaxLength     = 0;
                colvarModifiedDate.AutoIncrement = false;
                colvarModifiedDate.IsNullable    = false;
                colvarModifiedDate.IsPrimaryKey  = false;
                colvarModifiedDate.IsForeignKey  = false;
                colvarModifiedDate.IsReadOnly    = false;

                colvarModifiedDate.DefaultSetting      = @"(getdate())";
                colvarModifiedDate.ForeignKeyTableName = "";
                schema.Columns.Add(colvarModifiedDate);

                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["Default"].AddSchema("SalesReason", schema);
            }
        }
Exemplo n.º 33
0
        public static void DeleteData(DataTable table, string path)
        {
            string sPath = path.Contains("'") ? path.Replace("'", "''") : path;

            //DataRow[] rows = table.Select(string.Format("filepath = '{0}'", sPath));

            DataRow[] rows = (from row in table.AsEnumerable()
                              where row.RowState != DataRowState.Deleted && row.RowState != DataRowState.Deleted && row.Field <string>("filepath") == path
                              select row).ToArray();

            List <string> queryList = new List <string>();

            foreach (DataRow row in rows)
            {
                string owner = row["fileowner"].ToString().Trim();

                if (owner == GlobalService.User)
                {
                    List <string> sharedList = GetSharedList(GlobalService.DbTable, sPath);

                    foreach (string shared in sharedList)
                    {
                        if (shared == "-")
                        {
                            continue;
                        }

                        if (!UserUtil.IsCnMember(shared.Trim()) && !UserUtil.IsVnMember(shared.Trim()) && !UserUtil.IsJpMember(shared.Trim()))
                        {
                            string tableName  = "TB_" + AdUtil.GetUserIdByUsername(shared, "kmhk.local");
                            string sharedText = string.Format("delete from " + tableName + " where r_path = N'{0}'", sPath);
                            queryList.Add(sharedText);
                        }
                        else
                        {
                            string sharedText = string.Format("delete from TB_OUTSIDE_SHARE where o_path = N'{0}'", sPath);
                            queryList.Add(sharedText);
                        }
                    }

                    string ownerText = string.Format("delete from " + GlobalService.DbTable + " where r_path = N'{0}'", sPath);
                    queryList.Add(ownerText);

                    if (File.Exists(path))
                    {
                        if (GlobalService.User == UserUtil.HrUserName1())
                        //if (GlobalService.User == "Ling Wai Man(凌慧敏,Velma)")
                        {
                            string directory = @"\\kdthk-dm1\project\IT System\MyCloud Record\" + DateTime.Today.ToString("yyyyMMdd");
                            if (!Directory.Exists(directory))
                            {
                                Directory.CreateDirectory(directory);
                            }

                            string filename = Path.GetFileName(path);

                            File.Copy(path, directory + @"\" + filename);
                        }

                        File.Delete(path);
                    }

                    string delQuery = string.Format("delete from S_OUT_SHARE where o_path = N'{0}'", sPath);
                    DataServiceMes.GetInstance().ExecuteNonQuery(delQuery);
                }
                else
                {
                    string tableName = "TB_" + AdUtil.GetUserIdByUsername(owner, "kmhk.local");

                    List <string> sharedList = GetSharedList(tableName, sPath);
                    sharedList.Remove(GlobalService.User);

                    string shared = string.Join(";", sharedList.ToArray());

                    if (shared == "")
                    {
                        shared = "-";
                    }

                    string ownerText = string.Format("update " + tableName + " set r_shared = N'{0}' where r_path = N'{1}'", shared, sPath);
                    queryList.Add(ownerText);

                    string sharedText = string.Format("delete from " + GlobalService.DbTable + " where r_path = N'{0}'", sPath);
                    queryList.Add(sharedText);
                }

                if (row.RowState != DataRowState.Deleted)
                {
                    row.Delete();
                }
            }

            string now = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");

            string query = string.Format("insert into TB_LOG (log_datetime, log_category, log_path, log_by) values ('{0}', '{1}', N'{2}', N'{3}')", now, "Delete", sPath, GlobalService.User);

            queryList.Add(query);

            foreach (string text in queryList)
            {
                DataService.GetInstance().ExecuteNonQuery(text);
            }
            //QueryUtil.InsertDataToLocalDb(text);
        }
Exemplo n.º 34
0
        private static void GetTableSchema()
        {
            if (!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("phpss_usertrack_req", TableType.Table, DataService.GetInstance("RisProvider"));
                schema.Columns    = new TableSchema.TableColumnCollection();
                schema.SchemaName = @"dbo";
                //columns

                TableSchema.TableColumn colvarId = new TableSchema.TableColumn(schema);
                colvarId.ColumnName          = "id";
                colvarId.DataType            = DbType.Int64;
                colvarId.MaxLength           = 0;
                colvarId.AutoIncrement       = true;
                colvarId.IsNullable          = false;
                colvarId.IsPrimaryKey        = true;
                colvarId.IsForeignKey        = false;
                colvarId.IsReadOnly          = false;
                colvarId.DefaultSetting      = @"";
                colvarId.ForeignKeyTableName = "";
                schema.Columns.Add(colvarId);

                TableSchema.TableColumn colvarSessionfid = new TableSchema.TableColumn(schema);
                colvarSessionfid.ColumnName          = "sessionfid";
                colvarSessionfid.DataType            = DbType.Int32;
                colvarSessionfid.MaxLength           = 0;
                colvarSessionfid.AutoIncrement       = false;
                colvarSessionfid.IsNullable          = false;
                colvarSessionfid.IsPrimaryKey        = false;
                colvarSessionfid.IsForeignKey        = false;
                colvarSessionfid.IsReadOnly          = false;
                colvarSessionfid.DefaultSetting      = @"";
                colvarSessionfid.ForeignKeyTableName = "";
                schema.Columns.Add(colvarSessionfid);

                TableSchema.TableColumn colvarAccountfid = new TableSchema.TableColumn(schema);
                colvarAccountfid.ColumnName          = "accountfid";
                colvarAccountfid.DataType            = DbType.Int16;
                colvarAccountfid.MaxLength           = 0;
                colvarAccountfid.AutoIncrement       = false;
                colvarAccountfid.IsNullable          = false;
                colvarAccountfid.IsPrimaryKey        = false;
                colvarAccountfid.IsForeignKey        = false;
                colvarAccountfid.IsReadOnly          = false;
                colvarAccountfid.DefaultSetting      = @"";
                colvarAccountfid.ForeignKeyTableName = "";
                schema.Columns.Add(colvarAccountfid);

                TableSchema.TableColumn colvarTimestamp = new TableSchema.TableColumn(schema);
                colvarTimestamp.ColumnName          = "timestamp";
                colvarTimestamp.DataType            = DbType.DateTime;
                colvarTimestamp.MaxLength           = 0;
                colvarTimestamp.AutoIncrement       = false;
                colvarTimestamp.IsNullable          = false;
                colvarTimestamp.IsPrimaryKey        = false;
                colvarTimestamp.IsForeignKey        = false;
                colvarTimestamp.IsReadOnly          = false;
                colvarTimestamp.DefaultSetting      = @"";
                colvarTimestamp.ForeignKeyTableName = "";
                schema.Columns.Add(colvarTimestamp);

                TableSchema.TableColumn colvarUsertrackUrlfid = new TableSchema.TableColumn(schema);
                colvarUsertrackUrlfid.ColumnName          = "usertrack_urlfid";
                colvarUsertrackUrlfid.DataType            = DbType.Int32;
                colvarUsertrackUrlfid.MaxLength           = 0;
                colvarUsertrackUrlfid.AutoIncrement       = false;
                colvarUsertrackUrlfid.IsNullable          = false;
                colvarUsertrackUrlfid.IsPrimaryKey        = false;
                colvarUsertrackUrlfid.IsForeignKey        = false;
                colvarUsertrackUrlfid.IsReadOnly          = false;
                colvarUsertrackUrlfid.DefaultSetting      = @"";
                colvarUsertrackUrlfid.ForeignKeyTableName = "";
                schema.Columns.Add(colvarUsertrackUrlfid);

                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["RisProvider"].AddSchema("phpss_usertrack_req", schema);
            }
        }
Exemplo n.º 35
0
        private static void GetTableSchema()
        {
            if (!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("Sys_RelFormularioCobertura", TableType.Table, DataService.GetInstance("RisProvider"));
                schema.Columns    = new TableSchema.TableColumnCollection();
                schema.SchemaName = @"dbo";
                //columns

                TableSchema.TableColumn colvarIdRelFormularioCobertura = new TableSchema.TableColumn(schema);
                colvarIdRelFormularioCobertura.ColumnName          = "idRelFormularioCobertura";
                colvarIdRelFormularioCobertura.DataType            = DbType.Int32;
                colvarIdRelFormularioCobertura.MaxLength           = 0;
                colvarIdRelFormularioCobertura.AutoIncrement       = true;
                colvarIdRelFormularioCobertura.IsNullable          = false;
                colvarIdRelFormularioCobertura.IsPrimaryKey        = true;
                colvarIdRelFormularioCobertura.IsForeignKey        = false;
                colvarIdRelFormularioCobertura.IsReadOnly          = false;
                colvarIdRelFormularioCobertura.DefaultSetting      = @"";
                colvarIdRelFormularioCobertura.ForeignKeyTableName = "";
                schema.Columns.Add(colvarIdRelFormularioCobertura);

                TableSchema.TableColumn colvarIdFormulario = new TableSchema.TableColumn(schema);
                colvarIdFormulario.ColumnName    = "idFormulario";
                colvarIdFormulario.DataType      = DbType.Int32;
                colvarIdFormulario.MaxLength     = 0;
                colvarIdFormulario.AutoIncrement = false;
                colvarIdFormulario.IsNullable    = false;
                colvarIdFormulario.IsPrimaryKey  = false;
                colvarIdFormulario.IsForeignKey  = true;
                colvarIdFormulario.IsReadOnly    = false;

                colvarIdFormulario.DefaultSetting = @"((0))";

                colvarIdFormulario.ForeignKeyTableName = "Rem_Formulario";
                schema.Columns.Add(colvarIdFormulario);

                TableSchema.TableColumn colvarIdTipoCobertura = new TableSchema.TableColumn(schema);
                colvarIdTipoCobertura.ColumnName    = "idTipoCobertura";
                colvarIdTipoCobertura.DataType      = DbType.Int32;
                colvarIdTipoCobertura.MaxLength     = 0;
                colvarIdTipoCobertura.AutoIncrement = false;
                colvarIdTipoCobertura.IsNullable    = false;
                colvarIdTipoCobertura.IsPrimaryKey  = false;
                colvarIdTipoCobertura.IsForeignKey  = true;
                colvarIdTipoCobertura.IsReadOnly    = false;

                colvarIdTipoCobertura.DefaultSetting = @"((0))";

                colvarIdTipoCobertura.ForeignKeyTableName = "Rem_TipoCobertura";
                schema.Columns.Add(colvarIdTipoCobertura);

                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["RisProvider"].AddSchema("Sys_RelFormularioCobertura", schema);
            }
        }
Exemplo n.º 36
0
        private static void GetTableSchema()
        {
            if (!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("dashCommerce_Store_ShippingEstimate", TableType.Table, DataService.GetInstance("dashCommerceProvider"));
                schema.Columns    = new TableSchema.TableColumnCollection();
                schema.SchemaName = @"dbo";
                //columns

                TableSchema.TableColumn colvarShippingEstimateId = new TableSchema.TableColumn(schema);
                colvarShippingEstimateId.ColumnName          = "ShippingEstimateId";
                colvarShippingEstimateId.DataType            = DbType.Int32;
                colvarShippingEstimateId.MaxLength           = 0;
                colvarShippingEstimateId.AutoIncrement       = true;
                colvarShippingEstimateId.IsNullable          = false;
                colvarShippingEstimateId.IsPrimaryKey        = true;
                colvarShippingEstimateId.IsForeignKey        = false;
                colvarShippingEstimateId.IsReadOnly          = false;
                colvarShippingEstimateId.DefaultSetting      = @"";
                colvarShippingEstimateId.ForeignKeyTableName = "";
                schema.Columns.Add(colvarShippingEstimateId);

                TableSchema.TableColumn colvarName = new TableSchema.TableColumn(schema);
                colvarName.ColumnName          = "Name";
                colvarName.DataType            = DbType.String;
                colvarName.MaxLength           = 150;
                colvarName.AutoIncrement       = false;
                colvarName.IsNullable          = false;
                colvarName.IsPrimaryKey        = false;
                colvarName.IsForeignKey        = false;
                colvarName.IsReadOnly          = false;
                colvarName.DefaultSetting      = @"";
                colvarName.ForeignKeyTableName = "";
                schema.Columns.Add(colvarName);

                TableSchema.TableColumn colvarCreatedBy = new TableSchema.TableColumn(schema);
                colvarCreatedBy.ColumnName          = "CreatedBy";
                colvarCreatedBy.DataType            = DbType.String;
                colvarCreatedBy.MaxLength           = 50;
                colvarCreatedBy.AutoIncrement       = false;
                colvarCreatedBy.IsNullable          = true;
                colvarCreatedBy.IsPrimaryKey        = false;
                colvarCreatedBy.IsForeignKey        = false;
                colvarCreatedBy.IsReadOnly          = false;
                colvarCreatedBy.DefaultSetting      = @"";
                colvarCreatedBy.ForeignKeyTableName = "";
                schema.Columns.Add(colvarCreatedBy);

                TableSchema.TableColumn colvarCreatedOn = new TableSchema.TableColumn(schema);
                colvarCreatedOn.ColumnName    = "CreatedOn";
                colvarCreatedOn.DataType      = DbType.DateTime;
                colvarCreatedOn.MaxLength     = 0;
                colvarCreatedOn.AutoIncrement = false;
                colvarCreatedOn.IsNullable    = false;
                colvarCreatedOn.IsPrimaryKey  = false;
                colvarCreatedOn.IsForeignKey  = false;
                colvarCreatedOn.IsReadOnly    = false;

                colvarCreatedOn.DefaultSetting      = @"(getutcdate())";
                colvarCreatedOn.ForeignKeyTableName = "";
                schema.Columns.Add(colvarCreatedOn);

                TableSchema.TableColumn colvarModifiedBy = new TableSchema.TableColumn(schema);
                colvarModifiedBy.ColumnName          = "ModifiedBy";
                colvarModifiedBy.DataType            = DbType.String;
                colvarModifiedBy.MaxLength           = 50;
                colvarModifiedBy.AutoIncrement       = false;
                colvarModifiedBy.IsNullable          = true;
                colvarModifiedBy.IsPrimaryKey        = false;
                colvarModifiedBy.IsForeignKey        = false;
                colvarModifiedBy.IsReadOnly          = false;
                colvarModifiedBy.DefaultSetting      = @"";
                colvarModifiedBy.ForeignKeyTableName = "";
                schema.Columns.Add(colvarModifiedBy);

                TableSchema.TableColumn colvarModifiedOn = new TableSchema.TableColumn(schema);
                colvarModifiedOn.ColumnName    = "ModifiedOn";
                colvarModifiedOn.DataType      = DbType.DateTime;
                colvarModifiedOn.MaxLength     = 0;
                colvarModifiedOn.AutoIncrement = false;
                colvarModifiedOn.IsNullable    = false;
                colvarModifiedOn.IsPrimaryKey  = false;
                colvarModifiedOn.IsForeignKey  = false;
                colvarModifiedOn.IsReadOnly    = false;

                colvarModifiedOn.DefaultSetting      = @"(getutcdate())";
                colvarModifiedOn.ForeignKeyTableName = "";
                schema.Columns.Add(colvarModifiedOn);

                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["dashCommerceProvider"].AddSchema("dashCommerce_Store_ShippingEstimate", schema);
            }
        }
        private static void GetTableSchema()
        {
            if (!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("hitbl_WidgetInstanceText_WIT", TableType.Table, DataService.GetInstance("SqlDataProvider"));
                schema.Columns    = new TableSchema.TableColumnCollection();
                schema.SchemaName = @"dbo";
                //columns

                TableSchema.TableColumn colvarInsId = new TableSchema.TableColumn(schema);
                colvarInsId.ColumnName     = "INS_ID";
                colvarInsId.DataType       = DbType.Guid;
                colvarInsId.MaxLength      = 0;
                colvarInsId.AutoIncrement  = false;
                colvarInsId.IsNullable     = false;
                colvarInsId.IsPrimaryKey   = true;
                colvarInsId.IsForeignKey   = true;
                colvarInsId.IsReadOnly     = false;
                colvarInsId.DefaultSetting = @"";

                colvarInsId.ForeignKeyTableName = "hitbl_WidgetInstance_INS";
                schema.Columns.Add(colvarInsId);

                TableSchema.TableColumn colvarWitLangCode = new TableSchema.TableColumn(schema);
                colvarWitLangCode.ColumnName          = "WIT_LangCode";
                colvarWitLangCode.DataType            = DbType.AnsiString;
                colvarWitLangCode.MaxLength           = 10;
                colvarWitLangCode.AutoIncrement       = false;
                colvarWitLangCode.IsNullable          = false;
                colvarWitLangCode.IsPrimaryKey        = true;
                colvarWitLangCode.IsForeignKey        = false;
                colvarWitLangCode.IsReadOnly          = false;
                colvarWitLangCode.DefaultSetting      = @"";
                colvarWitLangCode.ForeignKeyTableName = "";
                schema.Columns.Add(colvarWitLangCode);

                TableSchema.TableColumn colvarWitTitle = new TableSchema.TableColumn(schema);
                colvarWitTitle.ColumnName          = "WIT_Title";
                colvarWitTitle.DataType            = DbType.String;
                colvarWitTitle.MaxLength           = 255;
                colvarWitTitle.AutoIncrement       = false;
                colvarWitTitle.IsNullable          = false;
                colvarWitTitle.IsPrimaryKey        = false;
                colvarWitTitle.IsForeignKey        = false;
                colvarWitTitle.IsReadOnly          = false;
                colvarWitTitle.DefaultSetting      = @"";
                colvarWitTitle.ForeignKeyTableName = "";
                schema.Columns.Add(colvarWitTitle);

                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["SqlDataProvider"].AddSchema("hitbl_WidgetInstanceText_WIT", schema);
            }
        }
Exemplo n.º 38
0
        private async Task RegisterUserAsync()
        {
            #region Validation
            await CheckUniqueEmailAsync();
            await CheckUniqueUsernameAsync();

            if (string.IsNullOrWhiteSpace(New_Username) ||
                New_Username.Length < 6)
            {
                await new MessageDialog("Your username must be at least 6 characters",
                                        "Please enter a valid username").ShowAsync();
            }
            else if (string.IsNullOrWhiteSpace(New_Password) ||
                     New_Password.Length < 8)
            {
                await new MessageDialog("Your password must be at least 8 characters",
                                        "Please enter a valid password").ShowAsync();
            }
            else if (New_Password != New_ConfirmPassword)
            {
                await new MessageDialog("Your passwords must match").ShowAsync();
            }
            else if (string.IsNullOrWhiteSpace(New_Email) || !IsValidEmail(New_Email))
            {
                await new MessageDialog("Please enter a valid email address").ShowAsync();
            }
            else if (!EmailUnique)
            {
                await new MessageDialog("This email address is already taken").ShowAsync();
            }
            else if (!UsernameUnique)
            {
                await new MessageDialog("This username is already taken").ShowAsync();
            }
            #endregion
            else
            {
                #region Build User

                #region Format Languages/Countries
                foreach (var item in New_NativeLanguages)
                {
                    item.language_name = null;
                }
                foreach (var item in New_StudyLanguages)
                {
                    item.language_name = null;
                }
                #endregion

                var newUser = new HNNewUserContainer
                {
                    user = new HNNewUser
                    {
                        name     = New_Username,
                        email    = New_Email,
                        password = New_Password,
                        password_confirmation = New_ConfirmPassword,
                        profile_attributes    = new HNProfileAttributes {
                            interface_id = 1
                        },
                        terms_of_use            = "1",
                        platform                = "android",
                        mail_setting_attributes = new HNMailSettingAttributes {
                            info = false
                        },

                        native_languages_attributes = New_NativeLanguages,
                        study_languages_attributes  = New_StudyLanguages,
                        #region Notifications Attributes
                        notifications_attributes = new ObservableCollection <HNNotificationsAttribute>
                        {
                            new HNNotificationsAttribute
                            {
                                platform = "android",
                                token    = "fRxU1CeWSL0:APA91bFcj4kOiCfgHNIj2UZHeVK3AUK5c1PasVuJQeSei9Mckx1eiC-BV78uaABOWtVXSWHDMFn4sjba8OKmQxdo_c1MibypzeHrhoaEv0e-J54z_5tCRFZw2kiHtrD8RcS61cQa0bqv"
                            }
                        }
                        #endregion
                    }
                };
                #endregion

                try
                {
                    var createdUser = await DataService.SignUp(newUser);

                    LoggerService.LogEvent("User_registered");
                    ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;
                    if (createdUser.token != null)
                    {
                        localSettings.Values["API_Token"] = createdUser.token;
                        localSettings.Values["User_ID"]   = createdUser.profile.user_attributes.id;
                    }
                    App.ViewModelLocator.Shell.CheckLoggedIn();
                    App.ViewModelLocator.Main.CurrentUser = App.ViewModelLocator.Shell.CurrentUser;
                    App.ViewModelLocator.Main.InitPageAsync();
                    _navigationService.NavigateTo(typeof(MainPage));
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                    if (ex is HttpRequestException)
                    {
                        await new MessageDialog("We're having trouble connecting to the HiNative servers").ShowAsync();
                    }
                    await new MessageDialog("Sign up failed, try a different username and/or email").ShowAsync();
                    LoggerService.LogEvent("Registration_failed");
                }
            }
        }
 public SessionsController(DataService dataService)
 {
     _dataService = dataService;
 }
Exemplo n.º 40
0
        private void InitializeCommands()
        {
            LogInCommand = new RelayCommand(async() =>
            {
                try
                {
                    InCall  = true;
                    var res = await DataService.LogIn(Username, Password);
                    ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;
                    localSettings.Values["User_ID"]        = res.profile.user_attributes.id;
                    localSettings.Values["API_Token"]      = res.token;
                    App.ViewModelLocator.Shell.CheckLoggedIn();
                    App.ViewModelLocator.Main.InitPageAsync();
                    _navigationService.NavigateTo(typeof(MainPage));
                    Username = string.Empty;
                    Password = string.Empty;
                    InCall   = false;
                }
                catch (Exception ex)
                {
                    if (ex is HttpRequestException)
                    {
                        await new MessageDialog("We're having trouble connecting to the HiNative servers").ShowAsync();
                        LoggerService.LogEvent("Login_failed");
                    }
                    else
                    {
                        await new MessageDialog("The username or password your entered was incorrect").ShowAsync();
                    }
                }
            });

            CheckUsernameConflictsCommand = new RelayCommand <TextChangedEventArgs>(args =>
            {
                //CheckUniqueUsernameAsync();
            });
            CheckEmailConflictsCommand = new RelayCommand <TextChangedEventArgs>(args =>
            {
                //CheckUniqueEmailAsync();
            });

            SignUpCommand = new RelayCommand(async() =>
            {
                await RegisterUserAsync();
            });

            #region Add Languages and Countries
            AddNativeLanguageCommand = new RelayCommand(async() =>
            {
                var diag = new SelectLanguageDialog(true);
                var res  = await diag.ShowAsync();
                if (res == ContentDialogResult.Primary)
                {
                    New_NativeLanguages.Add(diag.SelectedLanguage);
                }
            });
            AddStudyLanguageCommand = new RelayCommand(async() =>
            {
                var diag = new SelectLanguageDialog(false);
                var res  = await diag.ShowAsync();
                if (res == ContentDialogResult.Primary)
                {
                    New_StudyLanguages.Add(diag.SelectedLanguage);
                }
            });
            AddNativeCountryCommand = new RelayCommand(async() =>
            {
                var diag = new SelectCountriesDialog();
                var res  = await diag.ShowAsync();
                if (res == ContentDialogResult.Primary)
                {
                    New_NativeCountry = new ObservableCollection <HNCountry> {
                        diag.SelectedCountry
                    };
                }
            });
            AddInterestedCountryCommand = new RelayCommand(async() =>
            {
                var diag = new SelectCountriesDialog();
                var res  = await diag.ShowAsync();
                if (res == ContentDialogResult.Primary)
                {
                    New_InterestedCountries.Add(diag.SelectedCountry);
                }
            });
            #endregion
        }
Exemplo n.º 41
0
        private static void GetTableSchema()
        {
            if (!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("TST_AfiliadosISSN", TableType.Table, DataService.GetInstance("RisProvider"));
                schema.Columns    = new TableSchema.TableColumnCollection();
                schema.SchemaName = @"dbo";
                //columns

                TableSchema.TableColumn colvarId = new TableSchema.TableColumn(schema);
                colvarId.ColumnName          = "id";
                colvarId.DataType            = DbType.Int32;
                colvarId.MaxLength           = 0;
                colvarId.AutoIncrement       = true;
                colvarId.IsNullable          = false;
                colvarId.IsPrimaryKey        = true;
                colvarId.IsForeignKey        = false;
                colvarId.IsReadOnly          = false;
                colvarId.DefaultSetting      = @"";
                colvarId.ForeignKeyTableName = "";
                schema.Columns.Add(colvarId);

                TableSchema.TableColumn colvarTipoDoc = new TableSchema.TableColumn(schema);
                colvarTipoDoc.ColumnName          = "TipoDoc";
                colvarTipoDoc.DataType            = DbType.AnsiString;
                colvarTipoDoc.MaxLength           = 3;
                colvarTipoDoc.AutoIncrement       = false;
                colvarTipoDoc.IsNullable          = true;
                colvarTipoDoc.IsPrimaryKey        = false;
                colvarTipoDoc.IsForeignKey        = false;
                colvarTipoDoc.IsReadOnly          = false;
                colvarTipoDoc.DefaultSetting      = @"";
                colvarTipoDoc.ForeignKeyTableName = "";
                schema.Columns.Add(colvarTipoDoc);

                TableSchema.TableColumn colvarNroDoc = new TableSchema.TableColumn(schema);
                colvarNroDoc.ColumnName          = "NroDoc";
                colvarNroDoc.DataType            = DbType.Int32;
                colvarNroDoc.MaxLength           = 0;
                colvarNroDoc.AutoIncrement       = false;
                colvarNroDoc.IsNullable          = true;
                colvarNroDoc.IsPrimaryKey        = false;
                colvarNroDoc.IsForeignKey        = false;
                colvarNroDoc.IsReadOnly          = false;
                colvarNroDoc.DefaultSetting      = @"";
                colvarNroDoc.ForeignKeyTableName = "";
                schema.Columns.Add(colvarNroDoc);

                TableSchema.TableColumn colvarApeNom = new TableSchema.TableColumn(schema);
                colvarApeNom.ColumnName          = "ApeNom";
                colvarApeNom.DataType            = DbType.AnsiString;
                colvarApeNom.MaxLength           = 25;
                colvarApeNom.AutoIncrement       = false;
                colvarApeNom.IsNullable          = true;
                colvarApeNom.IsPrimaryKey        = false;
                colvarApeNom.IsForeignKey        = false;
                colvarApeNom.IsReadOnly          = false;
                colvarApeNom.DefaultSetting      = @"";
                colvarApeNom.ForeignKeyTableName = "";
                schema.Columns.Add(colvarApeNom);

                TableSchema.TableColumn colvarDomicilio = new TableSchema.TableColumn(schema);
                colvarDomicilio.ColumnName          = "Domicilio";
                colvarDomicilio.DataType            = DbType.AnsiString;
                colvarDomicilio.MaxLength           = 25;
                colvarDomicilio.AutoIncrement       = false;
                colvarDomicilio.IsNullable          = true;
                colvarDomicilio.IsPrimaryKey        = false;
                colvarDomicilio.IsForeignKey        = false;
                colvarDomicilio.IsReadOnly          = false;
                colvarDomicilio.DefaultSetting      = @"";
                colvarDomicilio.ForeignKeyTableName = "";
                schema.Columns.Add(colvarDomicilio);

                TableSchema.TableColumn colvarSimilarityLocalidad = new TableSchema.TableColumn(schema);
                colvarSimilarityLocalidad.ColumnName          = "_Similarity_Localidad";
                colvarSimilarityLocalidad.DataType            = DbType.Single;
                colvarSimilarityLocalidad.MaxLength           = 0;
                colvarSimilarityLocalidad.AutoIncrement       = false;
                colvarSimilarityLocalidad.IsNullable          = true;
                colvarSimilarityLocalidad.IsPrimaryKey        = false;
                colvarSimilarityLocalidad.IsForeignKey        = false;
                colvarSimilarityLocalidad.IsReadOnly          = false;
                colvarSimilarityLocalidad.DefaultSetting      = @"";
                colvarSimilarityLocalidad.ForeignKeyTableName = "";
                schema.Columns.Add(colvarSimilarityLocalidad);

                TableSchema.TableColumn colvarReparticion = new TableSchema.TableColumn(schema);
                colvarReparticion.ColumnName          = "Reparticion";
                colvarReparticion.DataType            = DbType.AnsiString;
                colvarReparticion.MaxLength           = 4;
                colvarReparticion.AutoIncrement       = false;
                colvarReparticion.IsNullable          = true;
                colvarReparticion.IsPrimaryKey        = false;
                colvarReparticion.IsForeignKey        = false;
                colvarReparticion.IsReadOnly          = false;
                colvarReparticion.DefaultSetting      = @"";
                colvarReparticion.ForeignKeyTableName = "";
                schema.Columns.Add(colvarReparticion);

                TableSchema.TableColumn colvarNroAfiliado = new TableSchema.TableColumn(schema);
                colvarNroAfiliado.ColumnName          = "NroAfiliado";
                colvarNroAfiliado.DataType            = DbType.AnsiString;
                colvarNroAfiliado.MaxLength           = 6;
                colvarNroAfiliado.AutoIncrement       = false;
                colvarNroAfiliado.IsNullable          = true;
                colvarNroAfiliado.IsPrimaryKey        = false;
                colvarNroAfiliado.IsForeignKey        = false;
                colvarNroAfiliado.IsReadOnly          = false;
                colvarNroAfiliado.DefaultSetting      = @"";
                colvarNroAfiliado.ForeignKeyTableName = "";
                schema.Columns.Add(colvarNroAfiliado);

                TableSchema.TableColumn colvarCarga = new TableSchema.TableColumn(schema);
                colvarCarga.ColumnName          = "Carga";
                colvarCarga.DataType            = DbType.AnsiString;
                colvarCarga.MaxLength           = 2;
                colvarCarga.AutoIncrement       = false;
                colvarCarga.IsNullable          = true;
                colvarCarga.IsPrimaryKey        = false;
                colvarCarga.IsForeignKey        = false;
                colvarCarga.IsReadOnly          = false;
                colvarCarga.DefaultSetting      = @"";
                colvarCarga.ForeignKeyTableName = "";
                schema.Columns.Add(colvarCarga);

                TableSchema.TableColumn colvarFechaNacimiento = new TableSchema.TableColumn(schema);
                colvarFechaNacimiento.ColumnName          = "FechaNacimiento";
                colvarFechaNacimiento.DataType            = DbType.AnsiString;
                colvarFechaNacimiento.MaxLength           = 8;
                colvarFechaNacimiento.AutoIncrement       = false;
                colvarFechaNacimiento.IsNullable          = true;
                colvarFechaNacimiento.IsPrimaryKey        = false;
                colvarFechaNacimiento.IsForeignKey        = false;
                colvarFechaNacimiento.IsReadOnly          = false;
                colvarFechaNacimiento.DefaultSetting      = @"";
                colvarFechaNacimiento.ForeignKeyTableName = "";
                schema.Columns.Add(colvarFechaNacimiento);

                TableSchema.TableColumn colvarFechaIngreso = new TableSchema.TableColumn(schema);
                colvarFechaIngreso.ColumnName          = "FechaIngreso";
                colvarFechaIngreso.DataType            = DbType.AnsiString;
                colvarFechaIngreso.MaxLength           = 8;
                colvarFechaIngreso.AutoIncrement       = false;
                colvarFechaIngreso.IsNullable          = true;
                colvarFechaIngreso.IsPrimaryKey        = false;
                colvarFechaIngreso.IsForeignKey        = false;
                colvarFechaIngreso.IsReadOnly          = false;
                colvarFechaIngreso.DefaultSetting      = @"";
                colvarFechaIngreso.ForeignKeyTableName = "";
                schema.Columns.Add(colvarFechaIngreso);

                TableSchema.TableColumn colvarFechaVencimiento = new TableSchema.TableColumn(schema);
                colvarFechaVencimiento.ColumnName          = "FechaVencimiento";
                colvarFechaVencimiento.DataType            = DbType.AnsiString;
                colvarFechaVencimiento.MaxLength           = 8;
                colvarFechaVencimiento.AutoIncrement       = false;
                colvarFechaVencimiento.IsNullable          = true;
                colvarFechaVencimiento.IsPrimaryKey        = false;
                colvarFechaVencimiento.IsForeignKey        = false;
                colvarFechaVencimiento.IsReadOnly          = false;
                colvarFechaVencimiento.DefaultSetting      = @"";
                colvarFechaVencimiento.ForeignKeyTableName = "";
                schema.Columns.Add(colvarFechaVencimiento);

                TableSchema.TableColumn colvarLocalidadOriginal = new TableSchema.TableColumn(schema);
                colvarLocalidadOriginal.ColumnName          = "LocalidadOriginal";
                colvarLocalidadOriginal.DataType            = DbType.AnsiString;
                colvarLocalidadOriginal.MaxLength           = 20;
                colvarLocalidadOriginal.AutoIncrement       = false;
                colvarLocalidadOriginal.IsNullable          = true;
                colvarLocalidadOriginal.IsPrimaryKey        = false;
                colvarLocalidadOriginal.IsForeignKey        = false;
                colvarLocalidadOriginal.IsReadOnly          = false;
                colvarLocalidadOriginal.DefaultSetting      = @"";
                colvarLocalidadOriginal.ForeignKeyTableName = "";
                schema.Columns.Add(colvarLocalidadOriginal);

                TableSchema.TableColumn colvarSysLocalidad = new TableSchema.TableColumn(schema);
                colvarSysLocalidad.ColumnName          = "sys_Localidad";
                colvarSysLocalidad.DataType            = DbType.String;
                colvarSysLocalidad.MaxLength           = 100;
                colvarSysLocalidad.AutoIncrement       = false;
                colvarSysLocalidad.IsNullable          = true;
                colvarSysLocalidad.IsPrimaryKey        = false;
                colvarSysLocalidad.IsForeignKey        = false;
                colvarSysLocalidad.IsReadOnly          = false;
                colvarSysLocalidad.DefaultSetting      = @"";
                colvarSysLocalidad.ForeignKeyTableName = "";
                schema.Columns.Add(colvarSysLocalidad);

                TableSchema.TableColumn colvarIdLocalidad = new TableSchema.TableColumn(schema);
                colvarIdLocalidad.ColumnName          = "idLocalidad";
                colvarIdLocalidad.DataType            = DbType.Int32;
                colvarIdLocalidad.MaxLength           = 0;
                colvarIdLocalidad.AutoIncrement       = false;
                colvarIdLocalidad.IsNullable          = true;
                colvarIdLocalidad.IsPrimaryKey        = false;
                colvarIdLocalidad.IsForeignKey        = false;
                colvarIdLocalidad.IsReadOnly          = false;
                colvarIdLocalidad.DefaultSetting      = @"";
                colvarIdLocalidad.ForeignKeyTableName = "";
                schema.Columns.Add(colvarIdLocalidad);

                TableSchema.TableColumn colvarSimilarity = new TableSchema.TableColumn(schema);
                colvarSimilarity.ColumnName          = "_Similarity";
                colvarSimilarity.DataType            = DbType.Single;
                colvarSimilarity.MaxLength           = 0;
                colvarSimilarity.AutoIncrement       = false;
                colvarSimilarity.IsNullable          = true;
                colvarSimilarity.IsPrimaryKey        = false;
                colvarSimilarity.IsForeignKey        = false;
                colvarSimilarity.IsReadOnly          = false;
                colvarSimilarity.DefaultSetting      = @"";
                colvarSimilarity.ForeignKeyTableName = "";
                schema.Columns.Add(colvarSimilarity);

                TableSchema.TableColumn colvarConfidence = new TableSchema.TableColumn(schema);
                colvarConfidence.ColumnName          = "_Confidence";
                colvarConfidence.DataType            = DbType.Single;
                colvarConfidence.MaxLength           = 0;
                colvarConfidence.AutoIncrement       = false;
                colvarConfidence.IsNullable          = true;
                colvarConfidence.IsPrimaryKey        = false;
                colvarConfidence.IsForeignKey        = false;
                colvarConfidence.IsReadOnly          = false;
                colvarConfidence.DefaultSetting      = @"";
                colvarConfidence.ForeignKeyTableName = "";
                schema.Columns.Add(colvarConfidence);

                TableSchema.TableColumn colvarApellido = new TableSchema.TableColumn(schema);
                colvarApellido.ColumnName          = "Apellido";
                colvarApellido.DataType            = DbType.AnsiString;
                colvarApellido.MaxLength           = 25;
                colvarApellido.AutoIncrement       = false;
                colvarApellido.IsNullable          = true;
                colvarApellido.IsPrimaryKey        = false;
                colvarApellido.IsForeignKey        = false;
                colvarApellido.IsReadOnly          = false;
                colvarApellido.DefaultSetting      = @"";
                colvarApellido.ForeignKeyTableName = "";
                schema.Columns.Add(colvarApellido);

                TableSchema.TableColumn colvarNombre = new TableSchema.TableColumn(schema);
                colvarNombre.ColumnName          = "Nombre";
                colvarNombre.DataType            = DbType.AnsiString;
                colvarNombre.MaxLength           = 25;
                colvarNombre.AutoIncrement       = false;
                colvarNombre.IsNullable          = true;
                colvarNombre.IsPrimaryKey        = false;
                colvarNombre.IsForeignKey        = false;
                colvarNombre.IsReadOnly          = false;
                colvarNombre.DefaultSetting      = @"";
                colvarNombre.ForeignKeyTableName = "";
                schema.Columns.Add(colvarNombre);

                TableSchema.TableColumn colvarFechaNacimiento2 = new TableSchema.TableColumn(schema);
                colvarFechaNacimiento2.ColumnName          = "FechaNacimiento2";
                colvarFechaNacimiento2.DataType            = DbType.DateTime;
                colvarFechaNacimiento2.MaxLength           = 0;
                colvarFechaNacimiento2.AutoIncrement       = false;
                colvarFechaNacimiento2.IsNullable          = true;
                colvarFechaNacimiento2.IsPrimaryKey        = false;
                colvarFechaNacimiento2.IsForeignKey        = false;
                colvarFechaNacimiento2.IsReadOnly          = false;
                colvarFechaNacimiento2.DefaultSetting      = @"";
                colvarFechaNacimiento2.ForeignKeyTableName = "";
                schema.Columns.Add(colvarFechaNacimiento2);

                TableSchema.TableColumn colvarFechaIngreso2 = new TableSchema.TableColumn(schema);
                colvarFechaIngreso2.ColumnName          = "FechaIngreso2";
                colvarFechaIngreso2.DataType            = DbType.DateTime;
                colvarFechaIngreso2.MaxLength           = 0;
                colvarFechaIngreso2.AutoIncrement       = false;
                colvarFechaIngreso2.IsNullable          = true;
                colvarFechaIngreso2.IsPrimaryKey        = false;
                colvarFechaIngreso2.IsForeignKey        = false;
                colvarFechaIngreso2.IsReadOnly          = false;
                colvarFechaIngreso2.DefaultSetting      = @"";
                colvarFechaIngreso2.ForeignKeyTableName = "";
                schema.Columns.Add(colvarFechaIngreso2);

                TableSchema.TableColumn colvarNumeroAfiliado = new TableSchema.TableColumn(schema);
                colvarNumeroAfiliado.ColumnName          = "NumeroAfiliado";
                colvarNumeroAfiliado.DataType            = DbType.AnsiString;
                colvarNumeroAfiliado.MaxLength           = 14;
                colvarNumeroAfiliado.AutoIncrement       = false;
                colvarNumeroAfiliado.IsNullable          = true;
                colvarNumeroAfiliado.IsPrimaryKey        = false;
                colvarNumeroAfiliado.IsForeignKey        = false;
                colvarNumeroAfiliado.IsReadOnly          = false;
                colvarNumeroAfiliado.DefaultSetting      = @"";
                colvarNumeroAfiliado.ForeignKeyTableName = "";
                schema.Columns.Add(colvarNumeroAfiliado);

                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["RisProvider"].AddSchema("TST_AfiliadosISSN", schema);
            }
        }
Exemplo n.º 42
0
        private void SkillResponses(int responseID)
        {
            var model = GetDialogCustomData <Model>();

            // This is the first click. Mark the distribution type and wait for confirmation on the next click.
            if (model.DistributionType != responseID)
            {
                model.DistributionType = responseID;
            }
            // This is confirmation to distribute the rank(s). Do it.
            else
            {
                int amount;

                // Figure out how much to increase the skill by.
                if (responseID == 1)
                {
                    amount = 1;
                }
                else if (responseID == 2)
                {
                    amount = 5;
                }
                else if (responseID == 3)
                {
                    amount = 10;
                }
                else
                {
                    // We shouldn't ever see this message, but just in case a future change breaks it...
                    GetPC().FloatingText("You cannot distribute this number of ranks into this skill.");
                    return;
                }

                // Ensure the player can distribute the ranks one more time.
                if (!CanDistribute(amount))
                {
                    GetPC().FloatingText("You cannot distribute these ranks into this skill.");
                    return;
                }

                // Let's do the distribution. Normally, you would want to run the SkillService methods but in this scenario
                // all of that's already been applied. You don't want to reapply the SP gains because they'll get more than they should.
                // Just set the ranks on the DB record and recalc stats.
                var pcSkill = DataService.Single <PCSkill>(x => x.PlayerID == GetPC().GlobalID&& x.SkillID == model.SkillID);
                pcSkill.Rank += amount;
                DataService.SubmitDataChange(pcSkill, DatabaseActionType.Update);
                PlayerStatService.ApplyStatChanges(GetPC(), null);

                // Reduce the pool levels. Delete the record if it drops to zero.
                var pool = DataService.Single <PCSkillPool>(x => x.PlayerID == GetPC().GlobalID&& x.SkillCategoryID == model.SkillCategoryID);
                pool.Levels -= amount;

                if (pool.Levels <= 0)
                {
                    DataService.SubmitDataChange(pool, DatabaseActionType.Delete);
                    EndConversation();
                    return;
                }
                else
                {
                    DataService.SubmitDataChange(pool, DatabaseActionType.Update);
                }

                model.DistributionType = 0;
            }

            LoadSkillPage();
        }
Exemplo n.º 43
0
 public UtilitiesModule(DiscordSocketClient client, DataService dataService)
 {
     _client      = client;
     _dataService = dataService;
 }
Exemplo n.º 44
0
        private static void GetTableSchema()
        {
            if (!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("PN_inciso", TableType.Table, DataService.GetInstance("sicProvider"));
                schema.Columns    = new TableSchema.TableColumnCollection();
                schema.SchemaName = @"dbo";
                //columns

                TableSchema.TableColumn colvarIdInciso = new TableSchema.TableColumn(schema);
                colvarIdInciso.ColumnName          = "id_inciso";
                colvarIdInciso.DataType            = DbType.Int32;
                colvarIdInciso.MaxLength           = 0;
                colvarIdInciso.AutoIncrement       = true;
                colvarIdInciso.IsNullable          = false;
                colvarIdInciso.IsPrimaryKey        = true;
                colvarIdInciso.IsForeignKey        = false;
                colvarIdInciso.IsReadOnly          = false;
                colvarIdInciso.DefaultSetting      = @"";
                colvarIdInciso.ForeignKeyTableName = "";
                schema.Columns.Add(colvarIdInciso);

                TableSchema.TableColumn colvarInsNombre = new TableSchema.TableColumn(schema);
                colvarInsNombre.ColumnName          = "ins_nombre";
                colvarInsNombre.DataType            = DbType.AnsiString;
                colvarInsNombre.MaxLength           = -1;
                colvarInsNombre.AutoIncrement       = false;
                colvarInsNombre.IsNullable          = true;
                colvarInsNombre.IsPrimaryKey        = false;
                colvarInsNombre.IsForeignKey        = false;
                colvarInsNombre.IsReadOnly          = false;
                colvarInsNombre.DefaultSetting      = @"";
                colvarInsNombre.ForeignKeyTableName = "";
                schema.Columns.Add(colvarInsNombre);

                TableSchema.TableColumn colvarCodigo = new TableSchema.TableColumn(schema);
                colvarCodigo.ColumnName    = "codigo";
                colvarCodigo.DataType      = DbType.AnsiString;
                colvarCodigo.MaxLength     = 3;
                colvarCodigo.AutoIncrement = false;
                colvarCodigo.IsNullable    = false;
                colvarCodigo.IsPrimaryKey  = false;
                colvarCodigo.IsForeignKey  = false;
                colvarCodigo.IsReadOnly    = false;

                colvarCodigo.DefaultSetting      = @"((0.0))";
                colvarCodigo.ForeignKeyTableName = "";
                schema.Columns.Add(colvarCodigo);

                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["sicProvider"].AddSchema("PN_inciso", schema);
            }
        }
Exemplo n.º 45
0
        private static void GetTableSchema()
        {
            if (!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("Sys_CIE10", TableType.Table, DataService.GetInstance("RisProvider"));
                schema.Columns    = new TableSchema.TableColumnCollection();
                schema.SchemaName = @"dbo";
                //columns

                TableSchema.TableColumn colvarId = new TableSchema.TableColumn(schema);
                colvarId.ColumnName          = "ID";
                colvarId.DataType            = DbType.Int32;
                colvarId.MaxLength           = 0;
                colvarId.AutoIncrement       = true;
                colvarId.IsNullable          = false;
                colvarId.IsPrimaryKey        = true;
                colvarId.IsForeignKey        = false;
                colvarId.IsReadOnly          = false;
                colvarId.DefaultSetting      = @"";
                colvarId.ForeignKeyTableName = "";
                schema.Columns.Add(colvarId);

                TableSchema.TableColumn colvarCapitulo = new TableSchema.TableColumn(schema);
                colvarCapitulo.ColumnName          = "CAPITULO";
                colvarCapitulo.DataType            = DbType.String;
                colvarCapitulo.MaxLength           = 255;
                colvarCapitulo.AutoIncrement       = false;
                colvarCapitulo.IsNullable          = true;
                colvarCapitulo.IsPrimaryKey        = false;
                colvarCapitulo.IsForeignKey        = false;
                colvarCapitulo.IsReadOnly          = false;
                colvarCapitulo.DefaultSetting      = @"";
                colvarCapitulo.ForeignKeyTableName = "";
                schema.Columns.Add(colvarCapitulo);

                TableSchema.TableColumn colvarGRUPOCIE10 = new TableSchema.TableColumn(schema);
                colvarGRUPOCIE10.ColumnName          = "GRUPOCIE10";
                colvarGRUPOCIE10.DataType            = DbType.String;
                colvarGRUPOCIE10.MaxLength           = 255;
                colvarGRUPOCIE10.AutoIncrement       = false;
                colvarGRUPOCIE10.IsNullable          = true;
                colvarGRUPOCIE10.IsPrimaryKey        = false;
                colvarGRUPOCIE10.IsForeignKey        = false;
                colvarGRUPOCIE10.IsReadOnly          = false;
                colvarGRUPOCIE10.DefaultSetting      = @"";
                colvarGRUPOCIE10.ForeignKeyTableName = "";
                schema.Columns.Add(colvarGRUPOCIE10);

                TableSchema.TableColumn colvarCausa = new TableSchema.TableColumn(schema);
                colvarCausa.ColumnName          = "CAUSA";
                colvarCausa.DataType            = DbType.String;
                colvarCausa.MaxLength           = 255;
                colvarCausa.AutoIncrement       = false;
                colvarCausa.IsNullable          = true;
                colvarCausa.IsPrimaryKey        = false;
                colvarCausa.IsForeignKey        = false;
                colvarCausa.IsReadOnly          = false;
                colvarCausa.DefaultSetting      = @"";
                colvarCausa.ForeignKeyTableName = "";
                schema.Columns.Add(colvarCausa);

                TableSchema.TableColumn colvarSubcausa = new TableSchema.TableColumn(schema);
                colvarSubcausa.ColumnName          = "SUBCAUSA";
                colvarSubcausa.DataType            = DbType.String;
                colvarSubcausa.MaxLength           = 255;
                colvarSubcausa.AutoIncrement       = false;
                colvarSubcausa.IsNullable          = true;
                colvarSubcausa.IsPrimaryKey        = false;
                colvarSubcausa.IsForeignKey        = false;
                colvarSubcausa.IsReadOnly          = false;
                colvarSubcausa.DefaultSetting      = @"";
                colvarSubcausa.ForeignKeyTableName = "";
                schema.Columns.Add(colvarSubcausa);

                TableSchema.TableColumn colvarCodigo = new TableSchema.TableColumn(schema);
                colvarCodigo.ColumnName          = "CODIGO";
                colvarCodigo.DataType            = DbType.String;
                colvarCodigo.MaxLength           = 255;
                colvarCodigo.AutoIncrement       = false;
                colvarCodigo.IsNullable          = true;
                colvarCodigo.IsPrimaryKey        = false;
                colvarCodigo.IsForeignKey        = false;
                colvarCodigo.IsReadOnly          = false;
                colvarCodigo.DefaultSetting      = @"";
                colvarCodigo.ForeignKeyTableName = "";
                schema.Columns.Add(colvarCodigo);

                TableSchema.TableColumn colvarNombre = new TableSchema.TableColumn(schema);
                colvarNombre.ColumnName          = "Nombre";
                colvarNombre.DataType            = DbType.String;
                colvarNombre.MaxLength           = 255;
                colvarNombre.AutoIncrement       = false;
                colvarNombre.IsNullable          = true;
                colvarNombre.IsPrimaryKey        = false;
                colvarNombre.IsForeignKey        = false;
                colvarNombre.IsReadOnly          = false;
                colvarNombre.DefaultSetting      = @"";
                colvarNombre.ForeignKeyTableName = "";
                schema.Columns.Add(colvarNombre);

                TableSchema.TableColumn colvarSinonimo = new TableSchema.TableColumn(schema);
                colvarSinonimo.ColumnName    = "Sinonimo";
                colvarSinonimo.DataType      = DbType.String;
                colvarSinonimo.MaxLength     = 255;
                colvarSinonimo.AutoIncrement = false;
                colvarSinonimo.IsNullable    = true;
                colvarSinonimo.IsPrimaryKey  = false;
                colvarSinonimo.IsForeignKey  = false;
                colvarSinonimo.IsReadOnly    = false;

                colvarSinonimo.DefaultSetting      = @"('')";
                colvarSinonimo.ForeignKeyTableName = "";
                schema.Columns.Add(colvarSinonimo);

                TableSchema.TableColumn colvarDescripCap = new TableSchema.TableColumn(schema);
                colvarDescripCap.ColumnName          = "DescripCap";
                colvarDescripCap.DataType            = DbType.String;
                colvarDescripCap.MaxLength           = 255;
                colvarDescripCap.AutoIncrement       = false;
                colvarDescripCap.IsNullable          = true;
                colvarDescripCap.IsPrimaryKey        = false;
                colvarDescripCap.IsForeignKey        = false;
                colvarDescripCap.IsReadOnly          = false;
                colvarDescripCap.DefaultSetting      = @"";
                colvarDescripCap.ForeignKeyTableName = "";
                schema.Columns.Add(colvarDescripCap);

                TableSchema.TableColumn colvarModif = new TableSchema.TableColumn(schema);
                colvarModif.ColumnName          = "Modif";
                colvarModif.DataType            = DbType.Double;
                colvarModif.MaxLength           = 0;
                colvarModif.AutoIncrement       = false;
                colvarModif.IsNullable          = true;
                colvarModif.IsPrimaryKey        = false;
                colvarModif.IsForeignKey        = false;
                colvarModif.IsReadOnly          = false;
                colvarModif.DefaultSetting      = @"";
                colvarModif.ForeignKeyTableName = "";
                schema.Columns.Add(colvarModif);

                TableSchema.TableColumn colvarCepsap = new TableSchema.TableColumn(schema);
                colvarCepsap.ColumnName          = "CEPSAP";
                colvarCepsap.DataType            = DbType.String;
                colvarCepsap.MaxLength           = 50;
                colvarCepsap.AutoIncrement       = false;
                colvarCepsap.IsNullable          = true;
                colvarCepsap.IsPrimaryKey        = false;
                colvarCepsap.IsForeignKey        = false;
                colvarCepsap.IsReadOnly          = false;
                colvarCepsap.DefaultSetting      = @"";
                colvarCepsap.ForeignKeyTableName = "";
                schema.Columns.Add(colvarCepsap);

                TableSchema.TableColumn colvarC2 = new TableSchema.TableColumn(schema);
                colvarC2.ColumnName    = "C2";
                colvarC2.DataType      = DbType.Boolean;
                colvarC2.MaxLength     = 0;
                colvarC2.AutoIncrement = false;
                colvarC2.IsNullable    = false;
                colvarC2.IsPrimaryKey  = false;
                colvarC2.IsForeignKey  = false;
                colvarC2.IsReadOnly    = false;

                colvarC2.DefaultSetting      = @"((0))";
                colvarC2.ForeignKeyTableName = "";
                schema.Columns.Add(colvarC2);

                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["RisProvider"].AddSchema("Sys_CIE10", schema);
            }
        }
Exemplo n.º 46
0
        public bool Run(params object[] args)
        {
            NWPlaceable container      = (Object.OBJECT_SELF);
            NWPlayer    oPC            = (_.GetLastDisturbed());
            int         type           = _.GetInventoryDisturbType();
            NWItem      item           = (_.GetInventoryDisturbItem());
            var         effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(oPC);

            if (type != _.INVENTORY_DISTURB_TYPE_ADDED)
            {
                return(false);
            }

            int plantID = item.GetLocalInt("PLANT_ID");

            if (plantID <= 0)
            {
                ItemService.ReturnItem(oPC, item);
                oPC.SendMessage("You cannot plant that item.");
                return(true);
            }

            Plant plant = FarmingService.GetPlantByID(plantID);

            if (plant == null)
            {
                ItemService.ReturnItem(oPC, item);
                oPC.SendMessage("You cannot plant that item.");
                return(true);
            }

            int rank = SkillService.GetPCSkillRank(oPC, SkillType.Farming);

            if (rank + 2 < plant.Level)
            {
                ItemService.ReturnItem(oPC, item);
                oPC.SendMessage("You do not have enough Farming skill to plant that seed. (Required: " + (plant.Level - 2) + ")");
                return(true);
            }

            item.Destroy();

            string   areaTag       = container.Area.Tag;
            Location plantLocation = container.Location;
            int      perkBonus     = PerkService.GetPCPerkLevel(oPC, PerkType.FarmingEfficiency) * 2;
            int      ticks         = (int)(plant.BaseTicks - ((PerkService.GetPCPerkLevel(oPC, PerkType.ExpertFarmer) * 0.05f)) * plant.BaseTicks);

            Data.Entity.GrowingPlant growingPlant = new Data.Entity.GrowingPlant
            {
                PlantID             = plant.ID,
                RemainingTicks      = ticks,
                LocationAreaTag     = areaTag,
                LocationOrientation = _.GetFacingFromLocation(plantLocation),
                LocationX           = _.GetPositionFromLocation(plantLocation).m_X,
                LocationY           = _.GetPositionFromLocation(plantLocation).m_Y,
                LocationZ           = _.GetPositionFromLocation(plantLocation).m_Z,
                IsActive            = true,
                DateCreated         = DateTime.UtcNow,
                LongevityBonus      = perkBonus
            };

            DataService.SubmitDataChange(growingPlant, DatabaseActionType.Insert);

            NWPlaceable hole     = (container.GetLocalObject("FARM_SMALL_HOLE"));
            NWPlaceable plantPlc = (_.CreateObject(_.OBJECT_TYPE_PLACEABLE, "growing_plant", hole.Location));

            plantPlc.SetLocalString("GROWING_PLANT_ID", growingPlant.ID.ToString());
            plantPlc.Name = "Growing Plant (" + plant.Name + ")";

            container.Destroy();
            hole.Destroy();

            int xp = (int)SkillService.CalculateRegisteredSkillLevelAdjustedXP(200, plant.Level, rank);

            if (RandomService.Random(100) + 1 <= PerkService.GetPCPerkLevel(oPC, PerkType.Lucky) + effectiveStats.Luck)
            {
                xp *= 2;
            }

            SkillService.GiveSkillXP(oPC, SkillType.Farming, xp);
            return(true);
        }
Exemplo n.º 47
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="context"></param>
 /// <param name="crypt"></param>
 public UserController(DataService context, BCrypt crypt)
 {
     Context = context;
     Crypt   = crypt;
 }
Exemplo n.º 48
0
        private static void GetTableSchema()
        {
            if (!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("Sys_Poblacion", TableType.Table, DataService.GetInstance("RisProvider"));
                schema.Columns    = new TableSchema.TableColumnCollection();
                schema.SchemaName = @"dbo";
                //columns

                TableSchema.TableColumn colvarIdPoblacion = new TableSchema.TableColumn(schema);
                colvarIdPoblacion.ColumnName          = "idPoblacion";
                colvarIdPoblacion.DataType            = DbType.Int32;
                colvarIdPoblacion.MaxLength           = 0;
                colvarIdPoblacion.AutoIncrement       = true;
                colvarIdPoblacion.IsNullable          = false;
                colvarIdPoblacion.IsPrimaryKey        = true;
                colvarIdPoblacion.IsForeignKey        = false;
                colvarIdPoblacion.IsReadOnly          = false;
                colvarIdPoblacion.DefaultSetting      = @"";
                colvarIdPoblacion.ForeignKeyTableName = "";
                schema.Columns.Add(colvarIdPoblacion);

                TableSchema.TableColumn colvarNombre = new TableSchema.TableColumn(schema);
                colvarNombre.ColumnName    = "nombre";
                colvarNombre.DataType      = DbType.String;
                colvarNombre.MaxLength     = 50;
                colvarNombre.AutoIncrement = false;
                colvarNombre.IsNullable    = false;
                colvarNombre.IsPrimaryKey  = false;
                colvarNombre.IsForeignKey  = false;
                colvarNombre.IsReadOnly    = false;

                colvarNombre.DefaultSetting      = @"('')";
                colvarNombre.ForeignKeyTableName = "";
                schema.Columns.Add(colvarNombre);

                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["RisProvider"].AddSchema("Sys_Poblacion", schema);
            }
        }
Exemplo n.º 49
0
 public frmChucVu()
 {
     InitializeComponent();
     DataService.OpenConnection();
 }
Exemplo n.º 50
0
 public OrdersViewModel()
 {
     instance    = this;
     dataService = new DataService();
     OrderDate   = DateTime.Today;
 }
Exemplo n.º 51
0
        private static void GetTableSchema()
        {
            if (!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("PN_nino", TableType.Table, DataService.GetInstance("sicProvider"));
                schema.Columns    = new TableSchema.TableColumnCollection();
                schema.SchemaName = @"dbo";
                //columns

                TableSchema.TableColumn colvarIdNino = new TableSchema.TableColumn(schema);
                colvarIdNino.ColumnName          = "id_nino";
                colvarIdNino.DataType            = DbType.Int32;
                colvarIdNino.MaxLength           = 0;
                colvarIdNino.AutoIncrement       = true;
                colvarIdNino.IsNullable          = false;
                colvarIdNino.IsPrimaryKey        = true;
                colvarIdNino.IsForeignKey        = false;
                colvarIdNino.IsReadOnly          = false;
                colvarIdNino.DefaultSetting      = @"";
                colvarIdNino.ForeignKeyTableName = "";
                schema.Columns.Add(colvarIdNino);

                TableSchema.TableColumn colvarCuie = new TableSchema.TableColumn(schema);
                colvarCuie.ColumnName          = "cuie";
                colvarCuie.DataType            = DbType.AnsiString;
                colvarCuie.MaxLength           = 10;
                colvarCuie.AutoIncrement       = false;
                colvarCuie.IsNullable          = false;
                colvarCuie.IsPrimaryKey        = false;
                colvarCuie.IsForeignKey        = false;
                colvarCuie.IsReadOnly          = false;
                colvarCuie.DefaultSetting      = @"";
                colvarCuie.ForeignKeyTableName = "";
                schema.Columns.Add(colvarCuie);

                TableSchema.TableColumn colvarClave = new TableSchema.TableColumn(schema);
                colvarClave.ColumnName          = "clave";
                colvarClave.DataType            = DbType.AnsiString;
                colvarClave.MaxLength           = 50;
                colvarClave.AutoIncrement       = false;
                colvarClave.IsNullable          = true;
                colvarClave.IsPrimaryKey        = false;
                colvarClave.IsForeignKey        = false;
                colvarClave.IsReadOnly          = false;
                colvarClave.DefaultSetting      = @"";
                colvarClave.ForeignKeyTableName = "";
                schema.Columns.Add(colvarClave);

                TableSchema.TableColumn colvarClaseDoc = new TableSchema.TableColumn(schema);
                colvarClaseDoc.ColumnName          = "clase_doc";
                colvarClaseDoc.DataType            = DbType.AnsiString;
                colvarClaseDoc.MaxLength           = -1;
                colvarClaseDoc.AutoIncrement       = false;
                colvarClaseDoc.IsNullable          = true;
                colvarClaseDoc.IsPrimaryKey        = false;
                colvarClaseDoc.IsForeignKey        = false;
                colvarClaseDoc.IsReadOnly          = false;
                colvarClaseDoc.DefaultSetting      = @"";
                colvarClaseDoc.ForeignKeyTableName = "";
                schema.Columns.Add(colvarClaseDoc);

                TableSchema.TableColumn colvarTipoDoc = new TableSchema.TableColumn(schema);
                colvarTipoDoc.ColumnName          = "tipo_doc";
                colvarTipoDoc.DataType            = DbType.AnsiString;
                colvarTipoDoc.MaxLength           = -1;
                colvarTipoDoc.AutoIncrement       = false;
                colvarTipoDoc.IsNullable          = true;
                colvarTipoDoc.IsPrimaryKey        = false;
                colvarTipoDoc.IsForeignKey        = false;
                colvarTipoDoc.IsReadOnly          = false;
                colvarTipoDoc.DefaultSetting      = @"";
                colvarTipoDoc.ForeignKeyTableName = "";
                schema.Columns.Add(colvarTipoDoc);

                TableSchema.TableColumn colvarNumDoc = new TableSchema.TableColumn(schema);
                colvarNumDoc.ColumnName          = "num_doc";
                colvarNumDoc.DataType            = DbType.Decimal;
                colvarNumDoc.MaxLength           = 0;
                colvarNumDoc.AutoIncrement       = false;
                colvarNumDoc.IsNullable          = true;
                colvarNumDoc.IsPrimaryKey        = false;
                colvarNumDoc.IsForeignKey        = false;
                colvarNumDoc.IsReadOnly          = false;
                colvarNumDoc.DefaultSetting      = @"";
                colvarNumDoc.ForeignKeyTableName = "";
                schema.Columns.Add(colvarNumDoc);

                TableSchema.TableColumn colvarApellido = new TableSchema.TableColumn(schema);
                colvarApellido.ColumnName          = "apellido";
                colvarApellido.DataType            = DbType.AnsiString;
                colvarApellido.MaxLength           = -1;
                colvarApellido.AutoIncrement       = false;
                colvarApellido.IsNullable          = true;
                colvarApellido.IsPrimaryKey        = false;
                colvarApellido.IsForeignKey        = false;
                colvarApellido.IsReadOnly          = false;
                colvarApellido.DefaultSetting      = @"";
                colvarApellido.ForeignKeyTableName = "";
                schema.Columns.Add(colvarApellido);

                TableSchema.TableColumn colvarNombre = new TableSchema.TableColumn(schema);
                colvarNombre.ColumnName          = "nombre";
                colvarNombre.DataType            = DbType.AnsiString;
                colvarNombre.MaxLength           = -1;
                colvarNombre.AutoIncrement       = false;
                colvarNombre.IsNullable          = true;
                colvarNombre.IsPrimaryKey        = false;
                colvarNombre.IsForeignKey        = false;
                colvarNombre.IsReadOnly          = false;
                colvarNombre.DefaultSetting      = @"";
                colvarNombre.ForeignKeyTableName = "";
                schema.Columns.Add(colvarNombre);

                TableSchema.TableColumn colvarFechaNac = new TableSchema.TableColumn(schema);
                colvarFechaNac.ColumnName          = "fecha_nac";
                colvarFechaNac.DataType            = DbType.DateTime;
                colvarFechaNac.MaxLength           = 0;
                colvarFechaNac.AutoIncrement       = false;
                colvarFechaNac.IsNullable          = true;
                colvarFechaNac.IsPrimaryKey        = false;
                colvarFechaNac.IsForeignKey        = false;
                colvarFechaNac.IsReadOnly          = false;
                colvarFechaNac.DefaultSetting      = @"";
                colvarFechaNac.ForeignKeyTableName = "";
                schema.Columns.Add(colvarFechaNac);

                TableSchema.TableColumn colvarFechaControl = new TableSchema.TableColumn(schema);
                colvarFechaControl.ColumnName          = "fecha_control";
                colvarFechaControl.DataType            = DbType.DateTime;
                colvarFechaControl.MaxLength           = 0;
                colvarFechaControl.AutoIncrement       = false;
                colvarFechaControl.IsNullable          = true;
                colvarFechaControl.IsPrimaryKey        = false;
                colvarFechaControl.IsForeignKey        = false;
                colvarFechaControl.IsReadOnly          = false;
                colvarFechaControl.DefaultSetting      = @"";
                colvarFechaControl.ForeignKeyTableName = "";
                schema.Columns.Add(colvarFechaControl);

                TableSchema.TableColumn colvarPeso = new TableSchema.TableColumn(schema);
                colvarPeso.ColumnName          = "peso";
                colvarPeso.DataType            = DbType.Decimal;
                colvarPeso.MaxLength           = 0;
                colvarPeso.AutoIncrement       = false;
                colvarPeso.IsNullable          = true;
                colvarPeso.IsPrimaryKey        = false;
                colvarPeso.IsForeignKey        = false;
                colvarPeso.IsReadOnly          = false;
                colvarPeso.DefaultSetting      = @"";
                colvarPeso.ForeignKeyTableName = "";
                schema.Columns.Add(colvarPeso);

                TableSchema.TableColumn colvarTalla = new TableSchema.TableColumn(schema);
                colvarTalla.ColumnName          = "talla";
                colvarTalla.DataType            = DbType.Decimal;
                colvarTalla.MaxLength           = 0;
                colvarTalla.AutoIncrement       = false;
                colvarTalla.IsNullable          = true;
                colvarTalla.IsPrimaryKey        = false;
                colvarTalla.IsForeignKey        = false;
                colvarTalla.IsReadOnly          = false;
                colvarTalla.DefaultSetting      = @"";
                colvarTalla.ForeignKeyTableName = "";
                schema.Columns.Add(colvarTalla);

                TableSchema.TableColumn colvarPerimCefalico = new TableSchema.TableColumn(schema);
                colvarPerimCefalico.ColumnName          = "perim_cefalico";
                colvarPerimCefalico.DataType            = DbType.Decimal;
                colvarPerimCefalico.MaxLength           = 0;
                colvarPerimCefalico.AutoIncrement       = false;
                colvarPerimCefalico.IsNullable          = true;
                colvarPerimCefalico.IsPrimaryKey        = false;
                colvarPerimCefalico.IsForeignKey        = false;
                colvarPerimCefalico.IsReadOnly          = false;
                colvarPerimCefalico.DefaultSetting      = @"";
                colvarPerimCefalico.ForeignKeyTableName = "";
                schema.Columns.Add(colvarPerimCefalico);

                TableSchema.TableColumn colvarPercenPesoEdad = new TableSchema.TableColumn(schema);
                colvarPercenPesoEdad.ColumnName          = "percen_peso_edad";
                colvarPercenPesoEdad.DataType            = DbType.AnsiString;
                colvarPercenPesoEdad.MaxLength           = -1;
                colvarPercenPesoEdad.AutoIncrement       = false;
                colvarPercenPesoEdad.IsNullable          = true;
                colvarPercenPesoEdad.IsPrimaryKey        = false;
                colvarPercenPesoEdad.IsForeignKey        = false;
                colvarPercenPesoEdad.IsReadOnly          = false;
                colvarPercenPesoEdad.DefaultSetting      = @"";
                colvarPercenPesoEdad.ForeignKeyTableName = "";
                schema.Columns.Add(colvarPercenPesoEdad);

                TableSchema.TableColumn colvarPercenTallaEdad = new TableSchema.TableColumn(schema);
                colvarPercenTallaEdad.ColumnName          = "percen_talla_edad";
                colvarPercenTallaEdad.DataType            = DbType.AnsiString;
                colvarPercenTallaEdad.MaxLength           = -1;
                colvarPercenTallaEdad.AutoIncrement       = false;
                colvarPercenTallaEdad.IsNullable          = true;
                colvarPercenTallaEdad.IsPrimaryKey        = false;
                colvarPercenTallaEdad.IsForeignKey        = false;
                colvarPercenTallaEdad.IsReadOnly          = false;
                colvarPercenTallaEdad.DefaultSetting      = @"";
                colvarPercenTallaEdad.ForeignKeyTableName = "";
                schema.Columns.Add(colvarPercenTallaEdad);

                TableSchema.TableColumn colvarPercenPerimCefaliEdad = new TableSchema.TableColumn(schema);
                colvarPercenPerimCefaliEdad.ColumnName          = "percen_perim_cefali_edad";
                colvarPercenPerimCefaliEdad.DataType            = DbType.AnsiString;
                colvarPercenPerimCefaliEdad.MaxLength           = -1;
                colvarPercenPerimCefaliEdad.AutoIncrement       = false;
                colvarPercenPerimCefaliEdad.IsNullable          = true;
                colvarPercenPerimCefaliEdad.IsPrimaryKey        = false;
                colvarPercenPerimCefaliEdad.IsForeignKey        = false;
                colvarPercenPerimCefaliEdad.IsReadOnly          = false;
                colvarPercenPerimCefaliEdad.DefaultSetting      = @"";
                colvarPercenPerimCefaliEdad.ForeignKeyTableName = "";
                schema.Columns.Add(colvarPercenPerimCefaliEdad);

                TableSchema.TableColumn colvarPercenPesoTalla = new TableSchema.TableColumn(schema);
                colvarPercenPesoTalla.ColumnName          = "percen_peso_talla";
                colvarPercenPesoTalla.DataType            = DbType.AnsiString;
                colvarPercenPesoTalla.MaxLength           = -1;
                colvarPercenPesoTalla.AutoIncrement       = false;
                colvarPercenPesoTalla.IsNullable          = true;
                colvarPercenPesoTalla.IsPrimaryKey        = false;
                colvarPercenPesoTalla.IsForeignKey        = false;
                colvarPercenPesoTalla.IsReadOnly          = false;
                colvarPercenPesoTalla.DefaultSetting      = @"";
                colvarPercenPesoTalla.ForeignKeyTableName = "";
                schema.Columns.Add(colvarPercenPesoTalla);

                TableSchema.TableColumn colvarTripleViral = new TableSchema.TableColumn(schema);
                colvarTripleViral.ColumnName          = "triple_viral";
                colvarTripleViral.DataType            = DbType.DateTime;
                colvarTripleViral.MaxLength           = 0;
                colvarTripleViral.AutoIncrement       = false;
                colvarTripleViral.IsNullable          = true;
                colvarTripleViral.IsPrimaryKey        = false;
                colvarTripleViral.IsForeignKey        = false;
                colvarTripleViral.IsReadOnly          = false;
                colvarTripleViral.DefaultSetting      = @"";
                colvarTripleViral.ForeignKeyTableName = "";
                schema.Columns.Add(colvarTripleViral);

                TableSchema.TableColumn colvarNinoEdad = new TableSchema.TableColumn(schema);
                colvarNinoEdad.ColumnName          = "nino_edad";
                colvarNinoEdad.DataType            = DbType.Int32;
                colvarNinoEdad.MaxLength           = 0;
                colvarNinoEdad.AutoIncrement       = false;
                colvarNinoEdad.IsNullable          = true;
                colvarNinoEdad.IsPrimaryKey        = false;
                colvarNinoEdad.IsForeignKey        = false;
                colvarNinoEdad.IsReadOnly          = false;
                colvarNinoEdad.DefaultSetting      = @"";
                colvarNinoEdad.ForeignKeyTableName = "";
                schema.Columns.Add(colvarNinoEdad);

                TableSchema.TableColumn colvarObservaciones = new TableSchema.TableColumn(schema);
                colvarObservaciones.ColumnName          = "observaciones";
                colvarObservaciones.DataType            = DbType.AnsiString;
                colvarObservaciones.MaxLength           = -1;
                colvarObservaciones.AutoIncrement       = false;
                colvarObservaciones.IsNullable          = true;
                colvarObservaciones.IsPrimaryKey        = false;
                colvarObservaciones.IsForeignKey        = false;
                colvarObservaciones.IsReadOnly          = false;
                colvarObservaciones.DefaultSetting      = @"";
                colvarObservaciones.ForeignKeyTableName = "";
                schema.Columns.Add(colvarObservaciones);

                TableSchema.TableColumn colvarFechaCarga = new TableSchema.TableColumn(schema);
                colvarFechaCarga.ColumnName          = "fecha_carga";
                colvarFechaCarga.DataType            = DbType.DateTime;
                colvarFechaCarga.MaxLength           = 0;
                colvarFechaCarga.AutoIncrement       = false;
                colvarFechaCarga.IsNullable          = true;
                colvarFechaCarga.IsPrimaryKey        = false;
                colvarFechaCarga.IsForeignKey        = false;
                colvarFechaCarga.IsReadOnly          = false;
                colvarFechaCarga.DefaultSetting      = @"";
                colvarFechaCarga.ForeignKeyTableName = "";
                schema.Columns.Add(colvarFechaCarga);

                TableSchema.TableColumn colvarUsuario = new TableSchema.TableColumn(schema);
                colvarUsuario.ColumnName          = "usuario";
                colvarUsuario.DataType            = DbType.AnsiString;
                colvarUsuario.MaxLength           = -1;
                colvarUsuario.AutoIncrement       = false;
                colvarUsuario.IsNullable          = true;
                colvarUsuario.IsPrimaryKey        = false;
                colvarUsuario.IsForeignKey        = false;
                colvarUsuario.IsReadOnly          = false;
                colvarUsuario.DefaultSetting      = @"";
                colvarUsuario.ForeignKeyTableName = "";
                schema.Columns.Add(colvarUsuario);

                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["sicProvider"].AddSchema("PN_nino", schema);
            }
        }
Exemplo n.º 52
0
        private static void GetTableSchema()
        {
            if (!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("UsersParagraphLink", TableType.Table, DataService.GetInstance("SSRepository"));
                schema.Columns    = new TableSchema.TableColumnCollection();
                schema.SchemaName = @"dbo";
                //columns

                TableSchema.TableColumn colvarId = new TableSchema.TableColumn(schema);
                colvarId.ColumnName          = "ID";
                colvarId.DataType            = DbType.Int32;
                colvarId.MaxLength           = 0;
                colvarId.AutoIncrement       = true;
                colvarId.IsNullable          = false;
                colvarId.IsPrimaryKey        = true;
                colvarId.IsForeignKey        = false;
                colvarId.IsReadOnly          = false;
                colvarId.DefaultSetting      = @"";
                colvarId.ForeignKeyTableName = "";
                schema.Columns.Add(colvarId);

                TableSchema.TableColumn colvarSourceType = new TableSchema.TableColumn(schema);
                colvarSourceType.ColumnName          = "SourceType";
                colvarSourceType.DataType            = DbType.Int32;
                colvarSourceType.MaxLength           = 0;
                colvarSourceType.AutoIncrement       = false;
                colvarSourceType.IsNullable          = true;
                colvarSourceType.IsPrimaryKey        = false;
                colvarSourceType.IsForeignKey        = false;
                colvarSourceType.IsReadOnly          = false;
                colvarSourceType.DefaultSetting      = @"";
                colvarSourceType.ForeignKeyTableName = "";
                schema.Columns.Add(colvarSourceType);

                TableSchema.TableColumn colvarSourceID = new TableSchema.TableColumn(schema);
                colvarSourceID.ColumnName          = "SourceID";
                colvarSourceID.DataType            = DbType.Int32;
                colvarSourceID.MaxLength           = 0;
                colvarSourceID.AutoIncrement       = false;
                colvarSourceID.IsNullable          = true;
                colvarSourceID.IsPrimaryKey        = false;
                colvarSourceID.IsForeignKey        = false;
                colvarSourceID.IsReadOnly          = false;
                colvarSourceID.DefaultSetting      = @"";
                colvarSourceID.ForeignKeyTableName = "";
                schema.Columns.Add(colvarSourceID);

                TableSchema.TableColumn colvarUserID = new TableSchema.TableColumn(schema);
                colvarUserID.ColumnName          = "UserID";
                colvarUserID.DataType            = DbType.AnsiString;
                colvarUserID.MaxLength           = 100;
                colvarUserID.AutoIncrement       = false;
                colvarUserID.IsNullable          = true;
                colvarUserID.IsPrimaryKey        = false;
                colvarUserID.IsForeignKey        = false;
                colvarUserID.IsReadOnly          = false;
                colvarUserID.DefaultSetting      = @"";
                colvarUserID.ForeignKeyTableName = "";
                schema.Columns.Add(colvarUserID);

                TableSchema.TableColumn colvarDeleted = new TableSchema.TableColumn(schema);
                colvarDeleted.ColumnName    = "Deleted";
                colvarDeleted.DataType      = DbType.Boolean;
                colvarDeleted.MaxLength     = 0;
                colvarDeleted.AutoIncrement = false;
                colvarDeleted.IsNullable    = false;
                colvarDeleted.IsPrimaryKey  = false;
                colvarDeleted.IsForeignKey  = false;
                colvarDeleted.IsReadOnly    = false;

                colvarDeleted.DefaultSetting      = @"((0))";
                colvarDeleted.ForeignKeyTableName = "";
                schema.Columns.Add(colvarDeleted);

                TableSchema.TableColumn colvarDeletedDate = new TableSchema.TableColumn(schema);
                colvarDeletedDate.ColumnName          = "DeletedDate";
                colvarDeletedDate.DataType            = DbType.DateTime;
                colvarDeletedDate.MaxLength           = 0;
                colvarDeletedDate.AutoIncrement       = false;
                colvarDeletedDate.IsNullable          = true;
                colvarDeletedDate.IsPrimaryKey        = false;
                colvarDeletedDate.IsForeignKey        = false;
                colvarDeletedDate.IsReadOnly          = false;
                colvarDeletedDate.DefaultSetting      = @"";
                colvarDeletedDate.ForeignKeyTableName = "";
                schema.Columns.Add(colvarDeletedDate);

                TableSchema.TableColumn colvarDateAdded = new TableSchema.TableColumn(schema);
                colvarDateAdded.ColumnName          = "DateAdded";
                colvarDateAdded.DataType            = DbType.DateTime;
                colvarDateAdded.MaxLength           = 0;
                colvarDateAdded.AutoIncrement       = false;
                colvarDateAdded.IsNullable          = true;
                colvarDateAdded.IsPrimaryKey        = false;
                colvarDateAdded.IsForeignKey        = false;
                colvarDateAdded.IsReadOnly          = false;
                colvarDateAdded.DefaultSetting      = @"";
                colvarDateAdded.ForeignKeyTableName = "";
                schema.Columns.Add(colvarDateAdded);

                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["SSRepository"].AddSchema("UsersParagraphLink", schema);
            }
        }
Exemplo n.º 53
0
 public DecrementMenuOrder(DataService dataService)
 {
     DataService = dataService;
 }
Exemplo n.º 54
0
        private static void GetTableSchema()
        {
            if (!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("L_MANUFACTURE", TableType.Table, DataService.GetInstance("ORM"));
                schema.Columns    = new TableSchema.TableColumnCollection();
                schema.SchemaName = @"dbo";
                //columns

                TableSchema.TableColumn colvarId = new TableSchema.TableColumn(schema);
                colvarId.ColumnName          = "ID";
                colvarId.DataType            = DbType.Int16;
                colvarId.MaxLength           = 0;
                colvarId.AutoIncrement       = true;
                colvarId.IsNullable          = false;
                colvarId.IsPrimaryKey        = true;
                colvarId.IsForeignKey        = false;
                colvarId.IsReadOnly          = false;
                colvarId.DefaultSetting      = @"";
                colvarId.ForeignKeyTableName = "";
                schema.Columns.Add(colvarId);

                TableSchema.TableColumn colvarSName = new TableSchema.TableColumn(schema);
                colvarSName.ColumnName          = "sName";
                colvarSName.DataType            = DbType.String;
                colvarSName.MaxLength           = 100;
                colvarSName.AutoIncrement       = false;
                colvarSName.IsNullable          = true;
                colvarSName.IsPrimaryKey        = false;
                colvarSName.IsForeignKey        = false;
                colvarSName.IsReadOnly          = false;
                colvarSName.DefaultSetting      = @"";
                colvarSName.ForeignKeyTableName = "";
                schema.Columns.Add(colvarSName);

                TableSchema.TableColumn colvarSDesc = new TableSchema.TableColumn(schema);
                colvarSDesc.ColumnName          = "sDesc";
                colvarSDesc.DataType            = DbType.String;
                colvarSDesc.MaxLength           = 150;
                colvarSDesc.AutoIncrement       = false;
                colvarSDesc.IsNullable          = true;
                colvarSDesc.IsPrimaryKey        = false;
                colvarSDesc.IsForeignKey        = false;
                colvarSDesc.IsReadOnly          = false;
                colvarSDesc.DefaultSetting      = @"";
                colvarSDesc.ForeignKeyTableName = "";
                schema.Columns.Add(colvarSDesc);

                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["ORM"].AddSchema("L_MANUFACTURE", schema);
            }
        }
Exemplo n.º 55
0
        private static void GetTableSchema()
        {
            if (!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("BillOfMaterials", TableType.Table, DataService.GetInstance("Default"));
                schema.Columns    = new TableSchema.TableColumnCollection();
                schema.SchemaName = @"Production";
                //columns

                TableSchema.TableColumn colvarBillOfMaterialsID = new TableSchema.TableColumn(schema);
                colvarBillOfMaterialsID.ColumnName          = "BillOfMaterialsID";
                colvarBillOfMaterialsID.DataType            = DbType.Int32;
                colvarBillOfMaterialsID.MaxLength           = 0;
                colvarBillOfMaterialsID.AutoIncrement       = true;
                colvarBillOfMaterialsID.IsNullable          = false;
                colvarBillOfMaterialsID.IsPrimaryKey        = true;
                colvarBillOfMaterialsID.IsForeignKey        = false;
                colvarBillOfMaterialsID.IsReadOnly          = false;
                colvarBillOfMaterialsID.DefaultSetting      = @"";
                colvarBillOfMaterialsID.ForeignKeyTableName = "";
                schema.Columns.Add(colvarBillOfMaterialsID);

                TableSchema.TableColumn colvarProductAssemblyID = new TableSchema.TableColumn(schema);
                colvarProductAssemblyID.ColumnName     = "ProductAssemblyID";
                colvarProductAssemblyID.DataType       = DbType.Int32;
                colvarProductAssemblyID.MaxLength      = 0;
                colvarProductAssemblyID.AutoIncrement  = false;
                colvarProductAssemblyID.IsNullable     = true;
                colvarProductAssemblyID.IsPrimaryKey   = false;
                colvarProductAssemblyID.IsForeignKey   = true;
                colvarProductAssemblyID.IsReadOnly     = false;
                colvarProductAssemblyID.DefaultSetting = @"";

                colvarProductAssemblyID.ForeignKeyTableName = "Product";
                schema.Columns.Add(colvarProductAssemblyID);

                TableSchema.TableColumn colvarComponentID = new TableSchema.TableColumn(schema);
                colvarComponentID.ColumnName     = "ComponentID";
                colvarComponentID.DataType       = DbType.Int32;
                colvarComponentID.MaxLength      = 0;
                colvarComponentID.AutoIncrement  = false;
                colvarComponentID.IsNullable     = false;
                colvarComponentID.IsPrimaryKey   = false;
                colvarComponentID.IsForeignKey   = true;
                colvarComponentID.IsReadOnly     = false;
                colvarComponentID.DefaultSetting = @"";

                colvarComponentID.ForeignKeyTableName = "Product";
                schema.Columns.Add(colvarComponentID);

                TableSchema.TableColumn colvarStartDate = new TableSchema.TableColumn(schema);
                colvarStartDate.ColumnName    = "StartDate";
                colvarStartDate.DataType      = DbType.DateTime;
                colvarStartDate.MaxLength     = 0;
                colvarStartDate.AutoIncrement = false;
                colvarStartDate.IsNullable    = false;
                colvarStartDate.IsPrimaryKey  = false;
                colvarStartDate.IsForeignKey  = false;
                colvarStartDate.IsReadOnly    = false;

                colvarStartDate.DefaultSetting      = @"(getdate())";
                colvarStartDate.ForeignKeyTableName = "";
                schema.Columns.Add(colvarStartDate);

                TableSchema.TableColumn colvarEndDate = new TableSchema.TableColumn(schema);
                colvarEndDate.ColumnName          = "EndDate";
                colvarEndDate.DataType            = DbType.DateTime;
                colvarEndDate.MaxLength           = 0;
                colvarEndDate.AutoIncrement       = false;
                colvarEndDate.IsNullable          = true;
                colvarEndDate.IsPrimaryKey        = false;
                colvarEndDate.IsForeignKey        = false;
                colvarEndDate.IsReadOnly          = false;
                colvarEndDate.DefaultSetting      = @"";
                colvarEndDate.ForeignKeyTableName = "";
                schema.Columns.Add(colvarEndDate);

                TableSchema.TableColumn colvarUnitMeasureCode = new TableSchema.TableColumn(schema);
                colvarUnitMeasureCode.ColumnName     = "UnitMeasureCode";
                colvarUnitMeasureCode.DataType       = DbType.String;
                colvarUnitMeasureCode.MaxLength      = 3;
                colvarUnitMeasureCode.AutoIncrement  = false;
                colvarUnitMeasureCode.IsNullable     = false;
                colvarUnitMeasureCode.IsPrimaryKey   = false;
                colvarUnitMeasureCode.IsForeignKey   = true;
                colvarUnitMeasureCode.IsReadOnly     = false;
                colvarUnitMeasureCode.DefaultSetting = @"";

                colvarUnitMeasureCode.ForeignKeyTableName = "UnitMeasure";
                schema.Columns.Add(colvarUnitMeasureCode);

                TableSchema.TableColumn colvarBOMLevel = new TableSchema.TableColumn(schema);
                colvarBOMLevel.ColumnName          = "BOMLevel";
                colvarBOMLevel.DataType            = DbType.Int16;
                colvarBOMLevel.MaxLength           = 0;
                colvarBOMLevel.AutoIncrement       = false;
                colvarBOMLevel.IsNullable          = false;
                colvarBOMLevel.IsPrimaryKey        = false;
                colvarBOMLevel.IsForeignKey        = false;
                colvarBOMLevel.IsReadOnly          = false;
                colvarBOMLevel.DefaultSetting      = @"";
                colvarBOMLevel.ForeignKeyTableName = "";
                schema.Columns.Add(colvarBOMLevel);

                TableSchema.TableColumn colvarPerAssemblyQty = new TableSchema.TableColumn(schema);
                colvarPerAssemblyQty.ColumnName    = "PerAssemblyQty";
                colvarPerAssemblyQty.DataType      = DbType.Decimal;
                colvarPerAssemblyQty.MaxLength     = 0;
                colvarPerAssemblyQty.AutoIncrement = false;
                colvarPerAssemblyQty.IsNullable    = false;
                colvarPerAssemblyQty.IsPrimaryKey  = false;
                colvarPerAssemblyQty.IsForeignKey  = false;
                colvarPerAssemblyQty.IsReadOnly    = false;

                colvarPerAssemblyQty.DefaultSetting      = @"((1.00))";
                colvarPerAssemblyQty.ForeignKeyTableName = "";
                schema.Columns.Add(colvarPerAssemblyQty);

                TableSchema.TableColumn colvarModifiedDate = new TableSchema.TableColumn(schema);
                colvarModifiedDate.ColumnName    = "ModifiedDate";
                colvarModifiedDate.DataType      = DbType.DateTime;
                colvarModifiedDate.MaxLength     = 0;
                colvarModifiedDate.AutoIncrement = false;
                colvarModifiedDate.IsNullable    = false;
                colvarModifiedDate.IsPrimaryKey  = false;
                colvarModifiedDate.IsForeignKey  = false;
                colvarModifiedDate.IsReadOnly    = false;

                colvarModifiedDate.DefaultSetting      = @"(getdate())";
                colvarModifiedDate.ForeignKeyTableName = "";
                schema.Columns.Add(colvarModifiedDate);

                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["Default"].AddSchema("BillOfMaterials", schema);
            }
        }
Exemplo n.º 56
0
        public static string GetVpath(string filepath)
        {
            string query = string.Format("select top 1 r_vpath from " + GlobalService.DbTable + " where r_path = N'{0}'", filepath);

            return(DataService.GetInstance().ExecuteScalar(query).ToString().Trim());
        }
        private static void GetTableSchema()
        {
            if (!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("InternalPurchaseTable", TableType.Table, DataService.GetInstance("WWIprov"));
                schema.Columns    = new TableSchema.TableColumnCollection();
                schema.SchemaName = @"dbo";
                //columns

                TableSchema.TableColumn colvarId = new TableSchema.TableColumn(schema);
                colvarId.ColumnName          = "ID";
                colvarId.DataType            = DbType.Int32;
                colvarId.MaxLength           = 0;
                colvarId.AutoIncrement       = true;
                colvarId.IsNullable          = false;
                colvarId.IsPrimaryKey        = true;
                colvarId.IsForeignKey        = false;
                colvarId.IsReadOnly          = false;
                colvarId.DefaultSetting      = @"";
                colvarId.ForeignKeyTableName = "";
                schema.Columns.Add(colvarId);

                TableSchema.TableColumn colvarInvoiceNumber = new TableSchema.TableColumn(schema);
                colvarInvoiceNumber.ColumnName     = "InvoiceNumber";
                colvarInvoiceNumber.DataType       = DbType.Int32;
                colvarInvoiceNumber.MaxLength      = 0;
                colvarInvoiceNumber.AutoIncrement  = false;
                colvarInvoiceNumber.IsNullable     = true;
                colvarInvoiceNumber.IsPrimaryKey   = false;
                colvarInvoiceNumber.IsForeignKey   = true;
                colvarInvoiceNumber.IsReadOnly     = false;
                colvarInvoiceNumber.DefaultSetting = @"";

                colvarInvoiceNumber.ForeignKeyTableName = "InternalInvoiceTable";
                schema.Columns.Add(colvarInvoiceNumber);

                TableSchema.TableColumn colvarSupplierID = new TableSchema.TableColumn(schema);
                colvarSupplierID.ColumnName          = "SupplierID";
                colvarSupplierID.DataType            = DbType.Int32;
                colvarSupplierID.MaxLength           = 0;
                colvarSupplierID.AutoIncrement       = false;
                colvarSupplierID.IsNullable          = true;
                colvarSupplierID.IsPrimaryKey        = false;
                colvarSupplierID.IsForeignKey        = false;
                colvarSupplierID.IsReadOnly          = false;
                colvarSupplierID.DefaultSetting      = @"";
                colvarSupplierID.ForeignKeyTableName = "";
                schema.Columns.Add(colvarSupplierID);

                TableSchema.TableColumn colvarEstimatedAmount = new TableSchema.TableColumn(schema);
                colvarEstimatedAmount.ColumnName          = "EstimatedAmount";
                colvarEstimatedAmount.DataType            = DbType.Single;
                colvarEstimatedAmount.MaxLength           = 0;
                colvarEstimatedAmount.AutoIncrement       = false;
                colvarEstimatedAmount.IsNullable          = true;
                colvarEstimatedAmount.IsPrimaryKey        = false;
                colvarEstimatedAmount.IsForeignKey        = false;
                colvarEstimatedAmount.IsReadOnly          = false;
                colvarEstimatedAmount.DefaultSetting      = @"";
                colvarEstimatedAmount.ForeignKeyTableName = "";
                schema.Columns.Add(colvarEstimatedAmount);

                TableSchema.TableColumn colvarEstimationDate = new TableSchema.TableColumn(schema);
                colvarEstimationDate.ColumnName          = "EstimationDate";
                colvarEstimationDate.DataType            = DbType.DateTime;
                colvarEstimationDate.MaxLength           = 0;
                colvarEstimationDate.AutoIncrement       = false;
                colvarEstimationDate.IsNullable          = true;
                colvarEstimationDate.IsPrimaryKey        = false;
                colvarEstimationDate.IsForeignKey        = false;
                colvarEstimationDate.IsReadOnly          = false;
                colvarEstimationDate.DefaultSetting      = @"";
                colvarEstimationDate.ForeignKeyTableName = "";
                schema.Columns.Add(colvarEstimationDate);

                TableSchema.TableColumn colvarAmount = new TableSchema.TableColumn(schema);
                colvarAmount.ColumnName          = "Amount";
                colvarAmount.DataType            = DbType.Single;
                colvarAmount.MaxLength           = 0;
                colvarAmount.AutoIncrement       = false;
                colvarAmount.IsNullable          = true;
                colvarAmount.IsPrimaryKey        = false;
                colvarAmount.IsForeignKey        = false;
                colvarAmount.IsReadOnly          = false;
                colvarAmount.DefaultSetting      = @"";
                colvarAmount.ForeignKeyTableName = "";
                schema.Columns.Add(colvarAmount);

                TableSchema.TableColumn colvarDatePassed = new TableSchema.TableColumn(schema);
                colvarDatePassed.ColumnName          = "DatePassed";
                colvarDatePassed.DataType            = DbType.DateTime;
                colvarDatePassed.MaxLength           = 0;
                colvarDatePassed.AutoIncrement       = false;
                colvarDatePassed.IsNullable          = true;
                colvarDatePassed.IsPrimaryKey        = false;
                colvarDatePassed.IsForeignKey        = false;
                colvarDatePassed.IsReadOnly          = false;
                colvarDatePassed.DefaultSetting      = @"";
                colvarDatePassed.ForeignKeyTableName = "";
                schema.Columns.Add(colvarDatePassed);

                TableSchema.TableColumn colvarPurchaseInvNumber = new TableSchema.TableColumn(schema);
                colvarPurchaseInvNumber.ColumnName          = "PurchaseInvNumber";
                colvarPurchaseInvNumber.DataType            = DbType.String;
                colvarPurchaseInvNumber.MaxLength           = 50;
                colvarPurchaseInvNumber.AutoIncrement       = false;
                colvarPurchaseInvNumber.IsNullable          = true;
                colvarPurchaseInvNumber.IsPrimaryKey        = false;
                colvarPurchaseInvNumber.IsForeignKey        = false;
                colvarPurchaseInvNumber.IsReadOnly          = false;
                colvarPurchaseInvNumber.DefaultSetting      = @"";
                colvarPurchaseInvNumber.ForeignKeyTableName = "";
                schema.Columns.Add(colvarPurchaseInvNumber);

                TableSchema.TableColumn colvarRemarks = new TableSchema.TableColumn(schema);
                colvarRemarks.ColumnName          = "Remarks";
                colvarRemarks.DataType            = DbType.String;
                colvarRemarks.MaxLength           = 50;
                colvarRemarks.AutoIncrement       = false;
                colvarRemarks.IsNullable          = true;
                colvarRemarks.IsPrimaryKey        = false;
                colvarRemarks.IsForeignKey        = false;
                colvarRemarks.IsReadOnly          = false;
                colvarRemarks.DefaultSetting      = @"";
                colvarRemarks.ForeignKeyTableName = "";
                schema.Columns.Add(colvarRemarks);

                TableSchema.TableColumn colvarValueForProfit = new TableSchema.TableColumn(schema);
                colvarValueForProfit.ColumnName          = "ValueForProfit";
                colvarValueForProfit.DataType            = DbType.Single;
                colvarValueForProfit.MaxLength           = 0;
                colvarValueForProfit.AutoIncrement       = false;
                colvarValueForProfit.IsNullable          = true;
                colvarValueForProfit.IsPrimaryKey        = false;
                colvarValueForProfit.IsForeignKey        = false;
                colvarValueForProfit.IsReadOnly          = false;
                colvarValueForProfit.DefaultSetting      = @"";
                colvarValueForProfit.ForeignKeyTableName = "";
                schema.Columns.Add(colvarValueForProfit);

                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["WWIprov"].AddSchema("InternalPurchaseTable", schema);
            }
        }
        /// <summary>
        /// Runs the code example.
        /// </summary>
        /// <param name="user">The AdWords user.</param>
        /// <param name="adGroupId">Id of the ad group for which keyword bid
        /// simulations are retrieved.</param>
        /// <param name="keywordId">Id of the keyword for which bid simulations are
        /// retrieved.</param>
        public void Run(AdWordsUser user, long adGroupId, long keywordId)
        {
            using (DataService dataService = (DataService)user.GetService(
                       AdWordsService.v201802.DataService)) {
                // Create the selector.
                Selector selector = new Selector()
                {
                    fields = new string[] {
                        CriterionBidLandscape.Fields.AdGroupId, CriterionBidLandscape.Fields.CriterionId,
                        CriterionBidLandscape.Fields.StartDate, CriterionBidLandscape.Fields.EndDate,
                        BidLandscapeLandscapePoint.Fields.Bid, BidLandscapeLandscapePoint.Fields.LocalClicks,
                        BidLandscapeLandscapePoint.Fields.LocalCost,
                        BidLandscapeLandscapePoint.Fields.LocalImpressions,
                        BidLandscapeLandscapePoint.Fields.BiddableConversions,
                        BidLandscapeLandscapePoint.Fields.BiddableConversionsValue
                    },
                    predicates = new Predicate[] {
                        Predicate.Equals(CriterionBidLandscape.Fields.AdGroupId, adGroupId),
                        Predicate.Equals(CriterionBidLandscape.Fields.CriterionId, keywordId)
                    },
                    paging = Paging.Default
                };

                CriterionBidLandscapePage page    = new CriterionBidLandscapePage();
                int landscapePointsFound          = 0;
                int landscapePointsInLastResponse = 0;

                try {
                    do
                    {
                        // Get bid landscape for keywords.
                        page = dataService.getCriterionBidLandscape(selector);
                        landscapePointsInLastResponse = 0;

                        // Display bid landscapes.
                        if (page != null && page.entries != null)
                        {
                            foreach (CriterionBidLandscape bidLandscape in page.entries)
                            {
                                Console.WriteLine("Found criterion bid landscape with ad group id '{0}', " +
                                                  "keyword id '{1}', start date '{2}', end date '{3}', and landscape points:",
                                                  bidLandscape.adGroupId, bidLandscape.criterionId,
                                                  bidLandscape.startDate, bidLandscape.endDate);
                                foreach (BidLandscapeLandscapePoint bidLandscapePoint in
                                         bidLandscape.landscapePoints)
                                {
                                    Console.WriteLine("- bid: {0} => clicks: {1}, cost: {2}, impressions: {3}, " +
                                                      "biddable conversions: {4:0.00}, biddable conversions value:{5:0.00}",
                                                      bidLandscapePoint.bid.microAmount, bidLandscapePoint.clicks,
                                                      bidLandscapePoint.cost.microAmount, bidLandscapePoint.impressions,
                                                      bidLandscapePoint.biddableConversions,
                                                      bidLandscapePoint.biddableConversionsValue);
                                    landscapePointsInLastResponse++;
                                    landscapePointsFound++;
                                }
                            }
                        }
                        // Offset by the number of landscape points, NOT the number
                        // of entries (bid landscapes) in the last response.
                        selector.paging.IncreaseOffsetBy(landscapePointsInLastResponse);
                    } while (landscapePointsInLastResponse > 0);
                    Console.WriteLine("Number of keyword bid landscape points found: {0}",
                                      landscapePointsFound);
                } catch (Exception e) {
                    throw new System.ApplicationException("Failed to retrieve keyword bid landscapes.", e);
                }
            }
        }
Exemplo n.º 59
0
 public override string Filepath()
 {
     return(Path.Combine(AppConstants.SettingsDirectory, DataService.Filepath <MimeMap>()));
 }
Exemplo n.º 60
0
        protected override bool LoadData()
        {
            if (!File.Exists(Filepath()))
            {
                List <MimeMap> list = new List <MimeMap>();

                list.Add(new MimeMap()
                {
                    Id = "bmp", Extension = ".bmp", Display = "bmp", Name = "Bitmap", Mime = "image/bmp", View = typeof(ContentItemImageView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "gif", Extension = ".gif", Display = "gif", Name = "GIF", Mime = "image/gif", View = typeof(ContentItemView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "png", Extension = ".png", Display = "png", Name = "PNG", Mime = "image/png", View = typeof(ContentItemImageView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "tiff", Extension = ".tiff", Display = "tiff", Name = "TIFF", Mime = "image/tiff", View = typeof(ContentItemImageView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "jpg", Extension = ".jpg", Display = "jpg", Name = "JPG", Mime = "image/jpg", View = typeof(ContentItemImageView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "pdf", Extension = ".pdf", Display = "pdf", Name = "PDF", Mime = "application/pdf", View = typeof(ContentItemFileView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "xlsx", Extension = ".xlsx", Display = "xlsx", Name = "MS-Excel", Mime = "application/vnd.ms-excel", View = typeof(ContentItemFileView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "xls", Extension = ".xls", Display = "xls", Name = "MS-Excel", Mime = "application/vnd.ms-excel", View = typeof(ContentItemFileView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "docx", Extension = ".docx", Display = "docx", Name = "MS-Word", Mime = "application/msword", View = typeof(ContentItemWordView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "doc", Extension = ".doc", Display = "doc", Name = "MS-Word", Mime = "application/msword", View = typeof(ContentItemFileView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "csv", Extension = ".csv", Display = "csv", Name = "Comma Delimited", Mime = "text/plain", View = typeof(ContentItemTextfileView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "xml", Extension = ".xml", Display = "xml", Name = "XML", Mime = "text/xml", View = typeof(ContentItemTextfileView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "json", Extension = ".json", Display = "json", Name = "JSON", Mime = "application/json", View = typeof(ContentItemJsonView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "js", Extension = ".js", Display = "js", Name = "Javascript", Mime = "text/javascript", View = typeof(ContentItemJavascriptView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "java", Extension = ".java", Display = "java", Name = "Java", Mime = "text/java", View = typeof(ContentItemJavaView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "c#", Extension = ".cs", Display = "c#", Name = "CSharp", Mime = "text/cs", View = typeof(ContentItemCSharpView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "cshtml", Extension = ".cshtml", Display = "cshtml", Name = "CSHTML", Mime = "text/cshtml", View = typeof(ContentItemCSHTMLView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "html", Extension = ".html", Display = "html", Name = "HTML", Mime = "text/html", View = typeof(ContentItemHTMLView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "css", Extension = ".css", Display = "css", Name = "CSS", Mime = "text/css", View = typeof(ContentItemCSSView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "vue", Extension = ".vue", Display = "vue", Name = "VUE", Mime = "text/vue", View = typeof(ContentItemVueJSView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "sql", Extension = ".sql", Display = "sql", Name = "SQL", Mime = "text/sql", View = typeof(ContentItemSQLView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "txt", Extension = ".txt", Display = "txt", Name = "TXT", Mime = "text/plain", View = typeof(ContentItemTextfileView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "text", Extension = ".text", Display = "text", Name = "TEXT", Mime = "text/plain", View = typeof(ContentItemTextView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "note", Extension = ".note", Display = "note", Name = "Note", Mime = "text/plain", View = typeof(ContentItemTextView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "url", Extension = ".url", Display = "url", Name = "Url", Mime = "text/x-url", View = typeof(ContentItemUrlView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "tab", Extension = ".csv", Display = "csv", Name = "CSV", Mime = "text/csv", View = typeof(ContentItemCsvView).FullName
                });
                list.Add(new MimeMap()
                {
                    Id = "rdx", Extension = ".json", Display = "json", Name = "JSON", Mime = "application/x-rolodex-card", View = typeof(ContentItemCardView).FullName
                });
                DataService.TryWrite <MimeMap>(list, out string message, Filepath());
            }

            return(base.LoadData());
        }