text stringlengths 13 6.01M |
|---|
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MusicGameService.Models;
namespace MusicGameService.Controllers
{
class JsonHelper
{
private static JsonHelper _Instance = new JsonHelper();
private JsonHelper()
{
}
public static JsonHelper Instance
{
get
{
return _Instance;
}
}
public JToken ParseListObject(IEnumerable<object> projects)
{
try
{
List<object> arr = projects.ToList<object>();
StringBuilder sb = new StringBuilder();
ParseStringListObject(arr, sb);
return JArray.Parse(sb.ToString());
}
catch { return JArray.Parse("{}"); }
}
public JToken ParseObject(object obj)
{
try
{
return JObject.Parse(ParseStringObject(obj));
}
catch { return JArray.Parse("{}"); }
}
private void ParseStringListObject(List<object> arr, StringBuilder sb)
{
sb.Append("[");
for (int i = 0; i < arr.Count(); i++)
{
sb.Append(ParseStringObject(arr[i]));
if (i < arr.Count() - 1)
sb.Append(",\n");
}
sb.Append("]");
}
private string ParseStringObject(object obj)
{
if (obj.GetType() == typeof(MG_Question))
return ParseStringProject((MG_Question)obj);
if(obj.GetType() == typeof(MG_User))
return ParseStringUser((MG_User)obj);
if (obj.GetType() == typeof(MG_Challenge))
return ParseStringChallenge((MG_Challenge)obj);
return "{}";
}
private string ParseStringUser(MG_User p)
{
if (p == null)
{
return "{}";
}
string body = "{\nidUser:" + p.IdUser.ToString()
+ ", \nname:'" + p.Name.Trim()
+ "', \nlinkfacebook:'" + p.LinkFacebook.ToString()
+ "', \nidfacebook:'" + p.IdFacebook.ToString()
+ "', \nuserimage:'" + p.UserImage.ToString()
+ "', \naveragescore:" + p.AverageScore.ToString()
+ "\n}";
return body;
}
private string ParseStringChallenge(MG_Challenge p)
{
if (p == null)
{
return "{}";
}
string body = "{\nidChallenge:" + p.IdChallenge.ToString()
+ ", \nscore:" + p.ScoreChallenge.ToString()
+ ", \ntime:" + p.TimeChallenge.ToString()
+ ", \nidFaceSend:'" + p.IdFaceSend.Trim()
+ "', \nnameSend:'" + p.NameSend.Trim()
+ "', \nlinkFaceSend:'" + p.LinkFaceSend.Trim()
+ "', \nidFaceReceive:'" + p.IdFaceReceive.Trim()
+ "', \nidQuestion:'" + p.IdQuestion.Trim()
+ "', \nidUserReceive:" + p.IdUserReceive.ToString()
+ "\n}";
return body;
}
private string ParseStringProject(MG_Question p)
{
if (p == null)
{
return "{}";
}
string body = "{\nidQuestion:" + p.IdQuestion.ToString()
+ ", \ntype:" + p.Type.ToString()
+ ", \nsource:'" + p.Source.Trim()
+ "', \ntextQuestion:'" + p.TextQuestion.Trim()
+ "', \ndescription:'" + p.Description.Trim()
+ "', \na:'" + p.A.Trim()
+ "', \nb:'" + p.B.Trim()
+ "', \nc:'" + p.C.Trim()
+ "', \nd:'" + p.D.Trim()
+ "', \nanswer:'" + p.Answer.Trim()
+ "', \ngenre:'" + p.Genre.Trim()
+ "'\n}";
return body;
}
}
}
|
using System;
using EPiServer.Events;
using EPiServer.Events.ServiceModel;
namespace HansKindberg.EPiServer.Events.Remote
{
public class RemoteEventListener : IEventReplication
{
#region Fields
private readonly object _lockObject = new object();
#endregion
#region Properties
protected internal virtual object LockObject
{
get { return this._lockObject; }
}
#endregion
#region Methods
public virtual void RaiseEvent(EventMessage message)
{
if(message == null)
throw new ArgumentNullException("message");
lock(this.LockObject)
{
Console.WriteLine("");
Console.WriteLine("****************** Event Start ********************");
Console.WriteLine(" Application-name : " + message.ApplicationName);
Console.WriteLine(" Event-id : " + message.EventId);
Console.WriteLine(" Parameter : " + message.Parameter);
Console.WriteLine(" Raiser-id : " + message.RaiserId);
Console.WriteLine(" Sent : " + message.Sent);
Console.WriteLine(" Sequence-number : " + message.SequenceNumber);
Console.WriteLine(" Server-name : " + message.ServerName);
Console.WriteLine(" Site-id : " + message.SiteId);
Console.WriteLine(" Verification-data: " + message.VerificationData);
Console.WriteLine("****************** Event End *********************");
Console.WriteLine("");
}
}
#endregion
}
} |
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Tsu.Testing.Tests
{
[TestClass]
public partial class DelegateHelpersTests
{
}
}
|
using System;
namespace Assemblify.Core
{
[AttributeUsage(AttributeTargets.Assembly)]
public sealed class AssemblifyPublishFolderAttribute : Attribute
{
private string assemblify_folder;
public AssemblifyPublishFolderAttribute(string AssemblifyFolder)
{
assemblify_folder = AssemblifyFolder;
}
public string AssemblifyFolder { get { return assemblify_folder; } }
}
}
|
using System;
using System.Linq;
using DialogSystem.ScriptObject;
using ReadyGamerOne.EditorExtension;
using ReadyGamerOne.Utility;
#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine;
using UnityEngine.Assertions;
namespace DialogSystem.Model
{
[Serializable]
#pragma warning disable 660,661
public class ValueChooser
#pragma warning restore 660,661
{
#pragma warning disable 649
#region Static
#if UNITY_EDITOR
public static int GetArgTypeFromSerializedProperty(SerializedProperty property)
{
var valueTypeProp = property.FindPropertyRelative("valueType");
var argChooserProp = property.FindPropertyRelative("ArgChooser");
SerializedProperty targetProp = null;
switch (valueTypeProp.enumValueIndex)
{
case 0:// Value
targetProp = argChooserProp;
break;
case 1://var
targetProp = property;
break;
}
return targetProp.FindPropertyRelative("argType").intValue;
}
public static string GetShowTextFromSerializedProperty(SerializedProperty property)
{
var argChooserProp = property.FindPropertyRelative("ArgChooser");
switch (property.FindPropertyRelative("valueType").enumValueIndex)
{
case 0://value
return ReadyGamerOne.EditorExtension.ArgChooser.GetShowTextFromSerializedProperty(argChooserProp);
case 1://var
var asset =
property.FindPropertyRelative("abstractAbstractDialogInfoAsset").objectReferenceValue as
AbstractDialogInfoAsset;
if (asset == null)
throw new Exception("asset is null");
var text = asset.GetValueStrings(
(ReadyGamerOne.EditorExtension.ArgType) property.FindPropertyRelative("argType")
.enumValueIndex).Keys.ToArray()[property.FindPropertyRelative("selectedIndex").intValue];
return text;
}
throw new Exception("???");
}
public static ArgType GetArgType(SerializedProperty property)
{
switch (property.FindPropertyRelative("valueType").enumValueIndex)
{
case 0://Value
return (ArgType) (property.FindPropertyRelative("ArgChooser").FindPropertyRelative("argType").enumValueIndex);
case 1://Var
return (ArgType) property.FindPropertyRelative("argType").enumValueIndex;
}
throw new Exception("类型异常");
}
#endif
public static float valueTypeWidth = 0.2f;
public static float argTypeWidth = 0.3f;
#endregion
#region Static
#endregion
public enum ValueType
{
Value,
Var
}
public ValueType valueType;
public AbstractDialogInfoAsset abstractAbstractDialogInfoAsset;
[SerializeField] private ArgChooser ArgChooser;
[SerializeField] private int selectedIndex;
[SerializeField] private ArgType argType;
public ArgType ArgType
{
get
{
if (valueType == ValueType.Value)
return ArgChooser.argType;
return argType;
}
}
public int IntValue
{
get
{
if (valueType == ValueType.Var)
{
try
{
var str= abstractAbstractDialogInfoAsset.GetValueStrings(ArgType.Int).Values.ToArray()[selectedIndex];
return Convert.ToInt32(str);
}
catch (IndexOutOfRangeException)
{
throw new Exception(abstractAbstractDialogInfoAsset.name+" Index:"+selectedIndex);
}
}
return ArgChooser.IntArg;
}
}
public Vector3 Vector3Value
{
get
{
if (valueType == ValueType.Var)
{
try
{
var str= abstractAbstractDialogInfoAsset.GetValueStrings(ArgType.Vector3).Values.ToArray()[selectedIndex];
return ConvertUtil.String2Vector3(str);
}
catch (IndexOutOfRangeException)
{
throw new Exception(abstractAbstractDialogInfoAsset.name+" Index:"+selectedIndex);
}
}
return ArgChooser.Vector3Arg;
}
}
public float FloatValue
{
get
{
if (valueType == ValueType.Var)
{
try
{
var str= abstractAbstractDialogInfoAsset.GetValueStrings(ArgType.Float).Values.ToArray()[selectedIndex];
return Convert.ToSingle(str);
}
catch (IndexOutOfRangeException)
{
throw new Exception(abstractAbstractDialogInfoAsset.name+" Index:"+selectedIndex);
}
}
return ArgChooser.FloatArg;
}
}
public bool BoolValue
{
get
{
if (valueType == ValueType.Var)
{
try
{
var str= abstractAbstractDialogInfoAsset.GetValueStrings(ArgType.Bool).Values.ToArray()[selectedIndex];
return Convert.ToBoolean(str);
}
catch (IndexOutOfRangeException)
{
throw new Exception(abstractAbstractDialogInfoAsset.name+" Index:"+selectedIndex);
}
}
return ArgChooser.BoolArg;
}
}
public string StrValue
{
get
{
if (valueType == ValueType.Var)
{
try
{
var str= abstractAbstractDialogInfoAsset.GetValueStrings(ArgType.String).Values.ToArray()[selectedIndex];
return str;
}
catch (IndexOutOfRangeException)
{
throw new Exception(abstractAbstractDialogInfoAsset.name+" Index:"+selectedIndex);
}
}
return ArgChooser.StringArg;
}
}
#region 运算符重载
public static bool operator ==(ValueChooser a1, ValueChooser a2)
{
Assert.IsTrue(a1.ArgType==a2.ArgType);
switch (a1.ArgType)
{
case ArgType.Bool:
return a1.BoolValue == a2.BoolValue;
case ArgType.Int:
return a1.IntValue == a2.IntValue;
case ArgType.String:
return a1.StrValue == a2.StrValue;
}
throw new Exception("ValueChooser 比较异常");
}
public static bool operator !=(ValueChooser a1, ValueChooser a2)
{
return !(a1 == a2);
}
public static bool operator >(ValueChooser a1, ValueChooser a2)
{
Assert.IsTrue((a1.ArgType==ArgType.Int||a1.ArgType==ArgType.Float
)&&(a2.ArgType==ArgType.Int||a2.ArgType==ArgType.Float
));
switch (a1.ArgType)
{
case ArgType.Float:
return a1.FloatValue > a2.FloatValue;
case ArgType.Int:
return a1.IntValue > a2.IntValue;
}
throw new Exception("ValueChooser 比较异常");
}
public static bool operator <(ValueChooser a1, ValueChooser a2)
{
Assert.IsTrue((a1.ArgType==ArgType.Int||a1.ArgType==ArgType.Float
)&&(a2.ArgType==ArgType.Int||a2.ArgType==ArgType.Float
));
switch (a1.ArgType)
{
case ArgType.Float:
return a1.FloatValue < a2.FloatValue;
case ArgType.Int:
return a1.IntValue < a2.IntValue;
}
throw new Exception("ValueChooser 比较异常");
}
public static bool operator >=(ValueChooser a1, ValueChooser a2)
{
Assert.IsTrue((a1.ArgType==ArgType.Int||a1.ArgType==ArgType.Float
)&&(a2.ArgType==ArgType.Int||a2.ArgType==ArgType.Float
));
switch (a1.ArgType)
{
case ArgType.Float:
return a1.FloatValue >= a2.FloatValue;
case ArgType.Int:
return a1.IntValue >= a2.IntValue;
}
throw new Exception("ValueChooser 比较异常");
}
public static bool operator <=(ValueChooser a1, ValueChooser a2)
{
Assert.IsTrue((a1.ArgType==ArgType.Int||a1.ArgType==ArgType.Float
)&&(a2.ArgType==ArgType.Int||a2.ArgType==ArgType.Float
));
switch (a1.ArgType)
{
case ArgType.Float:
return a1.FloatValue <= a2.FloatValue;
case ArgType.Int:
return a1.IntValue <= a2.IntValue;
}
throw new Exception("ValueChooser 比较异常");
}
#endregion
#pragma warning restore 649
}
} |
using JetBrains.Annotations;
using Platformer.Mechanics;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
public class GameManager : MonoBehaviour
{
public static GameManager instance;
public bool isPaused;
public List<Item> items = new List<Item>();
public List<int> itemNumbers = new List<int>();
public GameObject[] slots;
public List<EquipmentItem> equipmentItems = new List<EquipmentItem>();
public GameObject[] equipmentSlots;
public EquipmentRemoveButton[] equipmentButton;
public Sprite equipmentSprite;
public GameObject playerC;
//public Dictionary<Item, int> itemDict = new Dictionary<Item, int>();
public ItemRemoveButton thisButton;//which item button we are hovering
public ItemRemoveButton[] itemButtons;//all item button in inventory
//list of each equipment helmet = 1, body = 2, pants = 3, boots = 4, sword = 5
public List<EquipmentItem> equipmentHelmets = new List<EquipmentItem>();
public List<EquipmentItem> equipmentChest = new List<EquipmentItem>();
public List<EquipmentItem> equipmentPants = new List<EquipmentItem>();
public List<EquipmentItem> equipmentBoots = new List<EquipmentItem>();
public List<EquipmentItem> equipmentWeapon = new List<EquipmentItem>();
//public List<EquipmentItem> currentEquipmentsUsing = new List<EquipmentItem>();
private void Awake()
{
if(instance == null)
{
instance = this;
}
else
{
if (instance != this)
{
Destroy(gameObject);
}
}
DontDestroyOnLoad(gameObject);
}
public void Start()
{
DisplayItems();
DisplayEquipmentItem();
}
public void DisplayItems()
{
for(int i = 0;i < slots.Length; i++)
{
if(i < items.Count)
{
//set item image
slots[i].transform.GetChild(0).GetComponent<Image>().color = new Color(1, 1, 1, 1);
slots[i].transform.GetChild(0).GetComponent<Image>().sprite = items[i].itemSprite;
//slot count text
slots[i].transform.GetChild(1).GetComponent<Text>().color = new Color(1, 1, 1, 1);
slots[i].transform.GetChild(1).GetComponent<Text>().text = itemNumbers[i].ToString();
//close button
slots[i].transform.GetChild(2).gameObject.SetActive(true);
//use button
slots[i].transform.GetChild(3).gameObject.SetActive(true);
}
else
{
//set item image
slots[i].transform.GetChild(0).GetComponent<Image>().color = new Color(1, 1, 1, 0);
slots[i].transform.GetChild(0).GetComponent<Image>().sprite = null;
//slot count text
slots[i].transform.GetChild(1).GetComponent<Text>().color = new Color(1, 1, 1, 0);
slots[i].transform.GetChild(1).GetComponent<Text>().text = null;
//close button
slots[i].transform.GetChild(2).gameObject.SetActive(false);
//use button
slots[i].transform.GetChild(3).gameObject.SetActive(false);
}
}
}
public void AddItem(Item nItem)
{
//if there is a new item in the inventory
if (!items.Contains(nItem))
{
items.Add(nItem);
itemNumbers.Add(1);
}
else
{
Debug.Log("you already have this items");
for(int i = 0; i < items.Count;i++)
{
if(nItem == items[i])
{
itemNumbers[i]++;
}
}
}
DisplayItems();
}
public bool AddEquipmentItem(EquipmentItem eItem)
{
if (equipmentItems.Contains(eItem))
{
Debug.Log("you already have this equipment item!");
return false;
}
else
{
if (eItem.EquipmentID == 1)
{
equipmentHelmets.Add(eItem);
equipmentItems.Add(eItem);
DisplayEquipmentItem();
return true;
}
else if (eItem.EquipmentID == 2)
{
equipmentChest.Add(eItem);
equipmentItems.Add(eItem);
DisplayEquipmentItem();
return true;
}
else if (eItem.EquipmentID == 3)
{
equipmentPants.Add(eItem);
equipmentItems.Add(eItem);
DisplayEquipmentItem();
return true;
}
else if (eItem.EquipmentID == 4)
{
equipmentBoots.Add(eItem);
equipmentItems.Add(eItem);
DisplayEquipmentItem();
return true;
}
else if (eItem.EquipmentID == 5)
{
equipmentWeapon.Add(eItem);
equipmentItems.Add(eItem);
DisplayEquipmentItem();
return true;
}
else
{
Debug.Log("this IDEquipment is not allowed");
return false;
}
}
}
public void DisplayEquipmentItem()
{
for (int i = 0; i < equipmentSlots.Length; i++)
{
if (i < equipmentItems.Count)
{
// equipmentSlots[i].transform.GetChild(0).GetComponent<Image>().color = new Color(1, 1, 1, 1);
// equipmentSlots[i].transform.GetChild(0).GetComponent<Image>().sprite = equipmentItems[i].itemSprite;
equipmentSlots[i].transform.GetChild(1).gameObject.SetActive(true);
equipmentSlots[i].transform.GetChild(2).GetComponent<Button>().image.sprite = equipmentItems[i].itemSprite;
if (equipmentItems[i].eUsing)
{
equipmentSlots[i].transform.GetChild(2).GetComponent<Button>().enabled = false;
equipmentSlots[i].transform.GetChild(2).transform.GetChild(0).GetComponent<Text>().color = new Color(1, 1, 1, 1);
equipmentSlots[i].transform.GetChild(2).transform.GetChild(0).GetComponent<Text>().text = equipmentItems[i].eItemUsedByCharacter;
}
else
{
equipmentSlots[i].transform.GetChild(2).GetComponent<Button>().enabled = true;
equipmentSlots[i].transform.GetChild(2).transform.GetChild(0).GetComponent<Text>().text = " ";
}
/* if (equipmentItems[i].eUsing)
{
equipmentSlots[i].transform.GetChild(2).transform.GetChild(0).GetComponent<Text>().text = playerC.GetComponent<CharacterSwapping>().currentCharacter.GetComponent<Character>().characterName;
equipmentSlots[i].transform.GetChild(2).transform.GetChild(0).GetComponent<Text>().color = new Color(1, 1, 1, 1);
}*/
}
else
{
equipmentSlots[i].transform.GetChild(0).GetComponent<Image>().color = new Color(1, 1, 1, 0);
equipmentSlots[i].transform.GetChild(0).GetComponent<Image>().sprite = null;
equipmentSlots[i].transform.GetChild(1).gameObject.SetActive(false);
equipmentSlots[i].transform.GetChild(2).GetComponent<Button>().image.sprite = equipmentSprite;
equipmentSlots[i].transform.GetChild(2).GetComponent<Button>().enabled = false;
equipmentSlots[i].transform.GetChild(2).transform.GetChild(0).GetComponent<Text>().text = " ";
}
}
}
public void RemoveEquipmentItem(EquipmentItem eitem)
{
//remove text "using" here
//equipmentSlots[eitem.EquipmentID].transform.GetChild(2).GetComponent<Text>().color = new Color(1, 1, 1, 0);
equipmentItems.Remove(eitem);
RemovingEquipmentItemFromOtherCharacter(eitem);
ResetButtonEquipmentItems();
DisplayEquipmentItem();
}
public void RemovingEquipmentItemFromOtherCharacter(EquipmentItem rEitem)
{
if (playerC.GetComponent<CharacterSwapping>().character1.GetComponent<PlayerController>().playerCurrentEitems.Contains(rEitem))
{
if (rEitem.EquipmentID == 5)
{
if (rEitem.bullet1 == true)
{
playerC.GetComponent<CharacterSwapping>().character1.GetComponent<PlayerDetectShoot>().bulletShootDamage1 = playerC.GetComponent<CharacterSwapping>().character1.GetComponent<PlayerDetectShoot>().bulletShootDamage1 - rEitem.value;
playerC.GetComponent<CharacterSwapping>().character1.GetComponent<PlayerDetectShoot>().bulletShoot1 = null;
playerC.GetComponent<CharacterSwapping>().character1.GetComponent<PlayerController>().playerCurrentEitems.Remove(rEitem);
}
else if (rEitem.bullet1 == false && rEitem.bullet2 == true)
{
playerC.GetComponent<CharacterSwapping>().character1.GetComponent<PlayerDetectShoot>().bulletShootDamage2 = playerC.GetComponent<CharacterSwapping>().character1.GetComponent<PlayerDetectShoot>().bulletShootDamage2 - rEitem.value;
playerC.GetComponent<CharacterSwapping>().character1.GetComponent<PlayerDetectShoot>().bulletShoot2 = null;
playerC.GetComponent<CharacterSwapping>().character1.GetComponent<PlayerController>().playerCurrentEitems.Remove(rEitem);
}
}
else
{
playerC.GetComponent<CharacterSwapping>().character1.GetComponent<PlayerController>().setMaxHealth(playerC.GetComponent<CharacterSwapping>().character1.GetComponent<PlayerController>().health.maxHP - rEitem.value);
playerC.GetComponent<CharacterSwapping>().character1.GetComponent<PlayerController>().playerCurrentEitems.Remove(rEitem);
}
}
else if (playerC.GetComponent<CharacterSwapping>().character2.GetComponent<PlayerController>().playerCurrentEitems.Contains(rEitem))
{
if (rEitem.EquipmentID == 5)
{
if (rEitem.bullet1 == true)
{
playerC.GetComponent<CharacterSwapping>().character2.GetComponent<PlayerDetectShoot>().bulletShootDamage1 = playerC.GetComponent<CharacterSwapping>().character2.GetComponent<PlayerDetectShoot>().bulletShootDamage1 - rEitem.value;
playerC.GetComponent<CharacterSwapping>().character2.GetComponent<PlayerDetectShoot>().bulletShoot1 = null;
playerC.GetComponent<CharacterSwapping>().character2.GetComponent<PlayerController>().playerCurrentEitems.Remove(rEitem);
}
else if (rEitem.bullet1 == false && rEitem.bullet2 == true)
{
playerC.GetComponent<CharacterSwapping>().character2.GetComponent<PlayerDetectShoot>().bulletShootDamage2 = playerC.GetComponent<CharacterSwapping>().character2.GetComponent<PlayerDetectShoot>().bulletShootDamage2 - rEitem.value;
playerC.GetComponent<CharacterSwapping>().character2.GetComponent<PlayerDetectShoot>().bulletShoot2 = null;
playerC.GetComponent<CharacterSwapping>().character2.GetComponent<PlayerController>().playerCurrentEitems.Remove(rEitem);
}
}
else {
playerC.GetComponent<CharacterSwapping>().character2.GetComponent<PlayerController>().setMaxHealth(playerC.GetComponent<CharacterSwapping>().character2.GetComponent<PlayerController>().health.maxHP - rEitem.value);
playerC.GetComponent<CharacterSwapping>().character2.GetComponent<PlayerController>().playerCurrentEitems.Remove(rEitem);
}
}
else if (playerC.GetComponent<CharacterSwapping>().character3.GetComponent<PlayerController>().playerCurrentEitems.Contains(rEitem))
{
if (rEitem.EquipmentID == 5)
{
if (rEitem.bullet1 == true)
{
playerC.GetComponent<CharacterSwapping>().character3.GetComponent<PlayerDetectShoot>().bulletShootDamage1 = playerC.GetComponent<CharacterSwapping>().character3.GetComponent<PlayerDetectShoot>().bulletShootDamage1 - rEitem.value;
playerC.GetComponent<CharacterSwapping>().character3.GetComponent<PlayerDetectShoot>().bulletShoot1 = null;
playerC.GetComponent<CharacterSwapping>().character3.GetComponent<PlayerController>().playerCurrentEitems.Remove(rEitem);
}
else if (rEitem.bullet1 == false && rEitem.bullet2 == true)
{
playerC.GetComponent<CharacterSwapping>().character3.GetComponent<PlayerDetectShoot>().bulletShootDamage2 = playerC.GetComponent<CharacterSwapping>().character3.GetComponent<PlayerDetectShoot>().bulletShootDamage2 - rEitem.value;
playerC.GetComponent<CharacterSwapping>().character3.GetComponent<PlayerDetectShoot>().bulletShoot2 = null;
playerC.GetComponent<CharacterSwapping>().character3.GetComponent<PlayerController>().playerCurrentEitems.Remove(rEitem);
}
}
else {
playerC.GetComponent<CharacterSwapping>().character3.GetComponent<PlayerController>().setMaxHealth(playerC.GetComponent<CharacterSwapping>().character3.GetComponent<PlayerController>().health.maxHP - rEitem.value);
playerC.GetComponent<CharacterSwapping>().character3.GetComponent<PlayerController>().playerCurrentEitems.Remove(rEitem);
}
}
else if (playerC.GetComponent<CharacterSwapping>().character4.GetComponent<PlayerController>().playerCurrentEitems.Contains(rEitem))
{
if (rEitem.EquipmentID == 5)
{
if (rEitem.bullet1 == true)
{
playerC.GetComponent<CharacterSwapping>().character4.GetComponent<PlayerDetectShoot>().bulletShootDamage1 = playerC.GetComponent<CharacterSwapping>().character4.GetComponent<PlayerDetectShoot>().bulletShootDamage1 - rEitem.value;
playerC.GetComponent<CharacterSwapping>().character4.GetComponent<PlayerDetectShoot>().bulletShoot1 = null;
playerC.GetComponent<CharacterSwapping>().character4.GetComponent<PlayerController>().playerCurrentEitems.Remove(rEitem);
}
else if (rEitem.bullet1 == false && rEitem.bullet2 == true)
{
playerC.GetComponent<CharacterSwapping>().character4.GetComponent<PlayerDetectShoot>().bulletShootDamage2 = playerC.GetComponent<CharacterSwapping>().character4.GetComponent<PlayerDetectShoot>().bulletShootDamage2 - rEitem.value;
playerC.GetComponent<CharacterSwapping>().character4.GetComponent<PlayerDetectShoot>().bulletShoot2 = null;
playerC.GetComponent<CharacterSwapping>().character4.GetComponent<PlayerController>().playerCurrentEitems.Remove(rEitem);
}
}
else {
playerC.GetComponent<CharacterSwapping>().character4.GetComponent<PlayerController>().setMaxHealth(playerC.GetComponent<CharacterSwapping>().character4.GetComponent<PlayerController>().health.maxHP - rEitem.value);
playerC.GetComponent<CharacterSwapping>().character4.GetComponent<PlayerController>().playerCurrentEitems.Remove(rEitem);
}
}
}
public void ResetButtonEquipmentItems()
{
for (int i = 0; i < equipmentButton.Length; i++ )
{
if (i < equipmentItems.Count)
{
equipmentButton[i].equipItem = equipmentItems[i];
}
else
{
equipmentButton[i].equipItem = null;
}
}
}
public void RemoveItem(Item nitem)
{
if (items.Contains(nitem))
{
for(int i = 0; i < items.Count; i++)
{
if(nitem == items[i])
{
itemNumbers[i]--;
if(itemNumbers[i] == 0)
{
items.Remove(nitem);
itemNumbers.Remove(itemNumbers[i]);
}
}
}
}
else
{
Debug.Log("there is no" + nitem + "in the inventory");
}
ResetButtonItems();
DisplayItems();
}
public void ResetButtonItems()
{
for(int i = 0; i < itemButtons.Length; i++)//loop all buttons (16 in this case)
{
if (i < items.Count)
{
itemButtons[i].thisItem = items[i];//once this btton contains the item, assign the item to thisitem
}
else
{
itemButtons[i].thisItem = null;//otherwise set the thisitem to null
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CL_UWP.SpeechClasses
{
public static class PhRTiming
{
private static TimeSpan tsElapsed;
public static TimeSpan TsElapsed
{
get { return tsElapsed; }
set { tsElapsed = value; }
}
}
}
|
namespace Simple4X {
public enum Tile {
Undefined, // Special value for catching morons (like me)
Empty,
Buildings,
Influence
}
} |
using System.Collections.Immutable;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
namespace Meziantou.Analyzer.Rules;
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public sealed class JSInvokableMethodsMustBePublicAnalyzer : DiagnosticAnalyzer
{
private static readonly DiagnosticDescriptor s_rule = new(
RuleIdentifiers.JSInvokableMethodsMustBePublic,
title: "[JSInvokable] methods must be public",
messageFormat: "[JSInvokable] methods must be public",
RuleCategories.Design,
DiagnosticSeverity.Warning,
isEnabledByDefault: true,
description: "",
helpLinkUri: RuleIdentifiers.GetHelpUri(RuleIdentifiers.JSInvokableMethodsMustBePublic));
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(s_rule);
public override void Initialize(AnalysisContext context)
{
context.EnableConcurrentExecution();
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics);
context.RegisterCompilationStartAction(ctx =>
{
var analyzerContext = new AnalyzerContext(ctx.Compilation);
if (analyzerContext.IsValid)
{
ctx.RegisterSymbolAction(analyzerContext.AnalyzeMethod, SymbolKind.Method);
}
});
}
private sealed class AnalyzerContext
{
public AnalyzerContext(Compilation compilation)
{
JsInvokableSymbol = compilation.GetBestTypeByMetadataName("Microsoft.JSInterop.JSInvokableAttribute");
}
public INamedTypeSymbol? JsInvokableSymbol { get; }
public bool IsValid => JsInvokableSymbol != null;
internal void AnalyzeMethod(SymbolAnalysisContext context)
{
var method = (IMethodSymbol)context.Symbol;
if (method.DeclaredAccessibility != Accessibility.Public && method.HasAttribute(JsInvokableSymbol, inherits: false))
{
context.ReportDiagnostic(s_rule, method);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using E_Commerce.Models.DataModel;
using E_Commerce.CF;
using E_Commerce.Models.Helper;
namespace E_Commerce.Controllers
{
public class AdminController : Controller
{
Context _db = Connection.Connect();
public bool AuthorityCheck()
{
if ((string)Session["Authority"] != "Admin" && (string)Session["Authority"] != "Master")
{
return true;
}
return false;
}
// GET: Admin
public ActionResult Index()
{
if (AuthorityCheck())
{
return RedirectToAction("Index", "Home");
}
return View();
}
public ActionResult Settings()
{
if (AuthorityCheck())
{
return RedirectToAction("Index", "Home");
}
return View();
}
public ActionResult ChangeNameSurname()
{
if (AuthorityCheck())
{
return RedirectToAction("Index", "Home");
}
int ID = Convert.ToInt32(Session["UserID"]);
UserNameSurname ToEdit = Converter.ToUserNameSurname(_db.Users.Where(x => x.BaseUserID == ID).Select(x => new { x.Name, x.Surname }).FirstOrDefault());
return View(ToEdit);
}
[HttpPost]
public ActionResult ChangeNameSurname(FormCollection frm)
{
int ViewID = Convert.ToInt32(Session["UserID"]);
string ViewName = frm.Get("Name");
string ViewSurname = frm.Get("Surname");
BaseUser ToEdit = _db.Users.FirstOrDefault(x => x.BaseUserID == ViewID);
ToEdit.Name = ViewName;
ToEdit.Surname = ViewSurname;
if (_db.SaveChanges() > 0)
{
Session["AdiSoyadi"] = ToEdit.Name + " " + ToEdit.Surname;
}
return RedirectToAction("SuccessPage", "Admin");
}
public ActionResult ChangePassword()
{
UserPassword ToEdit = new UserPassword();
return View(ToEdit);
}
[HttpPost]
public ActionResult ChangePassword(FormCollection frm)
{
int UserID = Convert.ToInt32(Session["UserID"]);
string ViewOldPassword = frm.Get("OldPassword");
var Query = _db.Users.Where(x => x.BaseUserID == UserID && x.Password == ViewOldPassword);
if (Query.Count()>0)
{
string ViewNewPassword = frm.Get("NewPassword");
string ViewNewPasswordAgain = frm.Get("NewPasswordAgain");
if (ViewNewPassword==ViewNewPasswordAgain)
{
BaseUser ToEdit = _db.Users.FirstOrDefault(x => x.BaseUserID == UserID);
ToEdit.Password = ViewNewPassword;
if (_db.SaveChanges()>0)
{
return RedirectToAction("SuccessPage", "Admin");
}
else
{
ViewBag.Mesaj = "Eski Şifreniz İle Yeni Şifreniz Aynı Olmamalı";
}
}
else
{
ViewBag.Mesaj = "Yeni Şifreleriniz Uyuşmuyor";
}
}
else
{
ViewBag.Mesaj = "Eski Şifreniz Hatalı";
}
return View();
}
public ActionResult SuccessPage()
{
return View();
}
}
} |
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace LuizalabsWishesManager.ViewModels
{
public class NewWishViewModel
{
public int IdProduct { get; set; }
}
public class WishViewModel
{
public List<ProductViewModel> Products { get; set; }
}
}
|
using System;
using CoffeeFinder.iOS;
using Foundation;
using UIKit;
using Xamarin.Forms;
[assembly: Dependency(typeof(PhoneCall_iOS))]
namespace CoffeeFinder.iOS
{
public class PhoneCall_iOS : IPhoneCall
{
public void MakeQuickCall(string PhoneNumber)
{
try
{
UIApplication.SharedApplication.OpenUrl(
new NSUrl("tel:" + PhoneNumber));
}
catch (Exception e)
{
}
}
}
}
|
using System;
using System.ComponentModel.DataAnnotations;
namespace FoodDelivery.Models
{
public class User
{
public int Id { get; set; }
[Required]
[StringLength(25, ErrorMessage = "Login is too long.")]
public string Login { get; set; }
[Required]
[StringLength(25, ErrorMessage = "Password is too long.")]
public string Password { get; set; }
}
}
|
using LuaInterface;
using SLua;
using System;
public class Lua_UnityEngine_NavMeshPathStatus : LuaObject
{
public static void reg(IntPtr l)
{
LuaObject.getEnumTable(l, "UnityEngine.NavMeshPathStatus");
LuaObject.addMember(l, 0, "PathComplete");
LuaObject.addMember(l, 1, "PathPartial");
LuaObject.addMember(l, 2, "PathInvalid");
LuaDLL.lua_pop(l, 1);
}
}
|
using System;
using System.Collections.Generic;
/*using System.Linq;
using System.Text;
using System.Threading.Tasks;*/
using System.Windows;
using System.Windows.Forms;
/*using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;*/
using TopologicalSorting;
using Microsoft.Glee.Drawing;
namespace Tubes02Stima
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
List<DAG> listOfDAG = new List<DAG>();
List<MataKuliah> dataMatkul = new List<MataKuliah>();
List<DAG> dfsResult = new List<DAG>();
List<DAG> bfsResult = new List<DAG>();
public MainWindow()
{
InitializeComponent();
}
private void btnOperate_Click(object sender, RoutedEventArgs e)
{
//Mengambil nama file eksternal dari txtBoxFileName
string fileName = txtBoxFileName.Text;
//Mengosongkan textBox hasil BFS dan DFS
txtDFSResult.Clear();
txtBFSResult.Clear();
//==========================INISIALISASI OBJEK2 DAN VARIABEL2 UNTUK VISUALISASI==========================
Form form = new Form();
form.ClientSize = new System.Drawing.Size(1000, 768);
//Buat objek-viewer
Microsoft.Glee.GraphViewerGdi.GViewer viewer = new Microsoft.Glee.GraphViewerGdi.GViewer();
//Buat objek-graph
Microsoft.Glee.Drawing.Graph graph = new Microsoft.Glee.Drawing.Graph("graph");
string nodeName, childNodeName;
//==========================BACA INPUT DARI FILE EKSTERNAL==========================
TopologicalSorting.Main.MakeDAGFromFile(ref listOfDAG, ref dataMatkul, fileName);
/*Console.WriteLine("listOfDAG :");
TopologicalSorting.Main.PrintListOfDAG(listOfDAG);
Console.WriteLine();*/
//==========================DFS==========================
TopologicalSorting.Main.DFS(listOfDAG, ref dfsResult);
//Console.WriteLine("\nDFS Result : ");
//TopologicalSorting.Main.PrintListOfDAG(dfsResult);
//Cetak hasil DFS ke textbox
foreach (var dag in dfsResult)
{
txtDFSResult.Text += dag.GetEnumerator() + "/" + dag.GetDenumerator() + ". " + dag.GetNode() + "\n";
}
//Buat graph-nya
graph.AddNode("StartDFS");
graph.FindNode("StartDFS").Attr.Fillcolor = Microsoft.Glee.Drawing.Color.LightGray;
foreach (var dag in dfsResult)
{
nodeName = dag.GetEnumerator() + "/" + dag.GetDenumerator() + ". " + dag.GetNode();
//Warnai semua matakuliah(simpul) pada diagram BFS dengan warna orchid
graph.AddNode(nodeName).Attr.Fillcolor = Microsoft.Glee.Drawing.Color.Orchid;
foreach (var child in dag.GetListOfChildren())
{
childNodeName = child.GetEnumerator() + "/" + child.GetDenumerator() + ". " + child.GetNode();
graph.AddEdge(nodeName, childNodeName);
}
if (dag.GetNParents() == 0)
{
graph.AddEdge("StartDFS", nodeName);
}
}
//==========================BFS==========================
TopologicalSorting.Main.BFS(listOfDAG, ref bfsResult);
//Console.WriteLine("\nBFS Result : ");
//TopologicalSorting.Main.PrintListOfDAG(bfsResult);
//Cetak hasil BFS ke textbox
int sem = 1;
foreach (var dag in bfsResult)
{
if(dag.GetSemester() == sem)
{
txtBFSResult.Text += "Semester " + dag.GetSemester() + ":\n";
sem++;
}
txtBFSResult.Text += dag.GetEnumerator() + ". " + dag.GetNode() + "\n";
}
//Buat graph-nya
graph.AddNode("StartBFS");
graph.FindNode("StartBFS").Attr.Fillcolor = Microsoft.Glee.Drawing.Color.LightGray;
foreach (var dag in bfsResult)
{
nodeName = dag.GetEnumerator() + ". " + dag.GetNode();
graph.AddNode(nodeName);
Microsoft.Glee.Drawing.Node tNode;
foreach (var child in dag.GetListOfChildren())
{
childNodeName = child.GetEnumerator() + ". " + child.GetNode();
graph.AddEdge(nodeName, childNodeName);
tNode = graph.FindNode(childNodeName);
//Warnai matakuliah(simpul) dengan 1 warna per semester
switch (child.GetSemester() % 6)
{
case 0:
tNode.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.LightSkyBlue;
break;
case 1:
tNode.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.Orange;
break;
case 2:
tNode.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.PaleVioletRed;
break;
case 3:
tNode.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.LightGreen;
break;
case 4:
tNode.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.Yellow;
break;
case 5:
tNode.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.MediumPurple;
break;
}
}
if (dag.GetNParents() == 0)
{
graph.AddEdge("StartBFS", nodeName);
}
}
//==========================VISUALISASI==========================
//Hubungkan graph dengan viewernya
viewer.Graph = graph;
//Hubungkan viewer dengan formnya
form.SuspendLayout();
viewer.Dock = DockStyle.Fill;
form.Controls.Add(viewer);
form.ResumeLayout();
//Tampilkan formnya
form.ShowDialog();
}
}
}
|
using System.Web.Mvc;
using System.Web.Routing;
namespace SimpleMvcSitemap.Sample.App_Start
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute("sitemapcategories", "sitemapcategories",
new { controller = "Home", action = "Categories", id = UrlParameter.Optional }
);
routes.MapRoute("sitemapbrands", "sitemapbrands",
new { controller = "Home", action = "Brands", id = UrlParameter.Optional }
);
routes.MapRoute("Default", "{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
} |
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Transaction.Entity;
namespace Transaction.Service
{
public interface ITransaction
{
Task GetTransactionType(string transtype);
Task<object> GetTransBypersonID(Guid personID);
Task<object> AddTransaction(Transactions transactions);
Task<object> GetTransaction();
}
}
|
using App.Utilities.Access;
using App.Utilities.Controls;
using App.Entity;
using App.Entity.AttibutesProperty;
using App.Logic;
using App.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace App.Gym.Forms
{
/// <seealso cref="App.Utilities.Access.FormMaster" />
public partial class FormCompany : FormMaster
{
/// <summary>
/// The logic
/// </summary>
private CompanyLC Logic = new CompanyLC();
/// <summary>
/// The entity
/// </summary>
public CompanyBE Company = new CompanyBE();
/// <summary>
/// The is correct
/// </summary>
private bool IsCorrect = true;
/// <summary>
/// The list configuration
/// </summary>
private List<ConfigurationAttributes> lstConfiguration = new List<ConfigurationAttributes>();
/// <summary>
/// Initializes a new instance of the <see cref="FormRol"/> class.
/// </summary>
public FormCompany()
{
InitializeComponent();
Text = "Empresa";
}
/// <summary>
/// Loads the control values.
/// </summary>
/// <param name="company">The Company be.</param>
public void LoadControlValues(CompanyBE company)
{
lstConfiguration = company.GetConfiguration();
IDText.ConfigurationAttributes = lstConfiguration.First(c => c.PropertyName == "ID");
NameText.ConfigurationAttributes = lstConfiguration.First(c => c.PropertyName == "Name");
NameText.TextChange += Control_TextChanged;
IDText.TextChange += Control_TextChanged;
bool insert = company.ID == 0;
BtnUpdate.Visible = !insert;
BtnDelete.Visible = !insert;
BtnSearch.Visible = insert;
BtnInsert.Visible = insert;
}
/// <summary>
/// Handles the TextChanged event of the Control control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
public void Control_TextChanged(object sender, EventArgs e)
{
IsCorrect = true;
foreach (var control in Controls)
{
if (control.GetType() == typeof(TextControl))
IsCorrect = IsCorrect && ((TextControl)control).ValueCorrect;
}
BtnInsert.Enabled = IsCorrect;
if (IsCorrect)
{
Company = new CompanyBE();
Company.ID = Convert.ToInt32(IDText.TextSelected);
Company.Name = NameText.TextSelected;
}
}
/// <summary>
/// Handles the Click event of the BtnInsert control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void BtnInsert_Click(object sender, EventArgs e)
{
if (IsCorrect && Company != null)
{
Logic.Insert(Company);
IDText.TextSelected = Logic.Select(string.Format("Name = '{0}' AND ID = (SELECT MAX(ID) FROM Company)", Company.Name)).ID.ToString();
BtnUpdate.Enabled = true;
BtnDelete.Enabled = true;
}
}
/// <summary>
/// Handles the Click event of the BtnUpdate control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void BtnUpdate_Click(object sender, EventArgs e)
{
if (IsCorrect && Company != null)
{
Logic.Update(
string.Format("Name = '{0}'", Company.Name),
string.Format("ID = {0}", Company.ID));
Company = Logic.Select(
string.Format("Name LIKE '%{0}%'",
NameText.TextSelected));
}
}
/// <summary>
/// Handles the Click event of the BtnDelete control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void BtnDelete_Click(object sender, EventArgs e)
{
if (IsCorrect && Company != null && MessageCustom.Show("¿Esta seguro de eliminar este registro ?", MessageType.Question) == DialogResult.Yes)
{
Logic.Delete(string.Format("ID = '{0}'", Company.ID));
Close();
}
}
/// <summary>
/// Handles the Click event of the BtnCancel control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void BtnCancel_Click(object sender, EventArgs e)
{
if (MessageCustom.Show("¿Esta seguro de salir sin guardar cambios?", MessageType.Question) == DialogResult.Yes)
Close();
}
/// <summary>
/// Handles the Click event of the BtnSearch control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void BtnSearch_Click(object sender, EventArgs e)
{
Company = Logic.Select(
string.Format("Name LIKE '%{0}%'",
NameText.TextSelected));
if (Company == null)
MessageCustom.Show("No existen registros.", MessageType.Information);
else
{
LoadControlValues(Company);
BtnUpdate.Enabled = true;
BtnDelete.Enabled = true;
}
}
/// <summary>
/// Handles the Load event of the FormRol control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void FormCompany_Load(object sender, EventArgs e)
{
LoadControlValues(Company);
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TileColor : MonoBehaviour {
public float time; // drutuion color change time
public Color[] colors;
public Material mat; // Ground Material
public Color startColor;// default tile color
Color myColor;
Camera cam;
public int neededScore; // this score we need reach to change tils color
void Start()
{
mat.color = startColor;
cam = GetComponent<Camera> ();
myColor = mat.color;
cam = GetComponent<Camera> ();
}
void Update()
{
if(GameManager.GM.Score >= neededScore )
{
ChangeColor ();
}
}
void ChangeColor()
{
myColor = mat.color;
int index = Random.Range (0, colors.Length);
StartCoroutine (ChangeColors (myColor, colors [index], time));
}
IEnumerator ChangeColors(Color source, Color target, float overTime)
{
neededScore = neededScore + 50;
float startTime = Time.time;
while(Time.time < startTime + overTime)
{
mat.color = Color.Lerp(source, target, (Time.time - startTime)/overTime);
yield return null;
}
mat.color = target;
}
}
|
//------------------------------------------------------------------------------
// The contents of this file are subject to the nopCommerce Public License Version 1.0 ("License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at http://www.nopCommerce.com/License.aspx.
//
// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
// See the License for the specific language governing rights and limitations under the License.
//
// The Original Code is nopCommerce.
// The Initial Developer of the Original Code is NopSolutions.
// All Rights Reserved.
//
// Contributor(s): _______.
//------------------------------------------------------------------------------
using System;
using System.Collections.Specialized;
using System.Configuration.Provider;
using System.Data;
using System.Data.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;
namespace NopSolutions.NopCommerce.DataAccess.Shipping
{
/// <summary>
/// Shipping method provider for SQL Server
/// </summary>
public partial class SQLShippingMethodProvider : DBShippingMethodProvider
{
#region Fields
private string _sqlConnectionString;
#endregion
#region Utilities
private DBShippingMethod GetShippingMethodFromReader(IDataReader dataReader)
{
DBShippingMethod shippingMethod = new DBShippingMethod();
shippingMethod.ShippingMethodID = NopSqlDataHelper.GetInt(dataReader, "ShippingMethodID");
shippingMethod.Name = NopSqlDataHelper.GetString(dataReader, "Name");
shippingMethod.Description = NopSqlDataHelper.GetString(dataReader, "Description");
shippingMethod.DisplayOrder = NopSqlDataHelper.GetInt(dataReader, "DisplayOrder");
return shippingMethod;
}
#endregion
#region Methods
/// <summary>
/// Initializes the provider with the property values specified in the application's configuration file. This method is not intended to be used directly from your code
/// </summary>
/// <param name="name">The name of the provider instance to initialize</param>
/// <param name="config">A NameValueCollection that contains the names and values of configuration options for the provider.</param>
public override void Initialize(string name, NameValueCollection config)
{
if (config == null)
{
throw new ArgumentNullException("config");
}
base.Initialize(name, config);
string connectionStringName = config["connectionStringName"];
if (String.IsNullOrEmpty(connectionStringName))
throw new ProviderException("Connection name not specified");
this._sqlConnectionString = NopSqlDataHelper.GetConnectionString(connectionStringName);
if ((this._sqlConnectionString == null) || (this._sqlConnectionString.Length < 1))
{
throw new ProviderException(string.Format("Connection string not found. {0}", connectionStringName));
}
config.Remove("connectionStringName");
if (config.Count > 0)
{
string key = config.GetKey(0);
if (!string.IsNullOrEmpty(key))
{
throw new ProviderException(string.Format("Provider unrecognized attribute. {0}", new object[] { key }));
}
}
}
/// <summary>
/// Deletes a shipping method
/// </summary>
/// <param name="ShippingMethodID">The shipping method identifier</param>
public override void DeleteShippingMethod(int ShippingMethodID)
{
Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
DbCommand dbCommand = db.GetStoredProcCommand("Nop_ShippingMethodDelete");
db.AddInParameter(dbCommand, "ShippingMethodID", DbType.Int32, ShippingMethodID);
int retValue = db.ExecuteNonQuery(dbCommand);
}
/// <summary>
/// Gets a shipping method
/// </summary>
/// <param name="ShippingMethodID">The shipping method identifier</param>
/// <returns>Shipping method</returns>
public override DBShippingMethod GetShippingMethodByID(int ShippingMethodID)
{
DBShippingMethod shippingMethod = null;
if (ShippingMethodID == 0)
return shippingMethod;
Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
DbCommand dbCommand = db.GetStoredProcCommand("Nop_ShippingMethodLoadByPrimaryKey");
db.AddInParameter(dbCommand, "ShippingMethodID", DbType.Int32, ShippingMethodID);
using (IDataReader dataReader = db.ExecuteReader(dbCommand))
{
if (dataReader.Read())
{
shippingMethod = GetShippingMethodFromReader(dataReader);
}
}
return shippingMethod;
}
/// <summary>
/// Gets all shipping methods
/// </summary>
/// <returns>Shipping method collection</returns>
public override DBShippingMethodCollection GetAllShippingMethods()
{
DBShippingMethodCollection shippingMethodCollection = new DBShippingMethodCollection();
Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
DbCommand dbCommand = db.GetStoredProcCommand("Nop_ShippingMethodLoadAll");
using (IDataReader dataReader = db.ExecuteReader(dbCommand))
{
while (dataReader.Read())
{
DBShippingMethod shippingMethod = GetShippingMethodFromReader(dataReader);
shippingMethodCollection.Add(shippingMethod);
}
}
return shippingMethodCollection;
}
/// <summary>
/// Inserts a shipping method
/// </summary>
/// <param name="Name">The name</param>
/// <param name="Description">The description</param>
/// <param name="DisplayOrder">The display order</param>
/// <returns>Shipping method</returns>
public override DBShippingMethod InsertShippingMethod(string Name, string Description, int DisplayOrder)
{
DBShippingMethod shippingMethod = null;
Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
DbCommand dbCommand = db.GetStoredProcCommand("Nop_ShippingMethodInsert");
db.AddOutParameter(dbCommand, "ShippingMethodID", DbType.Int32, 0);
db.AddInParameter(dbCommand, "Name", DbType.String, Name);
db.AddInParameter(dbCommand, "Description", DbType.String, Description);
db.AddInParameter(dbCommand, "DisplayOrder", DbType.Int32, DisplayOrder);
if (db.ExecuteNonQuery(dbCommand) > 0)
{
int ShippingMethodID = Convert.ToInt32(db.GetParameterValue(dbCommand, "@ShippingMethodID"));
shippingMethod = GetShippingMethodByID(ShippingMethodID);
}
return shippingMethod;
}
/// <summary>
/// Updates the shipping method
/// </summary>
/// <param name="ShippingMethodID">The shipping method identifier</param>
/// <param name="Name">The name</param>
/// <param name="Description">The description</param>
/// <param name="DisplayOrder">The display order</param>
/// <returns>Shipping method</returns>
public override DBShippingMethod UpdateShippingMethod(int ShippingMethodID, string Name, string Description,
int DisplayOrder)
{
DBShippingMethod shippingMethod = null;
Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
DbCommand dbCommand = db.GetStoredProcCommand("Nop_ShippingMethodUpdate");
db.AddInParameter(dbCommand, "ShippingMethodID", DbType.Int32, ShippingMethodID);
db.AddInParameter(dbCommand, "Name", DbType.String, Name);
db.AddInParameter(dbCommand, "Description", DbType.String, Description);
db.AddInParameter(dbCommand, "DisplayOrder", DbType.Int32, DisplayOrder);
if (db.ExecuteNonQuery(dbCommand) > 0)
shippingMethod = GetShippingMethodByID(ShippingMethodID);
return shippingMethod;
}
#endregion
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerData : MonoBehaviour
{
public static Vector2 pos = new Vector2(-8.59f, -1.08f);
public static int score;
} |
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Runtime.Serialization.Formatters.Binary;
using MasterSlaveController;
namespace TrafficSimulator
{
class Program
{
static void Main(string[] args)
{
ConcurrentQueue<Process> cq = new ConcurrentQueue<Process>();
TcpListener server = null;
try
{
// Set the TcpListener on port 13000.
Int32 port = 11000;
IPAddress localAddr = IPAddress.IPv6Any;
// TcpListener server = new TcpListener(port);
server = new TcpListener(localAddr, port);
// Start listening for client requests.
server.Start();
// Buffer for reading data
Byte[] bytes = new Byte[256];
// Enter the listening loop.
while (true)
{
Console.Write("Waiting for a connection... ");
// Perform a blocking call to accept requests.
// You could also user server.AcceptSocket() here.
TcpClient client = server.AcceptTcpClient();
IPEndPoint localEndPoint = (IPEndPoint)client.Client.RemoteEndPoint;
IPHostEntry hostEntry = Dns.GetHostEntry(localEndPoint.Address);
Console.WriteLine("Connected from {0}!", hostEntry.HostName);
CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
// Get a stream object for reading and writing
//NetworkStream stream = client.GetStream();
while (true)
{
try
{
BinaryFormatter binaryFormatter = new BinaryFormatter();
Message msg = (Message)binaryFormatter.Deserialize(client.GetStream());
if (msg.Type == MessageType.DB)
{
List<string> dblist = (List<string>)DecerializeMessage(msg);
foreach (string db in dblist)
{
Console.WriteLine(db);
}
NewConnectionsToDBs(cq, dblist, cancellationTokenSource);
}
else if (msg.Type == MessageType.operation)
{
string command = (string)DecerializeMessage(msg);
Console.WriteLine("Receive command: {0}", command);
}
else if (msg.Type == MessageType.Info)
{
break;
}
}
catch (System.IO.IOException e)
{
Console.WriteLine("Another side close the socket forcely");
client.Close();
}
}
//int i;
//// Loop to receive all the data sent by the client.
//while ((i = stream.Read(bytes, 0, bytes.Length)) != 0)
//{
// // Translate data bytes to a ASCII string.
// data = System.Text.Encoding.ASCII.GetString(bytes, 0, i);
// Console.WriteLine("Received: {0}", data);
// // Process the data sent by the client.
// data = data.ToUpper();
// byte[] msg = System.Text.Encoding.ASCII.GetBytes(data);
// // Send back a response.
// stream.Write(msg, 0, msg.Length);
// Console.WriteLine("Sent: {0}", data);
//}
cancellationTokenSource.Cancel();
KillOStressTask(cq);
Console.WriteLine("All task should be canceled.");
// Shutdown and end connection
client.Close();
cancellationTokenSource.Dispose();
}
}
catch (SocketException e)
{
Console.WriteLine("SocketException: {0}", e);
// Stop listening for new clients.
server.Stop();
}
finally
{
// Stop listening for new clients.
server.Stop();
}
Console.WriteLine("\nHit enter to continue...");
Console.Read();
Console.ReadKey();
}
static void NewConnectionsToDBs(ConcurrentQueue<Process> cq, List<string> list, CancellationTokenSource cancellationTokenSource)
{
CancellationToken cancellationToken = cancellationTokenSource.Token;
foreach (string dbname in list)
{
var runningTask = Task.Factory.StartNew(() => CreateOstressTask(cq, dbname), cancellationToken);
}
}
static public string DecoratePath(string path)
{
char doubleQuaote = '\"';
string ret = doubleQuaote + path + doubleQuaote;
return ret;
}
public static void CreateOstressTask(ConcurrentQueue<Process> cq, string dbName)
{
Process ostress = new Process();
ostress.StartInfo.FileName = @"C:\Program Files\Microsoft Corporation\RMLUtils\ostress.exe";
string queryPath = DecoratePath(@"test_noloop.sql");
string outputBase = @"C:\temp\";
string outputPath = DecoratePath(outputBase + dbName);
string argument = @"-SBenchTestLis\hadrbenchmark01 -d" +dbName + ' ' + "-r10000000 -q -i" + queryPath + " -T146 -o" + outputPath;
Console.WriteLine(DecoratePath(queryPath));
Console.WriteLine(DecoratePath(outputPath));
Console.WriteLine(argument);
ostress.StartInfo.Arguments = argument;
cq.Enqueue(ostress);
ostress.Start();
}
public static void KillOStressTask(ConcurrentQueue<Process> cq)
{
Process ostress;
while (cq.TryDequeue(out ostress))
{
if (!ostress.HasExited)
{
ostress.Kill();
}
}
}
public static object DecerializeMessage(Message msg)
{
using (var memoryStream = new MemoryStream(msg.Data))
{
return (new BinaryFormatter()).Deserialize(memoryStream);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LibEqmtDriver.SG
{
public interface IISiggen
{
void Initialize();
void Reset();
void EnableModulation(InstrOutput onoff);
void EnableRf(InstrOutput onoff);
void SetFreq(double mHz);
void SetAmplitude(float dBm);
void SetPowerMode(N5182PowerMode mode);
void SetFreqMode(N5182FrequencyMode mode);
void MOD_FORMAT_WITH_LOADING_CHECK(string strWaveform, string strWaveformName, bool waveformInitalLoad);
void SELECT_WAVEFORM(N5182AWaveformMode mode);
void SET_LIST_TYPE(N5182ListType mode);
void SET_LIST_MODE(InstrMode mode);
void SET_LIST_TRIG_SOURCE(N5182TrigType mode);
void SET_CONT_SWEEP(InstrOutput onoff);
void SET_START_FREQUENCY(double mHz);
void SET_STOP_FREQUENCY(float mHz);
void SET_TRIG_TIMERPERIOD(double ms);
void SET_SWEEP_POINT(int points);
void SINGLE_SWEEP();
void SET_SWEEP_PARAM(int points, double ms, double startFreqMHz, double stopFreqMHz);
bool OPERATION_COMPLETE();
}
}
|
using System;
public class Program
{
public static void Main()
{
var inputNumber = Console.ReadLine();
var weather = string.Empty;
var dummySbyte = default(sbyte);
var dummyInt = default(int);
var dummyLong = default(long);
if (sbyte.TryParse(inputNumber, out dummySbyte))
{
weather = "Sunny";
}
else if (int.TryParse(inputNumber, out dummyInt))
{
weather = "Cloudy";
}
else if (long.TryParse(inputNumber, out dummyLong))
{
weather = "Windy";
}
else
{
weather = "Rainy";
}
Console.WriteLine(weather);
}
} |
namespace Kers.Models.Entities.UKCAReporting
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
[Table("zzInServiceCancelEnrollmentWindow")]
public partial class zzInServiceCancelEnrollmentWindow
{
[Key]
[Column(Order = 0)]
public int rID { get; set; }
[Key]
[Column(Order = 1)]
[StringLength(50)]
public string cancelDaysVal { get; set; }
[Key]
[Column(Order = 2)]
[StringLength(75)]
public string cancelDaysTxt { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YzkSoftWare.DataModel
{
/// <summary>
/// 数据模型检查特性类
/// </summary>
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
public class DataUpdateCheckersAttribute : TypeSetAttribute
{
public DataUpdateCheckersAttribute(Type typevalue) : base(typevalue) { }
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Entity.Infrastructure;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Code_Hog {
public partial class UserManagementMenu : Form {
CodeHogEntities codeHogEntities;
UserLogin user;
public UserManagementMenu(UserLogin currentUser) {
InitializeComponent();
codeHogEntities = new CodeHogEntities();
user = currentUser;
BindUserList();
roleComboBox.SelectedIndex = 0;
}
private void BindUserList() {
UserListBox.DataSource = codeHogEntities.Users.Where(s => !s.UserID.Equals(user.Id)).ToList();
UserListBox.DisplayMember = "Username";
UserListBox.ValueMember = "UserID";
}
private void UserListBox_SelectedIndexChanged(object sender, EventArgs e) {
User selectedUser = UserListBox.SelectedItem as User;
userIDTextBox.Text = selectedUser.UserID.ToString();
userNameTextBox.Text = selectedUser.Username;
passwordTextBox.Text = selectedUser.Password;
emailTextBox.Text = selectedUser.Email;
roleComboBox.SelectedIndex = selectedUser.RoleID - 1;
}
private void AddUserButton_Click(object sender, EventArgs e) {
AddUser();
}
private void UpdateUserButton_Click(object sender, EventArgs e) {
UpdateUser();
}
private void DeleteUserButton_Click(object sender, EventArgs e) {
DeleteUser();
}
private void AddUser() {
if (!String.IsNullOrWhiteSpace(userNameTextBox.Text) &&
!String.IsNullOrWhiteSpace(passwordTextBox.Text) &&
!String.IsNullOrWhiteSpace(emailTextBox.Text)) {
User newUser = new User {
Username = userNameTextBox.Text,
Password = passwordTextBox.Text,
Email = emailTextBox.Text,
RoleID = roleComboBox.SelectedIndex + 1
};
codeHogEntities.Users.Add(newUser);
try {
codeHogEntities.SaveChanges();
}
catch (DbUpdateException ex) {
MessageBox.Show(ex.Message);
}
BindUserList();
}
else {
MessageBox.Show("ERROR: One or more of the Textfeilds are Empty");
}
}
private void UpdateUser() {
if (!String.IsNullOrEmpty(userIDTextBox.Text)) {
User selectedUser = UserListBox.SelectedItem as User;
selectedUser.Username = userNameTextBox.Text;
selectedUser.Password = passwordTextBox.Text;
selectedUser.Email = emailTextBox.Text;
selectedUser.RoleID = roleComboBox.SelectedIndex + 1;
try {
codeHogEntities.SaveChanges();
}
catch (DbUpdateException ex) {
MessageBox.Show(ex.Message);
}
BindUserList();
}
}
private void DeleteUser() {
if (!String.IsNullOrEmpty(userIDTextBox.Text)) {
User selectedUser = UserListBox.SelectedItem as User;
codeHogEntities.Users.Remove(selectedUser);
try {
codeHogEntities.SaveChanges();
}
catch (DbUpdateException ex) {
MessageBox.Show(ex.Message);
}
BindUserList();
}
}
private void ClearFieldsButton_Click(object sender, EventArgs e) {
userIDTextBox.Text = userNameTextBox.Text = passwordTextBox.Text = emailTextBox.Text = "";
roleComboBox.SelectedIndex = 0;
}
private void ReturnButton_Click(object sender, EventArgs e) {
Return();
}
private void Return() {
this.Hide();
MainMenu menu = new MainMenu();
menu.SetUser(user.Id, user.Name, user.RoleID);
menu.Show();
}
private void UserManagementMenu_FormClosed(object sender, FormClosedEventArgs e) {
Return();
}
}
}
|
using Newtonsoft.Json;
using SearchEng.Common.GoodRead;
using SearchEng.Search.Interface;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Xml;
using System.Xml.Linq;
using System.Xml.Serialization;
using System.Xml.XPath;
using System.Threading.Tasks;
namespace SearchEng.Search.Repository
{
public class GoodReadSearchRepository : ISearchRepository<Book>
{
public IEnumerable<Book> Results(string term)
{
//WebClient cl = new WebClient();
//var xml = cl.DownloadString("https://www.goodreads.com/search.xml?key=yqJLRCs1j7H6T4wcrNrHew&q=" + term);
//XmlDocument doc = new XmlDocument();
//doc.LoadXml(xml);
//var search = doc.SelectSingleNode("descendant::search");
//string jsonText = JsonConvert.SerializeXmlNode(search);
//return jsonText;
List<Book> books = new List<Book>();
XElement root = XElement.Load("https://www.goodreads.com/search.xml?key=yqJLRCs1j7H6T4wcrNrHew&q=" + term);
var results = from el in root.Descendants("best_book") select el;
foreach (XElement item in results)
{
Book newbook = new Book();
int id;
if (Int32.TryParse(item.Element("id").Value, out id))
{
newbook.ID = id;
}
newbook.Title = item.Element("title").Value;
int authorId;
if (Int32.TryParse(item.Element("author").Element("id").Value, out authorId))
{
newbook.AuthorID = authorId;
}
newbook.Author = item.Element("author").Element("name").Value;
newbook.Image = item.Element("image_url").Value;
newbook.Thumbnail= item.Element("small_image_url").Value;
books.Add(newbook);
}
return books;
}
public Task<IEnumerable<Book>> ResultsAsync(string term)
{
Task<IEnumerable<Book>> resultasync = Task<IEnumerable<Book>>.Factory.StartNew(() => { return Results(term); });
return resultasync;
}
public virtual IEnumerable<string> Suggestions(string term)
{
XElement root = XElement.Load("https://www.goodreads.com/search.xml?key=yqJLRCs1j7H6T4wcrNrHew&q=" + term);
var suggests = from el in root.Descendants("best_book") select (string)el.Element("title") ;
return suggests;
}
public Task<IEnumerable<string>> SuggestionsAsync(string term)
{
Task<IEnumerable<string>> suggestasync = Task<IEnumerable<string>>.Factory.StartNew(() => { return Suggestions(term); });
return suggestasync;
}
}
} |
using System;
using System.Collections.Generic;
using System.Text;
namespace FixMyShip.Entities
{
public class Feedback
{
public virtual int Id { get; set; }
public virtual int UserId { get; set; }
public virtual int SenderUserId { get; set; }
public virtual string Comment { get; set; }
}
}
|
using Contoso.Bsl.Business.Requests;
using Contoso.Bsl.Business.Responses;
using Contoso.Forms.Configuration.Bindings;
using Contoso.Forms.Configuration.ListForm;
using Contoso.XPlatform.Flow.Settings.Screen;
using Contoso.XPlatform.Services;
using Contoso.XPlatform.Utils;
using Contoso.XPlatform.ViewModels.ReadOnlys;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
namespace Contoso.XPlatform.ViewModels.ListPage
{
public class ListPageViewModel<TModel> : ListPageViewModelBase where TModel : Domain.EntityModelBase
{
public ListPageViewModel(
ICollectionCellManager collectionCellManager,
IHttpService httpService,
ScreenSettings<ListFormSettingsDescriptor> screenSettings) : base(screenSettings)
{
itemBindings = FormSettings.Bindings.Values.ToList();
this.collectionCellManager = collectionCellManager;
this.httpService = httpService;
GetItems();
}
private readonly ICollectionCellManager collectionCellManager;
private readonly IHttpService httpService;
private readonly List<ItemBindingDescriptor> itemBindings;
private ObservableCollection<Dictionary<string, IReadOnly>>? _items;
public ObservableCollection<Dictionary<string, IReadOnly>>? Items
{
get => _items;
set
{
_items = value;
OnPropertyChanged();
}
}
private Task<BaseResponse> GetList()
=> BusyIndicatorHelpers.ExecuteRequestWithBusyIndicator
(
() => httpService.GetList
(
new GetTypedListRequest
{
Selector = this.FormSettings.FieldsSelector,
ModelType = this.FormSettings.RequestDetails.ModelType,
DataType = this.FormSettings.RequestDetails.DataType,
ModelReturnType = this.FormSettings.RequestDetails.ModelReturnType,
DataReturnType = this.FormSettings.RequestDetails.DataReturnType
}
)
);
private async void GetItems()
{
BaseResponse baseResponse = await GetList();
if (baseResponse.Success == false)
return;
GetListResponse getListResponse = (GetListResponse)baseResponse;
this.Items = new ObservableCollection<Dictionary<string, IReadOnly>>
(
getListResponse.List.Cast<TModel>().Select
(
item => this.collectionCellManager.GetCollectionCellDictionaryItem(item, itemBindings)
)
);
}
}
}
|
//
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
namespace DotNetNuke.Services.Assets
{
public enum SubfolderFilter
{
ExcludeSubfolders,
IncludeSubfoldersFilesOnly,
IncludeSubfoldersFolderStructure
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Shooter
{
interface IDrawable
{
void Draw(int x, int y);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using NopSolutions.NopCommerce.BusinessLogic.Configuration.Settings;
using NopSolutions.NopCommerce.BusinessLogic.CustomerManagement;
using NopSolutions.NopCommerce.BusinessLogic.Orders;
using NopSolutions.NopCommerce.BusinessLogic.Payment;
using NopSolutions.NopCommerce.Common.Utils;
namespace Nop.Payment.WebPay
{
using System.Web;
using NopSolutions.NopCommerce.BusinessLogic.Products;
using NopSolutions.NopCommerce.BusinessLogic.Utils;
public class WebPayPaymentProcessor : IPaymentMethod
{
public static string Sk
{
get
{
return UseSandBox ? "92E6467729814FC4BF365C3C820042AD" : "25A591BD53304045B0FB1E5293B4733E";
}
}
public static string StoreId
{
get
{
return UseSandBox ? "994668300" : "813689890";
}
}
public static string CurrencyId
{
get
{
return "BYR";
}
}
public void ProcessPayment(PaymentInfo paymentInfo, Customer customer, Guid orderGuid, ref ProcessPaymentResult processPaymentResult)
{
processPaymentResult.PaymentStatus = PaymentStatusEnum.Pending;
}
private decimal shippingRate;
private decimal freeShippingBorder;
private decimal shippingPrice;
public string PostProcessPayment(Order order)
{
return PostProcessPayment(order, new IndividualOrderCollection());
}
public string PostProcessPayment(Order order, IndividualOrderCollection indOrders)
{
bool convertToUsd = HttpContext.Current.Request.Cookies["Currency"] != null && HttpContext.Current.Request.Cookies["Currency"].Value == "USD";
shippingRate = SettingManager.GetSettingValueDecimalNative("ShippingRateComputationMethod.FixedRate.Rate");
freeShippingBorder = SettingManager.GetSettingValueDecimalNative("Shipping.FreeShippingOverX.Value");
if (convertToUsd)
{
freeShippingBorder = Math.Round(PriceConverter.ToUsd(freeShippingBorder));
}
var prodVars = new List<ProductVariant>();
foreach (var opv in order.OrderProductVariants)
{
prodVars.Add(ProductManager.GetProductVariantByID(opv.ProductVariantID));
}
decimal totalWithFee = (int)CalculateTotalServiceFee(order.OrderProductVariants, prodVars, order, convertToUsd, out shippingPrice);
totalWithFee += AddServiceFee(IndividualOrderManager.GetTotalPriceIndOrders(indOrders), convertToUsd);
var remotePostHelper = new RemotePost { FormName = "WebPeyForm", Url = GetWebPayUrl() };
OrderManager.UpdateOrder(order.OrderID, order.OrderGUID, order.CustomerID, order.CustomerLanguageID, order.CustomerTaxDisplayType, order.OrderSubtotalInclTax, order.OrderSubtotalExclTax, order.OrderShippingInclTax,
order.OrderShippingExclTax, order.PaymentMethodAdditionalFeeInclTax, order.PaymentMethodAdditionalFeeExclTax, order.OrderTax, order.OrderTotal, order.OrderDiscount, order.OrderSubtotalInclTaxInCustomerCurrency,
order.OrderShippingExclTaxInCustomerCurrency, order.OrderShippingInclTaxInCustomerCurrency, order.OrderShippingExclTaxInCustomerCurrency, order.PaymentMethodAdditionalFeeInclTaxInCustomerCurrency,
order.PaymentMethodAdditionalFeeExclTaxInCustomerCurrency, order.OrderTaxInCustomerCurrency, order.OrderTotalInCustomerCurrency, order.CustomerCurrencyCode, order.OrderWeight, order.AffiliateID,
order.OrderStatus, order.AllowStoringCreditCardNumber, order.CardType, order.CardName, order.CardNumber, order.MaskedCreditCardNumber, order.CardCVV2, order.CardExpirationMonth, order.CardExpirationYear,
order.PaymentMethodID, order.PaymentMethodName, order.AuthorizationTransactionID, order.AuthorizationTransactionCode, order.AuthorizationTransactionResult, order.CaptureTransactionID, order.CaptureTransactionResult,
order.PurchaseOrderNumber, order.PaymentStatus, order.BillingFirstName, order.BillingLastName, order.BillingPhoneNumber, order.BillingEmail, order.BillingFaxNumber, order.BillingCompany, order.BillingAddress1,
order.BillingAddress2, order.BillingCity, order.BillingStateProvince, order.BillingStateProvinceID, order.BillingZipPostalCode, order.BillingCountry, order.BillingCountryID, order.ShippingStatus,
order.ShippingFirstName, order.ShippingLastName, order.ShippingPhoneNumber, order.ShippingEmail, order.ShippingFaxNumber, order.ShippingCompany, order.ShippingAddress1, order.ShippingAddress2,
order.ShippingCity, order.ShippingStateProvince, order.ShippingStateProvinceID, order.ShippingZipPostalCode, order.ShippingCountry, order.ShippingCountryID, order.ShippingMethod,
order.ShippingRateComputationMethodID, order.ShippedDate, order.Deleted, order.CreatedOn);
remotePostHelper.Add("*scart", "");
remotePostHelper.Add("wsb_storeid", StoreId);
remotePostHelper.Add("wsb_store", "voobrazi.by");
remotePostHelper.Add("wsb_order_num", order.OrderID.ToString());
remotePostHelper.Add("wsb_currency_id", convertToUsd ? "USD" : CurrencyId);
remotePostHelper.Add("wsb_version", "2");
remotePostHelper.Add("wsb_language_id", "russian");
string seed = ((int)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds).ToString();
remotePostHelper.Add("wsb_seed", seed);
var signatureBulder = new StringBuilder(seed);
signatureBulder.Append(StoreId);
signatureBulder.Append(order.OrderID);
signatureBulder.Append(UseSandBox ? "1" : "0");
signatureBulder.Append(convertToUsd ? "USD" : CurrencyId);
signatureBulder.Append(totalWithFee.ToString());
signatureBulder.Append(Sk);
byte[] buffer = Encoding.Default.GetBytes(signatureBulder.ToString());
var sha1 = new SHA1CryptoServiceProvider();
string signature = BitConverter.ToString(sha1.ComputeHash(buffer)).Replace("-", "").ToLower();
remotePostHelper.Add("wsb_signature", signature);
remotePostHelper.Add("wsb_return_url", string.Format(SettingManager.GetSettingValue("PaymentMethod.WebPay.ReturnUrl"), order.OrderID));
remotePostHelper.Add("wsb_cancel_return_url", string.Format(SettingManager.GetSettingValue("PaymentMethod.WebPay.CancelUrl"), order.OrderID));
remotePostHelper.Add("wsb_notify_url", string.Format(SettingManager.GetSettingValue("PaymentMethod.WebPay.NotifyUrl"), order.OrderID));
remotePostHelper.Add("wsb_test", UseSandBox ? "1" : "0");
for (int i = 0; i < order.OrderProductVariants.Count; i++)
{
var opv = order.OrderProductVariants[i];
remotePostHelper.Add(string.Format("wsb_invoice_item_name[{0}]", i), opv.ProductVariant.Product.Name);
remotePostHelper.Add(string.Format("wsb_invoice_item_quantity[{0}]", i), opv.Quantity.ToString());
var prodVar = ProductManager.GetProductVariantByID(opv.ProductVariantID);
decimal prodPrice = !convertToUsd ? prodVar.Price : Math.Round(PriceConverter.ToUsd(prodVar.Price));
remotePostHelper.Add(string.Format("wsb_invoice_item_price[{0}]", i), AddServiceFee(prodPrice, convertToUsd).ToString());
}
int cartCount = order.OrderProductVariants.Count;
for (int i = order.OrderProductVariants.Count; i < indOrders.Count + cartCount; i++)
{
var opv = indOrders[i - cartCount];
remotePostHelper.Add(string.Format("wsb_invoice_item_name[{0}]", i), "Индивидуальный заказ");
remotePostHelper.Add(string.Format("wsb_invoice_item_quantity[{0}]", i), "1");
decimal prodPrice = !convertToUsd ? opv.Price : Math.Round(PriceConverter.ToUsd(opv.Price));
remotePostHelper.Add(string.Format("wsb_invoice_item_price[{0}]", i), AddServiceFee(prodPrice, convertToUsd).ToString());
}
remotePostHelper.Add("wsb_tax", "0");
remotePostHelper.Add("wsb_shipping_name", "Доставка курьером");
remotePostHelper.Add("wsb_shipping_price", AddServiceFee(shippingPrice, convertToUsd).ToString());
remotePostHelper.Add("wsb_total", totalWithFee.ToString());
if (!string.IsNullOrEmpty(order.ShippingEmail))
remotePostHelper.Add("wsb_email", order.ShippingEmail);
remotePostHelper.Add("wsb_phone", order.ShippingPhoneNumber);
remotePostHelper.Post();
return string.Empty;
}
private decimal CalculateTotalServiceFee(IEnumerable<OrderProductVariant> orderProducts, IEnumerable<ProductVariant> prodVars, Order order, bool convvertToUsd, out decimal shippingPrice)
{
decimal retVal = convvertToUsd ?
prodVars.Sum(prodVar => (Math.Round(PriceConverter.ToUsd(AddServiceFee(prodVar.Price, convvertToUsd))) * orderProducts.First(op => op.ProductVariantID == prodVar.ProductVariantID).Quantity))
: prodVars.Sum(prodVar => (AddServiceFee(prodVar.Price, convvertToUsd) * orderProducts.First(op => op.ProductVariantID == prodVar.ProductVariantID).Quantity));
shippingPrice = retVal > freeShippingBorder ? 0 : shippingRate;
if (convvertToUsd)
{
shippingPrice = Math.Round(PriceConverter.ToUsd(shippingPrice));
}
retVal += AddServiceFee(shippingPrice, convvertToUsd);
return retVal;
}
private static decimal AddServiceFee(decimal price, bool convvertToUsd)
{
decimal priceWithFee = price + ((price / 100) * SettingManager.GetSettingValueInteger("PaymentMethod.WebPay.ServiceFee"));
if (!convvertToUsd)
return Math.Ceiling((priceWithFee / 100) * 100);
return Math.Round((priceWithFee / 100) * 100);
}
private static bool UseSandBox
{
get
{
try
{
return SettingManager.GetSettingValueBoolean("PaymentMethod.WebPay.UseSandbox");
}
catch (Exception) { }
return true;
}
}
private static string GetWebPayUrl()
{
return UseSandBox ? "https://secure.sandbox.webpay.by:8843" : "https://secure.webpay.by";
}
public decimal GetAdditionalHandlingFee()
{
return decimal.Zero;
}
public void Capture(Order order, ref ProcessPaymentResult processPaymentResult)
{
throw new NotImplementedException();
}
public void ProcessRecurringPayment(PaymentInfo paymentInfo, Customer customer, Guid orderGuid, ref ProcessPaymentResult processPaymentResult)
{
throw new NotImplementedException();
}
public bool CanCapture
{
get
{
return false;
}
}
public bool CanPartiallyRefund
{
get
{
return false;
}
}
public bool CanRefund
{
get
{
return false;
}
}
public bool CanVoid
{
get
{
return false;
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Spa.Models.Requests
{
public class TokenAddRequest
{
public Guid TokenGuid { get; set; }
public int SiteUserId { get; set; }
public DateTime ExpireDate { get; set; }
}
} |
namespace Triton.Game.Mapping
{
using ns26;
using System;
[Attribute38("PlayButton")]
public class PlayButton : PegUIElement
{
public PlayButton(IntPtr address) : this(address, "PlayButton")
{
}
public PlayButton(IntPtr address, string className) : base(address, className)
{
}
public void Awake()
{
base.method_8("Awake", Array.Empty<object>());
}
public void ChangeHighlightState(ActorStateType stateType)
{
object[] objArray1 = new object[] { stateType };
base.method_8("ChangeHighlightState", objArray1);
}
public void Disable()
{
base.method_8("Disable", Array.Empty<object>());
}
public void Enable()
{
base.method_8("Enable", Array.Empty<object>());
}
public void OnOut(PegUIElement.InteractionState oldState)
{
object[] objArray1 = new object[] { oldState };
base.method_8("OnOut", objArray1);
}
public void OnOver(PegUIElement.InteractionState oldState)
{
object[] objArray1 = new object[] { oldState };
base.method_8("OnOver", objArray1);
}
public void OnPress()
{
base.method_8("OnPress", Array.Empty<object>());
}
public void OnRelease()
{
base.method_8("OnRelease", Array.Empty<object>());
}
public void SetText(string newText)
{
object[] objArray1 = new object[] { newText };
base.method_8("SetText", objArray1);
}
public void Start()
{
base.method_8("Start", Array.Empty<object>());
}
public bool m_isStarted
{
get
{
return base.method_2<bool>("m_isStarted");
}
}
public UberText m_newPlayButtonText
{
get
{
return base.method_3<UberText>("m_newPlayButtonText");
}
}
public HighlightState m_playButtonHighlightState
{
get
{
return base.method_3<HighlightState>("m_playButtonHighlightState");
}
}
public Vector3 m_pressMovement
{
get
{
return base.method_2<Vector3>("m_pressMovement");
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
namespace Juego.backend
{
class DetectarBatalla
{
public bool Detectar(int x, int y,ObjectGeneric[,] Dungeon)
{
bool state = false;
for(int a = x - 1; a <= x + 1; a++)
{
for(int b = y - 1; b <= y + 1; b++)
{
if(Dungeon[a,b].Body == '?')
{
state = true;
}
}
}
return state;
}
public List<Monsters> DetectarNumMonsters(int x, int y, ObjectGeneric[,] Dungeon)
{
List<Monsters> Monstruos = new List<Monsters>();
for (int a = x - 1; a <= x + 1; a++)
{
for (int b = y - 1; b <= y + 1; b++)
{
if (Dungeon[a, b].Body == '?')
{
Monstruos.Add((Monsters)Dungeon[a, b]);
}
}
}
return Monstruos;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Dominio
{
public class InformativoFiscal
{
public decimal CD_INFORMATIVO { get; set; }
public string NU_REFERENCIA { get; set; }
public DateTime DT_ENVIO { get; set; }
public string NU_INSCRICAO_ESTADUAL { get; set; }
public string NU_CNPJ_CPF { get; set; }
public string NM_RAZAO_SOCIAL { get; set; }
public string NM_FANTASIA { get; set; }
public string NM_LOGRADOURO { get; set; }
public string NU_LOGRADOURO { get; set; }
public string NM_COMPLEMENTO { get; set; }
public string NU_CEP { get; set; }
public string NM_BAIRRO { get; set; }
public string NM_MUNICIPIO_RFB { get; set; }
public string SG_UF_MUNICIPIO1 { get; set; }
public string CD_INFORMATICO_REP { get; set; }
public decimal CAMPO_0111 { get; set; }
public decimal CAMPO_0112 { get; set; }
public decimal CAMPO_0121 { get; set; }
public decimal CAMPO_0122 { get; set; }
public decimal CAMPO_0211 { get; set; }
public decimal CAMPO_0212 { get; set; }
public decimal CAMPO_0221 { get; set; }
public decimal CAMPO_0222 { get; set; }
public decimal CAMPO_03 { get; set; }
public decimal CAMPO_04 { get; set; }
public decimal CAMPO_05 { get; set; }
public decimal CAMPO_06 { get; set; }
public decimal CAMPO_07 { get; set; }
public decimal CAMPO_08 { get; set; }
public decimal CAMPO_09 { get; set; }
public decimal CAMPO_10 { get; set; }
public decimal CAMPO_11 { get; set; }
public decimal CAMPO_12 { get; set; }
public decimal CAMPO_13 { get; set; }
public decimal CAMPO_14 { get; set; }
public decimal CAMPO_151 { get; set; }
public decimal CAMPO_152 { get; set; }
public decimal CAMPO_153 { get; set; }
public decimal CAMPO_161 { get; set; }
public decimal CAMPO_162 { get; set; }
public decimal CAMPO_163 { get; set; }
public decimal CAMPO_171 { get; set; }
public decimal CAMPO_172 { get; set; }
public decimal CAMPO_173 { get; set; }
public decimal CAMPO_174 { get; set; }
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using DialogSystem.Model;
using DialogSystem.ScriptObject;
using ReadyGamerOne.Common;
using ReadyGamerOne.Script;
using UnityEngine;
namespace DialogSystem.Scripts
{
/// <summary>
/// 对话系统
/// </summary>
public class DialogSystem : MonoBehaviour
{
#region Static
#region Const_Messages
/// <summary>
/// 用于DialogSystem内部
/// <DialogUnitInfo>资源</DialogUnitInfo>
/// </summary>
public static readonly string ExternWord = "__ew";
/// <summary>
/// 用于DialogSystem内部
/// <string>assetName</string>
/// </summary>
public static readonly string EndThisDialogUnit = "__etdu";
/// <summary>
/// 用于DialogSystem内部
/// </summary>
public static readonly string CanGoNext = "__cgn";
/// <summary>
/// 开始对话
/// <string>对话单元名字</string>
/// </summary>
public static readonly string BeginDialog = "__bdg";
/// <summary>
/// Choose单元的分支不会返回
/// <string>AssetName</string>
/// </summary>
public static readonly string ChooseNotBack = "__cnb";
#region 监听多资源消息
private static Dictionary<string, List<string>> messageCache = new Dictionary<string, List<string>>();
private static void AddAssetMessage(string message,string assetName)
{
if (!messageCache.ContainsKey(message))
{
messageCache.Add(message,new List<string>());
}
if (!messageCache[message].Contains(assetName))
messageCache[message].Add(assetName);
}
public static bool GetAssetMessage(string message, string assetName,bool reset=true)
{
if (!messageCache.ContainsKey(message))
{
return false;
}
if (!messageCache[message].Contains(assetName))
return false;
if(reset)
messageCache[message].Remove(assetName);
return true;
}
#endregion
#endregion
#region 维护Character名字和GameObject的映射
// 所有DialogCharacter需要在全局窗口中添加好,并且,每个角色都需要挂上DialogCharacter脚本用于维护和更新其位置信息
// 用于在角色头顶产生对话气泡
private static Dictionary<string, GameObject> nameToGameObject = new Dictionary<string, GameObject>();
/// <summary>
/// 根据角色名字获取角色GameObject
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public static GameObject GetCharacterObj(string name)
{
if (nameToGameObject.ContainsKey(name) == false)
throw new Exception("DialogSystem 不包含这个名字:name:" + name);
return nameToGameObject[name];
}
/// <summary>
/// 更新角色的位置
/// </summary>
/// <param name="name"></param>
/// <param name="obj"></param>
public static void RefreshCharacterObj(string name, GameObject obj)
{
if (nameToGameObject.ContainsKey(name))
{
nameToGameObject[name] = obj;
}
else
nameToGameObject.Add(name, obj);
}
#endregion
#region 开启对话的API
/// <summary>
/// 开始谈话实践
/// </summary>
public static event Action onStartDialog;
/// <summary>
/// 结束谈话事件
/// </summary>
public static event Action onEndDialog;
/// <summary>
/// 运行DialogInfoAsset资源
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
public static IEnumerator RunDialog(AbstractDialogInfoAsset info,Action endCall=null)
{
#region 对话开始事件
if(!IsRunningAll && stackSize==0)
onStartDialog?.Invoke();
if (DialogSettings.Instance.ShowDialogStackInfo)
{
var text = "对话开始-";
for (var i = 0; i < stackSize; i++)
text += "-";
print(text+info.name);
}
#endregion
stackSize++;
var DialogUnits = info.DialogUnits;
var ifConditions=new Stack<bool>();
var ifTrue = false;
var currentIndex = 0;
if (!info.canMoveOnTalking)
info.SetPlayerMovable(false);
while (currentIndex<DialogUnits.Count)
{
var dialogUnitInfo = DialogUnits[currentIndex];
// Debug.Log(dialogUnitInfo.UnitType);
// Debug.Log(info.name+":"+ dialogUnitInfo.id);
switch (dialogUnitInfo.UnitType)
{
case UnitType.Word:
// Debug.Log("DialogSystem_RunDialog_Switch_UnitType.Word_Start");
yield return dialogUnitInfo.RunWordUnit();
// Debug.Log("DialogSystem_RunDialog_Switch_UnitType.Word_end");
break;
case UnitType.Choose:
yield return dialogUnitInfo.RunChooseUnit();
if (GetAssetMessage(ChooseNotBack,info.name))
{
endCall?.Invoke();
EndRunningDialog("End by ChooseNotBack",info.name);
yield break;
}
break;
case UnitType.Narrator:
yield return dialogUnitInfo.RunNarratorUnit();
break;
case UnitType.ExWord:
yield return dialogUnitInfo.RunExWordUnit();
break;
case UnitType.If:
ifTrue = dialogUnitInfo.Complare();
ifConditions.Push(ifTrue);
if (!ifTrue)//如果不满足IF条件,IF到Else或者EndIF之间不执行
{
//寻找Else
var id = FindUnitFromIndex(info, currentIndex, UnitType.Else);
if (id != -1)
{
//找到Else
currentIndex = id - 1;
}
else//没找到Else,查找EndIF
{
id = FindUnitFromIndex(info, currentIndex, UnitType.EndIf);
if (-1 == id)
{
endCall?.Invoke();
EndRunningDialog("End by 在IF处, if 条件不满足,同时没有EndIf",info.name);
yield break;
}
else
{
//找到EndIf
currentIndex = id - 1;
}
}
}
break;
case UnitType.Else:
if (ifConditions.Peek())//如果满足条件,Else到EndIF不执行
{
//寻找下一个EndIF
var id = FindUnitFromIndex(info, currentIndex, UnitType.EndIf);
if (-1 == id)
{
//没找到
endCall?.Invoke();
EndRunningDialog("End by 在Else处, if 条件满足,同时没有EndIf",info.name);
yield break;
}
else
{
//找到了
currentIndex = id - 1;
}
}
break;
case UnitType.EndIf:
ifConditions.Pop();
break;
case UnitType.Message:
dialogUnitInfo.RunMessageUnit();
break;
case UnitType.SetVar:
dialogUnitInfo.RunSetVarUnit();
break;
case UnitType.End:
endCall?.Invoke();
EndRunningDialog("End By UnitType.End",info.name);
yield break;
case UnitType.Skip:
currentIndex += dialogUnitInfo.skipNum;
break;
case UnitType.Event:
dialogUnitInfo.RunEventUnit();
break;
case UnitType.Print:
dialogUnitInfo.RunPrintUnit();
break;
case UnitType.VarInfo:
dialogUnitInfo.ShowVarInfo();
break;
case UnitType.Wait:
yield return dialogUnitInfo.WaitForTime();
break;
case UnitType.Jump:
yield return dialogUnitInfo.RunJumpUnit();
if (GetAssetMessage(ChooseNotBack,info.name))
{
endCall?.Invoke();
EndRunningDialog("End by JumpNotBack",info.name);
yield break;
}
break;
case UnitType.Shining:
yield return dialogUnitInfo.Shining();
break;
case UnitType.FadeIn:
yield return dialogUnitInfo.FadeIn();
break;
case UnitType.FadeOut:
yield return dialogUnitInfo.FadeOut();
break;
case UnitType.Audio:
dialogUnitInfo.RunAudio();
break;
case UnitType.Panel:
// Debug.Log("DialogSystem_RunDialog_Switch_UnitType_Panel");
dialogUnitInfo.RunPanelUnit();
break;
case UnitType.Scene:
yield return dialogUnitInfo.RunSceneUnit();
// Debug.Log("DialogSystem_RunDialog_Switch_UnitType.Scene_end");
break;
case UnitType.Progress:
dialogUnitInfo.RunProgressUnit();
break;
case UnitType.ProcessInfo:
dialogUnitInfo.RunProgressInfoUnit();
break;
case UnitType.Camera:
yield return dialogUnitInfo.RunCameraUnit();
break;
}
currentIndex++;
}
if (!info.canMoveOnTalking)
info.SetPlayerMovable(true);
endCall?.Invoke();
EndRunningDialog("End by normalEnd",info.name);
}
/// <summary>
/// 顺次运行DialogSystem所有DialogInfoAsset资源
/// </summary>
/// <param name="dialogSystem"></param>
/// <returns></returns>
public static IEnumerator RunAllDialog(DialogSystem dialogSystem,bool await=false)
{
IsRunningAll = true;
if(stackSize==0)
onStartDialog?.Invoke();
foreach (var asset in dialogSystem.DialogInfoAssets)
{
if(asset==null)
continue;
if (await)
yield return RunDialogAwait(asset);
else
yield return RunDialog(asset);
}
onEndDialog?.Invoke();
IsRunningAll = false;
}
/// <summary>
/// 运行对话资源,会等待所有对话结束才会开始
/// </summary>
/// <param name="info"></param>
/// <param name="callBack"></param>
/// <returns></returns>
public static IEnumerator RunDialogAwait(AbstractDialogInfoAsset info, Action callBack = null)
{
while (stackSize != 0)
yield return null;
yield return RunDialog(info, callBack);
}
#endregion
#region Private
private static int stackSize = 0;
private static bool IsRunningAll = false;
private static int FindUnitFromIndex(AbstractDialogInfoAsset asset, int index, UnitType type)
{
bool skip = false || (type == UnitType.Else || type == UnitType.EndIf);
int ifCount = 0;
var DialogUnits = asset.DialogUnits;
for (var i = index+1; i < DialogUnits.Count; i++)
{
if (skip && DialogUnits[i].UnitType == UnitType.If)
{
// print("执行ifCount++");
ifCount++;
}
if (DialogUnits[i].UnitType == type)
{
if (skip)
{
if (ifCount <= 0)
return i;
else
{
ifCount--;
}
}
else
return i;
}
}
return -1;
}
static DialogSystem()
{
//监听选择语句不再返回的消息
CEventCenter.AddListener<string>(ChooseNotBack,(assetName)=>AddAssetMessage(ChooseNotBack,assetName));
}
/// <summary>
/// 结束对话调用此函数
/// </summary>
/// <param name="endStatement"></param>
/// <param name="assetName"></param>
private static void EndRunningDialog(string endStatement, string assetName)
{
stackSize--;
if(!IsRunningAll && stackSize==0)
onEndDialog?.Invoke();
if (DialogSettings.Instance.ShowDialogStackInfo)
{
var text = "对话结束-";
for (var i = 0; i < stackSize; i++)
text += "-";
print($"{text}{assetName}【{endStatement}】");
}
}
#endregion
#endregion
#region MonoBehavior
private void OnEnable()
{
CEventCenter.AddListener<string>(BeginDialog, OnStartDialogOnMessage);
}
private void OnDisable()
{
CEventCenter.RemoveListener<string>(BeginDialog,OnStartDialogOnMessage);
}
protected virtual void Update()
{
if(DialogInfoAssets.Count>0 && DialogInfoAssets[0].CanGoToNext())
CEventCenter.BroadMessage(Scripts.DialogSystem.CanGoNext);
}
#endregion
#region Public
public List<AbstractDialogInfoAsset> DialogInfoAssets=new List<AbstractDialogInfoAsset>();
public Func<bool> IfInteract => DialogInfoAssets[0].IfInteract;
/// <summary>
/// 根据名字开始某个对话
/// </summary>
/// <param name="name">对话资源名,这个名字需要是列表中的一个</param>
/// <param name="endCall">对话结束时的回调</param>
/// <param name="await">是否等待正在进行的对话结束</param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public Coroutine StartDialog(string name,Action endCall=null,bool await=false)
{
foreach (var asset in DialogInfoAssets)
{
if (asset && asset.name == name)
if (await)
return MainLoop.Instance.StartCoroutine(RunDialogAwait(asset, endCall));
else
return MainLoop.Instance.StartCoroutine(RunDialog(asset,endCall));
}
throw new Exception("对话资源名字不对:" + name);
}
/// <summary>
/// 根据Index开启某个对话
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public Coroutine StartDialog(int index,Action endCall=null,bool await=false)
{
if (index >= DialogInfoAssets.Count)
throw new Exception("StartDialog超出索引范围:index:" + index);
if (await)
return MainLoop.Instance.StartCoroutine(RunDialogAwait(DialogInfoAssets[index], endCall));
else
return MainLoop.Instance.StartCoroutine(RunDialog(DialogInfoAssets[index],endCall));
}
/// <summary>
/// 顺次开启所有对话
/// </summary>
/// <returns></returns>
public Coroutine StartDialog(bool await=false)
{
return MainLoop.Instance.StartCoroutine(RunAllDialog(this,await));
}
/// <summary>
/// 获取列表所有对话资源名字
/// </summary>
/// <returns></returns>
public List<string> GetAssetNames()
{
var names = new List<string>();
foreach (var asset in DialogInfoAssets)
{
//print(asset.name);
if (asset == null)
continue;
names.Add(asset.name);
}
if (names.Count == 0)
print("没有对话资源");
return names;
}
#endregion
#region Native
private void OnStartDialogOnMessage(string assetName)
{
if (GetAssetNames().Contains(name))
StartDialog(name);
}
#endregion
}
} |
namespace System.Collections.Immutable
{
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Validation;
public static class ImmutableList
{
public static ImmutableList<T> Create<T>()
{
return ImmutableList<T>.Empty;
}
public static ImmutableList<T> Create<T>(T item)
{
return ImmutableList<T>.Empty.Add(item);
}
public static ImmutableList<T> Create<T>(params T[] items)
{
return ImmutableList<T>.Empty.AddRange(items);
}
public static ImmutableList<T>.Builder CreateBuilder<T>()
{
return Create<T>().ToBuilder();
}
public static ImmutableList<T> CreateRange<T>(IEnumerable<T> items)
{
return ImmutableList<T>.Empty.AddRange(items);
}
public static int IndexOf<T>(this IImmutableList<T> listV40, T item)
{
Requires.NotNull<IImmutableList<T>>(listV40, "listV40");
return listV40.IndexOf(item, 0, listV40.Count, (IEqualityComparer<T>) EqualityComparer<T>.Default);
}
public static int IndexOf<T>(this IImmutableList<T> listV40, T item, IEqualityComparer<T> equalityComparer)
{
Requires.NotNull<IImmutableList<T>>(listV40, "listV40");
return listV40.IndexOf(item, 0, listV40.Count, equalityComparer);
}
public static int IndexOf<T>(this IImmutableList<T> listV40, T item, int startIndex)
{
Requires.NotNull<IImmutableList<T>>(listV40, "listV40");
return listV40.IndexOf(item, startIndex, listV40.Count - startIndex, (IEqualityComparer<T>) EqualityComparer<T>.Default);
}
public static int IndexOf<T>(this IImmutableList<T> listV40, T item, int startIndex, int count)
{
Requires.NotNull<IImmutableList<T>>(listV40, "listV40");
return listV40.IndexOf(item, startIndex, count, (IEqualityComparer<T>) EqualityComparer<T>.Default);
}
public static int LastIndexOf<T>(this IImmutableList<T> listV40, T item)
{
Requires.NotNull<IImmutableList<T>>(listV40, "listV40");
if (listV40.Count == 0)
{
return -1;
}
return listV40.LastIndexOf(item, listV40.Count - 1, listV40.Count, (IEqualityComparer<T>) EqualityComparer<T>.Default);
}
public static int LastIndexOf<T>(this IImmutableList<T> listV40, T item, IEqualityComparer<T> equalityComparer)
{
Requires.NotNull<IImmutableList<T>>(listV40, "listV40");
if (listV40.Count == 0)
{
return -1;
}
return listV40.LastIndexOf(item, listV40.Count - 1, listV40.Count, equalityComparer);
}
public static int LastIndexOf<T>(this IImmutableList<T> listV40, T item, int startIndex)
{
Requires.NotNull<IImmutableList<T>>(listV40, "listV40");
if ((listV40.Count == 0) && (startIndex == 0))
{
return -1;
}
return listV40.LastIndexOf(item, startIndex, startIndex + 1, (IEqualityComparer<T>) EqualityComparer<T>.Default);
}
public static int LastIndexOf<T>(this IImmutableList<T> listV40, T item, int startIndex, int count)
{
Requires.NotNull<IImmutableList<T>>(listV40, "listV40");
return listV40.LastIndexOf(item, startIndex, count, (IEqualityComparer<T>) EqualityComparer<T>.Default);
}
public static IImmutableList<T> Remove<T>(this IImmutableList<T> listV40, T value)
{
Requires.NotNull<IImmutableList<T>>(listV40, "listV40");
return listV40.Remove(value, (IEqualityComparer<T>) EqualityComparer<T>.Default);
}
public static IImmutableList<T> RemoveRange<T>(this IImmutableList<T> listV40, IEnumerable<T> items)
{
Requires.NotNull<IImmutableList<T>>(listV40, "listV40");
return listV40.RemoveRange(items, (IEqualityComparer<T>) EqualityComparer<T>.Default);
}
public static IImmutableList<T> Replace<T>(this IImmutableList<T> listV40, T oldValue, T newValue)
{
Requires.NotNull<IImmutableList<T>>(listV40, "listV40");
return listV40.Replace(oldValue, newValue, (IEqualityComparer<T>) EqualityComparer<T>.Default);
}
public static ImmutableList<TSource> ToImmutableList<TSource>(this IEnumerable<TSource> source)
{
ImmutableList<TSource> listV40 = source as ImmutableList<TSource>;
if (listV40 != null)
{
return listV40;
}
return ImmutableList<TSource>.Empty.AddRange(source);
}
}
}
|
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows.Input;
using AddressBook.Annotations;
using AddressBook.Models;
using AddressBook.Services;
using Xamarin.Forms;
namespace AddressBook.ViewModels
{
public class ContactInfoViewModel : INotifyPropertyChanged
{
public enum ToolBarStates
{
Save = 0,
Edit = 1
}
private readonly IContactService _contactService = new ContactService();
private readonly ContactViewModel _contactViewModel;
private readonly INavigation _navigation;
private readonly string[] ToolBarValue = {"Save", "Edit"};
private string _errorLabel;
private bool _isEnabled;
private ToolBarStates _toolBarStates;
private string _toolBarText;
private bool isValidData;
public ContactInfoViewModel(INavigation navigation, int userId = 0)
{
_navigation = navigation;
EditSaveContactCommand = new Command(EditSaveContact);
//Проверяет какой тулбар item будет на странице Save\Edit
if (userId == 0)
{
SetToolBarState(ToolBarStates.Save);
IsEnabled = true;
_contactViewModel = new ContactViewModel();
}
else
{
SetToolBarState(ToolBarStates.Edit);
IsEnabled = false;
_contactViewModel = (ContactViewModel) _contactService.GetContactById(userId);
}
}
public ICommand EditSaveContactCommand { get; }
public ToolBarStates ToolBarState
{
get { return _toolBarStates; }
set
{
if (value == _toolBarStates) return;
_toolBarStates = value;
OnPropertyChanged();
}
}
public string ToolBarText
{
get { return _toolBarText; }
set
{
if (value == _toolBarText) return;
_toolBarText = value;
OnPropertyChanged();
}
}
public bool IsEnabled
{
get { return _isEnabled; }
set
{
if (value == _isEnabled) return;
_isEnabled = value;
OnPropertyChanged();
}
}
public int Id
{
get { return _contactViewModel.Id; }
set
{
if (value == _contactViewModel.Id) return;
_contactViewModel.Id = value;
OnPropertyChanged();
}
}
public string FirstName
{
get { return _contactViewModel.FirstName; }
set
{
if (value == _contactViewModel.FirstName) return;
_contactViewModel.FirstName = value;
OnPropertyChanged();
}
}
public string SecondName
{
get { return _contactViewModel.SecondName; }
set
{
if (value == _contactViewModel.SecondName) return;
_contactViewModel.SecondName = value;
OnPropertyChanged();
}
}
public string PhoneNumber
{
get { return _contactViewModel.PhoneNumber; }
set
{
if (value == _contactViewModel.PhoneNumber) return;
_contactViewModel.PhoneNumber = value;
OnPropertyChanged();
}
}
public string AdditionalPhoneNumber
{
get { return _contactViewModel.AdditionalPhoneNumber; }
set
{
if (value == _contactViewModel.AdditionalPhoneNumber) return;
_contactViewModel.AdditionalPhoneNumber = value;
OnPropertyChanged();
}
}
public string City
{
get { return _contactViewModel.City; }
set
{
if (value == _contactViewModel.City) return;
_contactViewModel.City = value;
OnPropertyChanged();
}
}
public string ErrorLabel
{
get { return _errorLabel; }
set
{
if (value == _errorLabel) return;
_errorLabel = value;
OnPropertyChanged();
}
}
public event PropertyChangedEventHandler PropertyChanged;
private async void SetToolBarState(ToolBarStates toolBarState)
{
//Set tool bar item state Save or Edit
ToolBarState = toolBarState;
//Bug with Toolbar. Text isn't updated. It's look likes Xamarin issue.
ToolBarText = ToolBarValue[(int) ToolBarState];
}
private async void SaveNewContact()
{
isValidData = true;
ErrorLabel = "";
if (FirstName.Trim() == "")
{
ErrorLabel += "\nFirst Name is required";
isValidData = false;
}
if (SecondName.Trim() == "")
{
ErrorLabel += "\nSecond Name is required";
isValidData = false;
}
if (PhoneNumber.Trim() == "")
{
ErrorLabel += "\nPhone Number is required";
isValidData = false;
}
if (isValidData)
{
var cm = new ContactModel
{
Id = Id,
FirstName = FirstName,
SecondName = SecondName,
PhoneNumber = PhoneNumber,
AdditionalPhoneNumber = AdditionalPhoneNumber,
City = City
};
if (Id == 0)
{
_contactService.Add(cm);
}
else
{
_contactService.Edit(cm);
}
await _navigation.PopAsync();
}
}
private void EditSaveContact(object obj)
{
if (ToolBarState == ToolBarStates.Save)
SaveNewContact();
else
{
IsEnabled = true;
SetToolBarState(ToolBarStates.Save);
}
}
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Common;
using Microsoft.Practices.EnterpriseLibrary.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using Operation.Contract;
namespace Operation.DataFactory
{
public class CustomerLoginDAL
{
private Database db;
private DbTransaction currentTransaction = null;
private DbConnection connection = null;
/// <summary>
/// Constructor
/// </summary>
public CustomerLoginDAL()
{
db = DatabaseFactory.CreateDatabase("LogiCon");
}
#region IDataFactory Members
public List<CustomerLogin> GetList()
{
return db.ExecuteSprocAccessor(DBRoutine.LISTCUSTOMERLOGIN, MapBuilder<CustomerLogin>.BuildAllProperties()).ToList();
}
public bool Save<T>(T item, DbTransaction parentTransaction) where T : IContract
{
currentTransaction = parentTransaction;
return Save(item);
}
public bool Save<T>(T item) where T : IContract
{
var result = 0;
var customerlogin = (CustomerLogin)(object)item;
if (currentTransaction == null)
{
connection = db.CreateConnection();
connection.Open();
}
var transaction = (currentTransaction == null ? connection.BeginTransaction() : currentTransaction);
try
{
var savecommand = db.GetStoredProcCommand(DBRoutine.SAVECUSTOMERLOGIN);
db.AddInParameter(savecommand, "TokenNo", System.Data.DbType.String, customerlogin.TokenNo);
db.AddInParameter(savecommand, "MobileNo", System.Data.DbType.String, customerlogin.MobileNo);
result = db.ExecuteNonQuery(savecommand, transaction);
if (currentTransaction == null)
transaction.Commit();
}
catch (Exception)
{
if (currentTransaction == null)
transaction.Rollback();
throw;
}
return (result > 0 ? true : false);
}
public bool Delete<T>(T item) where T : IContract
{
var result = false;
var customerlogin = (CustomerLogin)(object)item;
var connnection = db.CreateConnection();
connnection.Open();
var transaction = connnection.BeginTransaction();
try
{
var deleteCommand = db.GetStoredProcCommand(DBRoutine.DELETECUSTOMERLOGIN);
db.AddInParameter(deleteCommand, "TokenNo", System.Data.DbType.String, customerlogin.TokenNo);
result = Convert.ToBoolean(db.ExecuteNonQuery(deleteCommand, transaction));
transaction.Commit();
}
catch (Exception ex)
{
transaction.Rollback();
throw ex;
}
return result;
}
public IContract GetItem<T>(IContract lookupItem) where T : IContract
{
var item = ((CustomerLogin)lookupItem);
var customerloginItem = db.ExecuteSprocAccessor(DBRoutine.SELECTCUSTOMERLOGIN,
MapBuilder<CustomerLogin>.BuildAllProperties(),
item.TokenNo).FirstOrDefault();
if (customerloginItem == null) return null;
return customerloginItem;
}
#endregion
}
}
|
//
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
using DotNetNuke.Entities.Users;
namespace DotNetNuke.Services.Social.Messaging
{
/// <summary>
/// This class is responsible to manage the Messaging User Preference
/// </summary>
public interface IUserPreferencesController
{
/// <summary>
/// Set the User Messaging Preference
/// </summary>
/// <param name="userPreference">User Preference</param>
void SetUserPreference(UserPreference userPreference);
/// <summary>
/// Get the User Messaging Preference
/// </summary>
/// <param name="userinfo">User info</param>
/// <returns>User Messaging Preference</returns>
UserPreference GetUserPreference(UserInfo userinfo);
}
}
|
///07.Using delegates write a class Timer that has can execute certain method at each t seconds.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SubstringExtensionMethod
{
//Delegete
public delegate void TimerDelegate();
public class Time
{
//Print the current time
public static void ShowTime()
{
Console.WriteLine("Hello, the time is {0}",DateTime.Now.ToLongTimeString());
}
//Print day of week
public static void ShowDayOfWeek()
{
Console.WriteLine("Today is {0} !", DateTime.Now.DayOfWeek);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace PheonixRt.DataContracts
{
/// <summary>
///
/// </summary>
[DataContract]
public class UniformImageVolumeDataContract : IUniformImageVolume
{
public UniformImageVolumeDataContract()
{
Identity = new VolumeIdentity();
}
#region Volume Identification
/// <summary>
/// Volume identity
/// </summary>
[DataMember]
public VolumeIdentity Identity
{
get;
set;
}
#endregion Volume Identification
#region Volume Geometry
/// <summary>
///
/// </summary>
[DataMember]
public string FrameOfReferenceUID
{
get;
set;
}
/// <summary>
///
/// </summary>
[DataMember]
public VoxelSize VoxelSpacing
{
get;
set;
}
/// <summary>
///
/// </summary>
[DataMember]
public ImagePosition ImagePosition
{
get;
set;
}
/// <summary>
///
/// </summary>
[DataMember]
public VolumeOrientation VolumeOrientation
{
get;
set;
}
/// <summary>
///
/// </summary>
[DataMember]
public ImagePosition Isocenter
{
get;
set;
}
#endregion Volume Geometry
#region Voxel Access
/// <summary>
///
/// </summary>
[DataMember]
public int Width
{
get;
set;
}
/// <summary>
///
/// </summary>
[DataMember]
public int Height
{
get;
set;
}
/// <summary>
///
/// </summary>
[DataMember]
public int Depth
{
get;
set;
}
/// <summary>
///
/// </summary>
[DataMember]
public SharedBuffer PixelBuffer
{
get;
set;
}
#endregion Voxel Access
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BlogProject.Models;
using BlogProject.Repositories;
using Microsoft.AspNetCore.Mvc;
namespace BlogProject.Controllers
{
public class PostTagController : Controller
{
IRepository<PostTag> posttagRepo;
public PostTagController(IRepository<PostTag> posttagRepo)
{
this.posttagRepo = posttagRepo;
}
[HttpGet]
public ViewResult CreateByPostId(int id)
{
ViewBag.PostId = id;
return View();
}
[HttpPost]
public ActionResult Create(PostTag posttag)
{
posttagRepo.Create(posttag);
return RedirectToAction("Details", "Post", new { id = posttag.PostId });
}
}
}
|
using System;
using System.Collections.Generic;
using System.Reflection;
using Autofac;
using NUnit.Framework;
namespace AdvancedIoCTechniques
{
public class ServiceLocatorPattern
{
public class Blog2
{
public void Save(Post post)
{
var repo = ServiceLocator.Resolve<IRepository<Post>>();
repo.Save(post);
}
}
// this is a simple solution, but it is not
// without its problems, let's have a look...
[Test]
public void Why_Is_It_So_Bad()
{
// let's try testing this thing
var blog = new Blog2();
ServiceLocator.Register<IRepository<Post>>(
() => new InMemoryRepository<Post>());
blog.Save(new Post());
}
public class Blog3
{
public void Save(Post post)
{
var repo = ServiceLocator.Resolve<IRepository<Post>>();
repo.Save(post);
var stat = ServiceLocator.Resolve<IStat>();
stat.Increment(MethodBase.GetCurrentMethod().Name);
}
}
[Test]
public void It_Can_Only_Get_Worse()
{
var blog = new Blog3();
var post = new Post();
ServiceLocator.Register<IRepository<Post>>(
() => new InMemoryRepository<Post>());
ServiceLocator.Register<IRepository<Post>>(
() => new InMemoryRepository<Post>());
blog.Save(post);
}
#region helper
public interface IStat
{
void Increment(string name);
}
public static class ServiceLocator
{
private static readonly Dictionary<Type, Delegate> resolvers = new Dictionary<Type, Delegate>();
public static void Register<T>(Func<T> resolver)
{
resolvers[typeof(T)] = resolver;
}
public static T Resolve<T>()
{
Delegate func;
if (resolvers.TryGetValue(typeof(T), out func))
{
return ((Func<T>)func)();
}
throw new InvalidOperationException(string.Format("{0} has not been registered.", typeof(T)));
}
}
#endregion
}
} |
using ProConstructionsManagment.Desktop.Commands;
using ProConstructionsManagment.Desktop.Enums;
using ProConstructionsManagment.Desktop.Managers;
using ProConstructionsManagment.Desktop.Messages;
using ProConstructionsManagment.Desktop.Services;
using ProConstructionsManagment.Desktop.Views.Base;
using Serilog;
using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
namespace ProConstructionsManagment.Desktop.Views.AddEmployeesToProjectRecruitment
{
public class AddEmployeesToProjectRecruitmentViewModel : ViewModelBase
{
private readonly IEmployeesService _employeesService;
private readonly IShellManager _shellManager;
private readonly IMessengerService _messengerService;
private string _projectId;
private string _positionId;
private string _projectRecruitmentId;
private ObservableCollection<Models.Employee> _employeesWithPositionAbleToRecruit;
private bool _addEmployee;
public AddEmployeesToProjectRecruitmentViewModel(IEmployeesService employeesService, IShellManager shellManager, IMessengerService messengerService)
{
_employeesService = employeesService;
_shellManager = shellManager;
_messengerService = messengerService;
messengerService.Register<PositionIdMessage>(this, msg => PositionId = msg.PositionId);
messengerService.Register<ProjectIdMessage>(this, msg => ProjectId = msg.ProjectId);
messengerService.Register<ProjectRecruitmentIdMessage>(this, msg => ProjectRecruitmentId = msg.ProjectRecruitmentId);
}
public string ProjectId
{
get => _projectId;
set => Set(ref _projectId, value);
}
public string PositionId
{
get => _positionId;
set => Set(ref _positionId, value);
}
public ObservableCollection<Models.Employee> EmployeesWithPositionAbleToRecruit
{
get => _employeesWithPositionAbleToRecruit;
set => Set(ref _employeesWithPositionAbleToRecruit, value);
}
public string ProjectRecruitmentId
{
get => _projectRecruitmentId;
set => Set(ref _projectRecruitmentId, value);
}
public bool AddEmployee
{
get => _addEmployee;
set => Set(ref _addEmployee, value);
}
public async Task Initialize()
{
EmployeesWithPositionAbleToRecruit = await _employeesService.GetAllEmployeesByPositionAbleToRecruit(PositionId);
}
private bool MessageShownAlready { get; set; }
public ICommand RecruitEmployeesCommand => new AsyncRelayCommand(RecruitEmployees);
public async Task RecruitEmployees()
{
try
{
var employeesToRecruit = EmployeesWithPositionAbleToRecruit.Where(x => x.IsChecked).ToList();
if (employeesToRecruit.Count > 0)
{
var messageBoxResult = MessageBox.Show("Czy jesteś pewien/pewna że chcesz dodać tych pracowników do tej rekrutacji?", "", MessageBoxButton.YesNo);
switch (messageBoxResult)
{
case MessageBoxResult.Yes:
_shellManager.SetLoadingData(true);
foreach (var employeeToRecruit in employeesToRecruit)
{
var data = new Models.Employee
{
Id = employeeToRecruit.Id,
PositionId = employeeToRecruit.PositionId,
ProjectId = ProjectId,
Name = employeeToRecruit.Name,
SecondName = employeeToRecruit.SecondName,
LastName = employeeToRecruit.LastName,
DateOfBirth = employeeToRecruit.DateOfBirth,
Nationality = employeeToRecruit.Nationality,
IsForeman = employeeToRecruit.IsForeman,
ReadDrawings = employeeToRecruit.ReadDrawings,
Status = employeeToRecruit.Status
};
var result = _employeesService.UpdateEmployee(data, employeeToRecruit.Id);
if (result.IsSuccessful)
{
if (employeesToRecruit.IndexOf(employeeToRecruit) == employeesToRecruit.Count - 1)
{
Log.Information($"Successfully updated employee ({data.Id})");
MessageBox.Show("Pomyślnie dodano pracowników do rekrutacji");
_shellManager.SetLoadingData(false);
_messengerService.Send(new ChangeViewMessage(ViewTypes.ProjectRecruitment));
_messengerService.Send(new ProjectIdMessage(ProjectId));
_messengerService.Send(new ProjectRecruitmentIdMessage(ProjectRecruitmentId));
}
}
}
break;
case MessageBoxResult.No:
return;
}
}
else
{
MessageBox.Show("Nie podano żadnych pracowników do dodania.");
}
}
catch (Exception e)
{
Log.Error(e, "Failed updating employee");
MessageBox.Show(
"Coś poszło nie tak podczas zapisywania zmian, proszę spróbować jeszcze raz. Jeśli problem nadal występuje, skontakuj się z administratorem oprogramowania");
}
}
}
} |
namespace LiskovSubstitutionSquareBefore
{
public abstract class Shape
{
public abstract decimal Area { get; }
}
} |
using System;
namespace OmniSharp.Extensions.LanguageServer.Protocol
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class AssemblyCapabilityKeyAttribute : Attribute
{
public Type CapabilityType { get; }
public string CapabilityKey { get; }
public AssemblyCapabilityKeyAttribute(Type capabilityType, params string[] keys)
{
CapabilityType = capabilityType;
CapabilityKey = string.Join(".", keys);
}
}
}
|
namespace Game.Online.API.Responses
{
public class APIResponse
{
public void Extract()
{
}
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PmSoft
{
/// <summary>
/// 时间格式化转换
/// </summary>
public static class DateTimeExtensions
{
/// <summary>
/// 获取时期天起始时间
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static DateTime GetDayBeginTime(this DateTime? dateTime)
{
if (!dateTime.HasValue)
return DateTime.Now.Date;
return GetDayBeginTime(dateTime.Value);
}
/// <summary>
/// 获取时期天起始时间
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static DateTime GetDayBeginTime(this DateTime dateTime)
{
return dateTime.Date;
}
/// <summary>
/// 获取时期天的结束时间
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static DateTime GetDayEndTime(this DateTime? dateTime)
{
if (!dateTime.HasValue)
return DateTime.Now;
return GetDayEndTime(dateTime.Value);
}
/// <summary>
/// 获取时期天的结束时间
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static DateTime GetDayEndTime(this DateTime dateTime)
{
return new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, 23, 59, 59);
}
/// <summary>
/// 与当前时间差值(分钟)
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static int WithDiffMinutes(this DateTime? dateTime)
{
if (!dateTime.HasValue)
return 0;
return WithDiffMinutes(dateTime.Value);
}
/// <summary>
/// 与当前时间差值(分钟)
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static int WithDiffMinutes(this DateTime dateTime)
{
if (dateTime == null) return 0;
TimeSpan ts1 = new TimeSpan(dateTime.Ticks);
TimeSpan ts2 = new TimeSpan(DateTime.Now.Ticks);
TimeSpan ts = ts1.Subtract(ts2).Duration();
return (int)ts.TotalMinutes;
}
/// <summary>
/// 转换到剩余时间
/// </summary>
/// <param name="deadline"></param>
/// <returns></returns>
public static string ToTimeLeft(this DateTime? deadline)
{
if (!deadline.HasValue) return "N/A";
return (deadline.Value).ToTimeLeft();
}
/// <summary>
/// 转换到剩余时间
/// </summary>
/// <param name="deadline"></param>
/// <returns></returns>
public static string ToTimeLeft(this DateTime deadline)
{
if (deadline == null) return "N/A";
int totalSeconds = (int)deadline.Subtract(DateTime.Now).TotalSeconds;
TimeSpan ts = new TimeSpan(0, 0, totalSeconds);
if (ts.Days > 0)
{
return ts.Days.ToString() + "天";
}
if (ts.Days == 0 && ts.Hours > 0)
{
return ts.Hours.ToString() + "小时 ";
}
if (ts.Days == 0 && ts.Hours == 0 && ts.Minutes > 0)
{
return ts.Minutes.ToString() + "分钟 ";
}
return "N/A";
}
/// <summary>
/// 格式化为(月/日)
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static string ToMonthDayFormat(this DateTime? dateTime)
{
if (dateTime.HasValue)
return dateTime.Value.ToMonthDayFormat();
else
return "N/A";
}
/// <summary>
/// 格式化为(月/日)
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static string ToMonthDayFormat(this DateTime dateTime)
{
return dateTime.ToString("MM/dd");
}
/// <summary>
/// 标准格式(yyyy-MM-dd hh:mm:ss)
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static string ToStandardFormat(this DateTime? dateTime)
{
if (dateTime.HasValue)
return dateTime.Value.ToStandardFormat();
else
return "N/A";
}
/// <summary>
/// 标准格式(yyyy-MM-dd hh:mm:ss)
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static string ToStandardFormat(this DateTime dateTime)
{
return dateTime.ToString("yyyy-M-dd HH:mm");
}
/// <summary>
/// 转换为日期
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static string ToDateFormat(this DateTime dateTime)
{
return dateTime.ToString("yyyy-MM-dd");
}
/// <summary>
/// 智能时间提示(yyyy-MM-dd hh:mm 和 刚刚)
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static string ToSmartFormat(this DateTime? dateTime)
{
if (dateTime.HasValue)
return dateTime.Value.ToSmartFormat();
else
return "N/A";
}
/// <summary>
/// 智能时间提示(yyyy-MM-dd hh:mm 和 刚刚)
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static string ToSmartFormat(this DateTime dateTime)
{
string strTime = "";
DateTime date1 = DateTime.Now;
DateTime date2 = dateTime;
TimeSpan dt = date1 - date2;
// 相差天数
int days = dt.Days;
// 时间点相差小时数
int hours = dt.Hours;
// 相差总小时数
double Minutes = dt.Minutes;
// 相差总秒数
int second = dt.Seconds;
if (days == 0 && hours == 0 && Minutes == 0)
{
strTime = "刚刚";
}
else if (days == 0 && hours == 0)
{
strTime = Minutes + "分钟前";
}
else if (days == 0)
{
strTime = hours + "小时前";
}
else
{
strTime = dateTime.ToString("yyyy-M-dd HH:mm");
}
return strTime;
}
/// <summary>
/// 转换为时期数字格式(例如:20180324)
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static int ToDateNumber(this DateTime dateTime)
{
return dateTime.Year * 10000 + dateTime.Month * 100 + dateTime.Day;
}
}
}
|
using UnityEngine;
public class MapResources {
public GameObject CastlePrefab;
public GameObject HeroPrefab;
public GameObject EventAlertPrefab;
public GameObject GenericAlertPrefab;
public GameObject VillagePrefab;
public MapResources() {
LoadInitialAssets();
}
public void LoadInitialAssets() {
CastlePrefab = (GameObject)Resources.Load("MapObjects/Castle_prefab");
HeroPrefab = (GameObject)Resources.Load("MapObjects/Hero_prefab");
EventAlertPrefab = (GameObject)Resources.Load("MapObjects/Alert_prefab");
GenericAlertPrefab = (GameObject)Resources.Load("MapObjects/GenericAlert_prefab");
VillagePrefab = (GameObject)Resources.Load("MapObject/Village_prefab");
}
} |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ButterflyController : Entity
{
public float speedMax = 3f;
public float acceleration = 1f;
public float deceleration = 1f;
public float speedCurrent = 0f;
int deadZoneXPositive; //TODO move this to KeyboardController
int deadZoneXNegative; //TODO move this to KeyboardController
int deadZoneYPositive; //TODO move this to KeyboardController
int deadZoneYNegative; //TODO move this to KeyboardController
int displayAspectRatio; //TODO move this to KeyboardController
public float rollSpeedMax = 100; //Maximum roll speed
public float rollSpeedCurrent = 0f; //current roll speed
public float rollAcceleration = 200f; //rate of accelleration
public float rollDeceleration = 400f; //rate of deceleration
public float yawSensitivity = 0.5f;
public float yawSpeed = 200; //Controller only
public Camera mainCamera;
//public Animator animator;
// Start is called before the first frame update
void Start()
{
calcAspectRatio();
calcDeadZones();
init();
}
// Update is called once per frame
void Update()
{
checkInput();
roll();
autoAnimSpeed();
}
public override void init()
{
base.init();
}
void checkInput()
{
transform.Translate(Vector3.forward * Time.deltaTime * speedCurrent);
if (Input.GetMouseButton(1))
{
followMouse();
}
if(Input.GetKey(KeyCode.W))
{
speedUp();
}
else
{
slowDown();
}
if(Input.GetKey(KeyCode.Q))
{
rollLeft();
}
else if(Input.GetKey(KeyCode.E))
{
rollRight();
}
else
{
rollIdle();
}
}
void autoAnimSpeed()
{
if(speedCurrent > 1 && animator.speed < 3)
{
animator.speed = 3;
}
else if (speedCurrent < 1)
{
animator.speed = 2;
}
}
void calcAspectRatio()
{
if (mainCamera != null)
{
displayAspectRatio = (int)mainCamera.aspect * Screen.width / Screen.height;
}
}
void calcDeadZones()
{
deadZoneXPositive = Screen.width / 2 + (Screen.width /2) / 10;
deadZoneXNegative = Screen.width / 2 - (Screen.width / 2) / 10;
deadZoneYPositive = Screen.height / 2 + (Screen.width / 2) / 10;
deadZoneYNegative = Screen.height / 2 - (Screen.width / 2) / 10;
}
public void followMouse()
{
if (Input.mousePosition.x < deadZoneXNegative)
{
float mouseMidDistance = Screen.width /2 - Input.mousePosition.x;
float smoothFactor = mouseMidDistance / Screen.width;
//Debug.Log(smoothFactor + "= " + mouseMidDistance + "/" + screenWidthHalf);
yawLeft(smoothFactor);
}
else if (Input.mousePosition.x > deadZoneXPositive)
{
float mouseMidDistance = Screen.width / 2 - Input.mousePosition.x;
float smoothFactor = mouseMidDistance / Screen.width;
//Debug.Log(-smoothFactor + "= " + mouseMidDistance + "/" + screenWidthHalf);
yawRight(-smoothFactor);
}
if (Input.mousePosition.y < deadZoneYNegative)
{
float mouseMidDistance = Screen.height /2 - Input.mousePosition.y;
float smoothFactor = mouseMidDistance / Screen.height;
//Debug.Log(smoothFactor + "= " + mouseMidDistance + "/" + screenWidthHalf);
yawDown(smoothFactor);
}
else if (Input.mousePosition.y > deadZoneYPositive)
{
float mouseMidDistance = Screen.height /2 - Input.mousePosition.y;
float smoothFactor = mouseMidDistance / Screen.height;
//Debug.Log(-smoothFactor + "= " + mouseMidDistance + "/" + screenWidthHalf);
yawUp(-smoothFactor);
}
}
public void yawDown(float factor)
{
transform.Rotate(Vector3.right, yawSpeed * factor * yawSensitivity * Time.deltaTime);
}
public void yawUp(float factor)
{
transform.Rotate(-Vector3.right, yawSpeed * factor * yawSensitivity * Time.deltaTime);
}
public void yawLeft(float factor)
{
transform.Rotate(-Vector3.up, yawSpeed * factor * yawSensitivity * Time.deltaTime);
}
public void yawRight(float factor)
{
transform.Rotate(Vector3.up, yawSpeed * factor * yawSensitivity * Time.deltaTime);
}
public void roll()
{
if(!Math.valueIsBetween(rollSpeedCurrent,-10f,10f))
{
transform.Rotate(Vector3.forward, rollSpeedCurrent * Time.deltaTime);
}
Rigidbody rb = GetComponent<Rigidbody>();
if (rb != null && (rb.velocity != Vector3.zero || rb.angularVelocity != Vector3.zero))
{
rb.velocity = Vector3.zero;
rb.angularVelocity = Vector3.zero;
Debug.Log("zeroing Vel");
}
}
public void rollRight()
{
if (rollSpeedCurrent > -rollSpeedMax)
{
rollSpeedCurrent -= Time.deltaTime * rollAcceleration;
}
}
public void rollLeft()
{
if (rollSpeedCurrent < rollSpeedMax)
{
rollSpeedCurrent += Time.deltaTime * rollAcceleration;
}
}
public void rollIdle()
{
if (rollSpeedCurrent > 0 && rollSpeedCurrent > 0.01f)
{
rollSpeedCurrent -= Time.deltaTime * rollDeceleration;
}
else if (rollSpeedCurrent < 0 && rollSpeedCurrent < -0.01f)
{
rollSpeedCurrent += Time.deltaTime * rollDeceleration;
}
}
public void speedUp()
{
if (speedCurrent < speedMax)
{
speedCurrent += 1 * Time.deltaTime * acceleration;
}
}
public void slowDown()
{
if (speedCurrent > 0)
{
speedCurrent -= 1 * Time.deltaTime * deceleration;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Zelo.Common.CustomAttributes;
namespace Zelo.DBModel
{
[Table(Name = "T_Medical_HisDetailPic")]
public class TMedicalHisDetailPic
{
[Id(Name = "Id", Strategy = GenerationType.INDENTITY)]
public int Id { get; set; }
[Column(Name = "Pic_Gid")]
public string PicGid { get; set; }
[Column(Name = "Detail_Gid")]
public string DetailGid { get; set; }
[Column(Name = "Pic_Url")]
public string PicUrl { get; set; }
[Column(Name = "CreateUser")]
public string CreateUser { get; set; }
[Column(Name = "CreateTime")]
public DateTime? CreateTime { get; set; }
[Column(Name = "UpdateTime")]
public DateTime? UpdateTime { get; set; }
[Column(Name = "status")]
public int? Status { get; set; }
}
} |
using EkwExplorer.Core.Models;
namespace EkwExplorer.Core;
public interface IBooksRepository
{
Task AddBookAsync(BookInfo bookInfo);
Task UpdateBookAsync(BookInfo bookInfo);
Task AddPropertyFromBookAsync(BookInfo bookInfo);
Task<bool> IsAnyNotFilled();
Task<BookInfo> GetRandomNotFilledBookAsync();
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WeaponPage : Page_Base {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
protected override void OnClose(){
print ("WeaponPage關閉");
}
protected override void OnOpen(){
print ("WeaponPage開啟");
}
}
|
using Net.Buffers;
using Net.Sockets.Pipeline.Handler;
using Net.Sockets.Pipeline.Handler.Incoming;
using Net.Sockets.Pipeline.Handler.Outgoing;
using PlatformRacing3.Server.Game.Client;
using PlatformRacing3.Server.Game.Communication.Managers;
using PlatformRacing3.Server.Game.Communication.Messages;
namespace PlatformRacing3.Server.Game.Communication.Handlers;
internal sealed class SplitPacketHandler : IncomingBytesHandler, IOutgoingObjectHandler
{
private readonly BytePacketManager bytePacketManager;
private ushort CurrentPacketLength;
private ClientSession Session;
internal SplitPacketHandler(BytePacketManager bytePacketManager, ClientSession session)
{
this.bytePacketManager = bytePacketManager;
this.Session = session;
}
protected override void Decode(IPipelineHandlerContext context, ref PacketReader reader)
{
//We haven't read the next packet length, wait for it
if (this.CurrentPacketLength == 0 && !reader.TryReadUInt16(out this.CurrentPacketLength))
{
return;
}
if (reader.Remaining < this.CurrentPacketLength)
{
return;
}
PacketReader readerSliced = reader.Slice(this.CurrentPacketLength);
this.Read(context, ref readerSliced);
this.CurrentPacketLength = 0;
}
public void Read(IPipelineHandlerContext context, ref PacketReader reader)
{
ushort header = reader.ReadUInt16();
this.bytePacketManager.HandleIncomingData(header, this.Session, context, ref reader);
if (reader.Remaining > 0)
{
reader.Skip(reader.Remaining); //Skip extra bytes and head to the next packet
}
}
public void Handle<T>(IPipelineHandlerContext context, ref PacketWriter writer, in T packet)
{
if (packet is IMessageOutgoing message)
{
PacketWriter length = writer.ReservedFixedSlice(2);
int writerLength = writer.Length;
message.Write(ref writer);
ushort size = checked((ushort)(writer.Length - writerLength));
length.WriteUInt16(size);
}
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HomeWorkOnStructAndEnumeration_1
{
public enum Vacancies
{
Boss,
Manager,
Salesman,
Clerk,
Сourier,
Floorswasher
};
public struct Workers
{
public int[] _dateOfEmployment;
public string Worker { get; set; }
public double Salary { get; set; }
public Vacancies _Vacancies { get; set; }
public void InfoOnWorker()
{
Console.WriteLine("ФИО: " + Worker + "\n" +
"Занимаемая должность: " + _Vacancies + "\n" +
"Зароботная плата: " + Salary + "\n" +
"Дата принятия на работу: " + _dateOfEmployment[0] + "." + _dateOfEmployment[1] + "." + _dateOfEmployment[2] + "\n" +
"____________________________________________________");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ScriptMAQ
{
abstract class Component
{
public string Name { get; set; } = "Component";
public override string ToString()
{
return Name + "\n" + Description();
}
public abstract string Description();
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PNPUTools.DataManager;
using System.Data;
using PNPUTools;
namespace PNPUCore.Controle
{
/// <summary>
/// Cette classe permet de contrôler que tous les items présent dans les totaux livrés existent.
/// </summary>
class ControleItemsTotaux : PControle, IControle
{
private PNPUCore.Process.ProcessControlePacks Process;
private string ConnectionStringBaseRef;
/// <summary>
/// Constructeur de la classe.
/// </summary>
/// <param name="pProcess">Process qui a lancé le contrôle. Permet d'accéder aux méthodes et attributs publics de l'objet lançant le contrôle.</param>
public ControleItemsTotaux(PNPUCore.Process.IProcess pProcess)
{
Process = (PNPUCore.Process.ProcessControlePacks)pProcess;
ToolTipControle = "Vérifie que les éléments utilisés dans les totaux livrés existent";
LibControle = "Contrôle des totaux";
ConnectionStringBaseRef = ParamAppli.ConnectionStringBaseRef[Process.TYPOLOGY];
ResultatErreur = ParamAppli.StatutError;
}
/// <summary>
/// Constructeur de la classe.
/// </summary>
/// <param name="pProcess">Process qui a lancé le contrôle. Permet d'accéder aux méthodes et attributs publics de l'objet lançant le contrôle.</param>
/// <param name="drRow">Enregistrement contnenant les informations sur le contrôle</param>
public ControleItemsTotaux(PNPUCore.Process.IProcess pProcess, DataRow drRow)
{
Process = (PNPUCore.Process.ProcessControlePacks)pProcess;
LibControle = drRow[1].ToString();
ToolTipControle = drRow[6].ToString();
ResultatErreur = drRow[5].ToString();
ConnectionStringBaseRef = ParamAppli.ConnectionStringBaseRef[Process.TYPOLOGY];
}
/// <summary>
/// Méthode effectuant le contrôle.
/// <returns>Retourne un booléen, vrai si le contrôle est concluant et sinon faux.</returns>
/// </summary>
public string MakeControl()
{
string bResultat = ParamAppli.StatutOk;
string sPathMdb = Process.MDBCourant;
string sRequete;
List<string[]> lListeAControler = new List<string[]>();
bool bPremierElement = true;
string sItem;
DataSet dsDataSet;
string sListeItemsLivres = string.Empty;
DataManagerAccess dmaManagerAccess = null;
try
{
dmaManagerAccess = new DataManagerAccess();
// Recherche des items de paie livrés dans les packs du mdb
sRequete = "SELECT ID_OBJECT FROM M4RDL_PACK_CMDS WHERE ID_CLASS = 'ITEM' AND CMD_ACTIVE=-1 AND ID_OBJECT LIKE '%HR%CALC%' AND ID_OBJECT NOT LIKE '%DIF%'";
dsDataSet = dmaManagerAccess.GetData(sRequete, sPathMdb);
if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0))
{
foreach (DataRow drRow in dsDataSet.Tables[0].Rows)
{
if (sListeItemsLivres != string.Empty)
sListeItemsLivres += ",";
sListeItemsLivres += "'" + drRow[0].ToString() + "'";
}
}
sRequete = "select ID_TI, ID_ITEM, ID_ITEM_USED_TI, ID_ITEM_USED FROM M4RCH_TOTAL_REF A";
// On livre le total
sRequete += " WHERE (A.ID_TI+'.'+A.ID_ITEM IN (" + sListeItemsLivres + ")) ";
sRequete += " AND (A.ID_ITEM_USED_TI+'.'+ID_ITEM_USED NOT IN (" + sListeItemsLivres + ")) ";
// Et il existe des items du total qu'on ne livre pas
sRequete += " AND (EXISTS (SELECT * FROM M4RCH_TOTAL_REF C WHERE A.ID_TI=C.ID_TI AND A.ID_ITEM=C.ID_ITEM AND C.ID_ITEM_USED_TI+'.'+C.ID_ITEM_USED NOT IN (" + sListeItemsLivres + ")))";
dsDataSet = dmaManagerAccess.GetData(sRequete, sPathMdb);
if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0))
{
sRequete = "SELECT ID_TI + '.' + ID_ITEM FROM M4RCH_ITEMS WHERE ID_TI + '.' + ID_ITEM IN (";
// Recherche les items utilisés dans les totaux
foreach (DataRow drRow in dsDataSet.Tables[0].Rows)
{
sItem = drRow[2].ToString() + "." + drRow[3].ToString();
lListeAControler.Add(new string[] { sItem, drRow[0].ToString() + "." + drRow[1].ToString() });
if (bPremierElement == true)
bPremierElement = false;
else
sRequete += ",";
sRequete += "'" + sItem + "'";
}
sRequete += ")";
}
// Recherche des items sur la base de ref
if (lListeAControler.Count > 0)
{
DataManagerSQLServer dmsManagerSQL = new DataManagerSQLServer();
dsDataSet = dmsManagerSQL.GetData(sRequete, ConnectionStringBaseRef);
if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0))
{
foreach (DataRow drRow in dsDataSet.Tables[0].Rows)
{
for (int iCpt = 0; iCpt < lListeAControler.Count; iCpt++)
{
if (lListeAControler[iCpt][0] == drRow[0].ToString())
{
lListeAControler.RemoveAt(iCpt);
iCpt--;
}
}
}
}
if (lListeAControler.Count > 0)
{
bResultat = ResultatErreur;
foreach (string[] sElements in lListeAControler)
Process.AjouteRapport("Le total " + sElements[1] + " utilise un item inexistant (" + sElements[0] +").");
}
}
}
catch (Exception ex)
{
Logger.Log(Process, this, ParamAppli.StatutError, ex.Message);
bResultat = ParamAppli.StatutError;
}
return bResultat;
}
}
}
|
//
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
#region Usings
using System;
using System.Collections;
using System.Globalization;
using DotNetNuke.Entities.Users;
#endregion
namespace DotNetNuke.Services.Tokens
{
public class ArrayListPropertyAccess : IPropertyAccess
{
private readonly ArrayList custom;
public ArrayListPropertyAccess(ArrayList list)
{
custom = list;
}
#region IPropertyAccess Members
public string GetProperty(string propertyName, string format, CultureInfo formatProvider, UserInfo AccessingUser, Scope AccessLevel, ref bool PropertyNotFound)
{
if (custom == null)
{
return string.Empty;
}
object valueObject = null;
string OutputFormat = format;
if (string.IsNullOrEmpty(format))
{
OutputFormat = "g";
}
int intIndex = int.Parse(propertyName);
if ((custom != null) && custom.Count > intIndex)
{
valueObject = custom[intIndex].ToString();
}
if ((valueObject != null))
{
switch (valueObject.GetType().Name)
{
case "String":
return PropertyAccess.FormatString((string) valueObject, format);
case "Boolean":
return (PropertyAccess.Boolean2LocalizedYesNo((bool) valueObject, formatProvider));
case "DateTime":
case "Double":
case "Single":
case "Int32":
case "Int64":
return (((IFormattable) valueObject).ToString(OutputFormat, formatProvider));
default:
return PropertyAccess.FormatString(valueObject.ToString(), format);
}
}
else
{
PropertyNotFound = true;
return string.Empty;
}
}
public CacheLevel Cacheability
{
get
{
return CacheLevel.notCacheable;
}
}
#endregion
}
}
|
using Xamarin.Forms;
namespace Contoso.XPlatform.Behaviours
{
public class ErrorLabelValidationBehavior : BehaviorBase<Label>
{
public static readonly BindableProperty IsValidProperty = BindableProperty.Create
(
nameof(IsValid),
typeof(bool),
typeof(ErrorLabelValidationBehavior),
true,
BindingMode.Default,
null,
(bindable, oldValue, newValue) => OnIsValidChanged(bindable, newValue)
);
public static readonly BindableProperty IsDirtyProperty = BindableProperty.Create
(
nameof(IsDirty),
typeof(bool),
typeof(ErrorLabelValidationBehavior),
true,
BindingMode.Default,
null,
(bindable, oldValue, newValue) => OnIsDirtyChanged(bindable, newValue)
);
public bool IsValid
{
get => (bool)GetValue(IsValidProperty);
set => SetValue(IsValidProperty, value);
}
public bool IsDirty
{
get => (bool)GetValue(IsDirtyProperty);
set => SetValue(IsDirtyProperty, value);
}
private static void OnIsValidChanged(BindableObject bindable, object newValue)
{
if (bindable is ErrorLabelValidationBehavior isValidBehavior &&
newValue is bool isValid)
{
UpdatePlaceholderColor(isValidBehavior.IsDirty, isValid, isValidBehavior);
}
}
private static void OnIsDirtyChanged(BindableObject bindable, object newValue)
{
if (bindable is ErrorLabelValidationBehavior isValidBehavior &&
newValue is bool isDirty)
{
UpdatePlaceholderColor(isDirty, isValidBehavior.IsValid, isValidBehavior);
}
}
private static void UpdatePlaceholderColor(bool isDirty, bool isValid, ErrorLabelValidationBehavior isValidBehavior)
{
if (isValidBehavior.AssociatedObject == null)
return;
isValidBehavior.AssociatedObject.IsVisible = isDirty && !isValid;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace JobSearch.Models
{
public class Job
{
public int JobID { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public string Job_Number { get; set; }
public DateTime Date_Applied { get; set; }
public ICollection<Contact> Contacts { get; set; }
public ICollection<Note> Notes { get; set; }
}
}
|
using Kit.Enums;
namespace Kit.Services.Interfaces
{
public interface IScreenManager
{
public void SetScreenMode(ScreenMode ScreenMode);
}
}
|
using System;
using System.Collections.Generic;
namespace Microsoft.DataStudio.Services.MachineLearning.Contracts
{
public enum WebServiceCreationStatus
{
Pending,
Completed,
Failed
}
}
|
using Hotel.Data.Models;
using Microsoft.AspNetCore.Mvc.Rendering;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Hotel.Web.Areas.ModulAdministracija.ViewModels
{
public class PrikazSmjestajaVM
{
public List<Smjestaj> Smjestaji { set; get; }
public int ? BrojPretraga { set; get; }
public int StatusPretraga { set; get; }
public IEnumerable<SelectListItem> PretragaPoStatusu { get
{
List<SelectListItem> _stavke = new List<SelectListItem>();
_stavke.Add(new SelectListItem()
{
Value = null,
Text = "Sve"
});
_stavke.Add(new SelectListItem()
{
Value = 1.ToString(),
Text = "Slobodni"
});
_stavke.Add(new SelectListItem()
{
Value = 2.ToString(),
Text = "Zauzeti"
});
return _stavke;
} }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using PlayTennis.Bll;
using PlayTennis.Model;
using PlayTennis.Model.Dto;
using PlayTennis.Utility;
namespace PlayTennis.WebApi.Controllers
{
public class AppointmentController : ApiController
{
private static log4net.ILog _log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public AppointmentController()
{
AppointmentService = new AppointmentService();
UserLoginService = new UserLoginService();
ExercisePurposeService = new ExercisePurposeService();
}
public AppointmentService AppointmentService { get; set; }
public UserLoginService UserLoginService { get; set; }
public ExercisePurposeService ExercisePurposeService { get; set; }
// GET: api/Appointment
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET: api/Appointment/5
/// <summary>
/// 预约列表
/// </summary>
/// <param name="id">用户信息id</param>
/// <param name="type">0:发起;1:接收;2:完成【有问题】;3 进行的预约</param>
/// <returns></returns>
public IList<AppointmentResultDto> Get(Guid id, byte type)
{
return AppointmentService.AppointmentList(id, type);
}
// POST: api/Appointment
/// <summary>
/// 发起预约
/// </summary>
/// <param name="id">用户id</param>
/// <param name="appointment"></param>
public void Post(Guid id, AppointmentDto appointment)
{
AppointmentService.InitatorAppointment(id, appointment.inviteeId, appointment.exercisePurposeId);
_log.Info("formId:" + 1);
ExercisePurposeService.SaveWxFormId(id, appointment.formId);
var formId = ExercisePurposeService.GetFormIdByEntityId(appointment.inviteeId);
_log.Info("formId:" + 2 + "|" + formId + "|" + appointment.inviteeId);
if (!string.IsNullOrEmpty(formId))
{
_log.Info("formId:" + formId);
var exercise = ExercisePurposeService.GetPurposeByEntityId(appointment.exercisePurposeId);
SendWxMessage(appointment.inviteeId, exercise, formId);
}
}
/// <summary>
/// 发送微信模板消息
/// </summary>
/// <param name="inviteeId"></param>
/// <param name="exercise"></param>
/// <param name="formId"></param>
/// <param name="sendType">发送场景类型:1 发起预约;2 接受预约</param>
private void SendWxMessage(Guid inviteeId, ExercisePurpose exercise, string formId, byte sendType = 1)
{
if (exercise == null)
{
return;
}
var inviteeOpenid = UserLoginService.GetOpenidByUserid(inviteeId);
var data = new ListData();
//预约时间
var keyword2 = new MessageData()
{
value = exercise.StartTime.Value.ToString() + "至" + exercise.EndTime.Value.ToString(),
color = "#173177"
};
//姓名
var keyword1 = new MessageData() { value = inviteeOpenid.Item2, color = "#173177" };
MessageData keyword3 = null;
if (sendType == 1)
{
//备注
keyword3 = new MessageData() { value = exercise.ExerciseExplain, color = "#173177" };
}
else if (sendType == 2)
{
//备注
keyword3 = new MessageData() { value = "小伙伴接受你的预约了!", color = "#173177" };
}
data.keyword1 = keyword1;
data.keyword2 = keyword2;
data.keyword3 = keyword3;
_log.Info(inviteeOpenid);
HttpHelper.SendTemplateMessage(inviteeOpenid.Item1, formId, "", data);
}
// PUT: api/Appointment/5
/// <summary>
/// 更改预约状态
/// </summary>
/// <param name="id"></param>
/// <param name="appointment"></param>
public void Put(Guid id, AppointmentDto appointment)
{
ExercisePurposeService.SaveWxFormId(id, appointment.formId);
if (appointment.ActionType == 0)
{
AppointmentService.AcceptAppointment(id, appointment.appointmentId);
var formId = ExercisePurposeService.GetFormIdByEntityId(appointment.inviteeId);
_log.Info("put-formId:" + 2 + "|" + formId + "|" + appointment.inviteeId);
if (!string.IsNullOrEmpty(formId))
{
SendWxMessage(appointment.inviteeId, AppointmentService.GetPurposeByAppointmentId(appointment.appointmentId), formId, 2);
}
}
else if (appointment.ActionType == 1)
{
AppointmentService.RefuseAppointment(id, appointment.appointmentId, appointment.explain);
}
else if (appointment.ActionType == 2)
{
AppointmentService.FinishAppointment(id, appointment.appointmentId, appointment.comment);
}
}
// DELETE: api/Appointment/5
public void Delete(int id)
{
}
}
}
|
using System;
namespace ALTechTest.ParsingObjects.MusicBrainz
{
public class Medium
{
public string format { get; set; }
public Guid formatid { get; set; }
public int position { get; set; }
public string title { get; set; }
public int trackcount { get; set; }
}
} |
namespace ConsoleForum.Entities.Users
{
using System;
using System.Collections.Generic;
using ConsoleForum.Contracts;
public class Post : IPost
{
public int Id { get; set; }
public string Body { get; set; }
public IUser Author { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WebApiDAL.Entity;
using WebApiDAL.Model;
using WebApiDAL.ServiceManager;
namespace WebApiDAL.DataAccess
{
public class SeekerRepository : /*BaseRepository,*/ ISeeker
{
private WebphonixJobsDBEntities db = new WebphonixJobsDBEntities();
public Boolean BuildProfile(Tbl_SeekerProfile ProfileDetails, out string Ermsg)
{
Ermsg = "";
try
{
db.Tbl_SeekerProfile.Add(ProfileDetails);
db.SaveChanges();
return true;
}
catch (Exception ex)
{
Ermsg = ex.Message;
return false;
}
}
public Boolean UpdateProfile(Tbl_SeekerProfile ProfileDetails, out string Ermsg)
{
Ermsg = "";
try
{
db.Entry(ProfileDetails).State = EntityState.Modified;
db.SaveChanges();
return true;
}
catch (Exception ex)
{
Ermsg = ex.Message;
return false;
}
}
public Boolean AddEducation(Tbl_EducationDetails EduDetails, out string Ermsg)
{
Ermsg = "";
try
{
db.Tbl_EducationDetails.Add(EduDetails);
db.SaveChanges();
return true;
}
catch (Exception ex)
{
Ermsg = ex.Message;
return false;
}
}
public Boolean DeleteEducation(int EduID, out string ErMsg)
{
ErMsg = "";
try
{
Tbl_EducationDetails Edudetail = db.Tbl_EducationDetails.Find(EduID);
db.Tbl_EducationDetails.Remove(Edudetail);
db.SaveChanges();
return true;
}
catch (Exception ex)
{
ErMsg = ex.Message;
return false;
}
}
public Boolean AddExperience(Tbl_ExperienceDetails ExpDetails, out string Ermsg)
{
Ermsg = "";
try
{
db.Tbl_ExperienceDetails.Add(ExpDetails);
db.SaveChanges();
return true;
}
catch (Exception ex)
{
Ermsg = ex.Message;
return false;
}
}
public Boolean DeleteExperience(int ExpID, out string ErMsg)
{
ErMsg = "";
try
{
Tbl_ExperienceDetails Expdetail = db.Tbl_ExperienceDetails.Find(ExpID);
db.Tbl_ExperienceDetails.Remove(Expdetail);
db.SaveChanges();
return true;
}
catch (Exception ex)
{
ErMsg = ex.Message;
return false;
}
}
public Boolean UpdateEducation(Tbl_EducationDetails edu, out string Ermsg)
{
Ermsg = "";
try
{
db.Entry(edu).State = EntityState.Modified;
db.SaveChanges();
return true;
}
catch (Exception ex)
{
Ermsg = ex.Message;
return false;
}
}
public Boolean updateExperience(Tbl_ExperienceDetails exp, out string Ermsg)
{
Ermsg = "";
try
{
db.Entry(exp).State = EntityState.Modified;
db.SaveChanges();
return true;
}
catch (Exception ex)
{
Ermsg = ex.Message;
return false;
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace UpdateExecutableCommon.DataModels
{
public class UpdateStartInfo
{
public UpdateStartInfo() { }
public string CustomerGuid { get; set; }
public bool IsWipeOperation { get; set; }
public DateTime StartTime { get; set; }
}
}
|
// Accord Statistics Library
// The Accord.NET Framework
// http://accord-framework.net
//
// Copyright © Pablo Guzman Sanchez, 2013
// pablogsanchez at gmail.com
//
// Copyright © César Souza, 2009-2015
// cesarsouza at gmail.com
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
// This code originated as a contribution by Pablo Sanches, originally based on
// Student Dave's tutorial on Object Tracking in Images Using 2D Kalman Filters:
//
// http://studentdavestutorials.weebly.com/object-tracking-2d-kalman-filter.html
//
namespace Accord.Statistics.Running
{
using Accord.Math;
using AForge;
/// <summary>
/// Kalman filter for 2D coordinate systems.
/// </summary>
///
/// <remarks>
/// <para>
/// References:
/// <list type="bullet">
/// <item><description><a href="http://studentdavestutorials.weebly.com/object-tracking-2d-kalman-filter.html">
/// Student Dave's tutorial on Object Tracking in Images Using 2D Kalman Filters.
/// Available on: http://studentdavestutorials.weebly.com/object-tracking-2d-kalman-filter.html
/// </a></description></item>
/// </list></para>
/// </remarks>
///
public class KalmanFilter2D : IRunning<DoublePoint>
{
double samplingRate = 1;
double acceleration = 0.005f;
double accelStdDev = 0.1f;
double[,] Q_estimate;
double[,] A;
double[,] B;
double[,] C;
double[,] Ez;
double[,] Ex;
double[,] P;
double[,] K;
double[,] Aux;
static readonly double[,] diagonal =
{
{ 1, 0, 0, 0 },
{ 0, 1, 0, 0 },
{ 0, 0, 1, 0 },
{ 0, 0, 0, 1 }
};
/// <summary>
/// Gets or sets the current X position of the object.
/// </summary>
///
public double X
{
get { return Q_estimate[0, 0]; }
set { Q_estimate[0, 0] = value; }
}
/// <summary>
/// Gets or sets the current Y position of the object.
/// </summary>
///
public double Y
{
get { return Q_estimate[1, 0]; }
set { Q_estimate[1, 0] = value; }
}
/// <summary>
/// Gets or sets the current object's velocity in the X axis.
/// </summary>
///
public double XAxisVelocity
{
get { return Q_estimate[2, 0]; }
set { Q_estimate[2, 0] = value; }
}
/// <summary>
/// Gets or sets the current object's velocity in the Y axis.
/// </summary>
///
public double YAxisVelocity
{
get { return Q_estimate[3, 0]; }
set { Q_estimate[3, 0] = value; }
}
/// <summary>
/// Gets or sets the observational noise
/// of the current object's in the X axis.
/// </summary>
///
public double NoiseX
{
get { return Ez[0, 0]; }
set { Ez[0, 0] = value; }
}
/// <summary>
/// Gets or sets the observational noise
/// of the current object's in the Y axis.
/// </summary>
///
public double NoiseY
{
get { return Ez[1, 1]; }
set { Ez[1, 1] = value; }
}
/// <summary>
/// Initializes a new instance of the <see cref="KalmanFilter2D"/> class.
/// </summary>
///
public KalmanFilter2D()
{
initialize();
}
/// <summary>
/// Initializes a new instance of the <see cref="KalmanFilter2D"/> class.
/// </summary>
///
/// <param name="samplingRate">The sampling rate.</param>
/// <param name="acceleration">The acceleration.</param>
/// <param name="accelerationStdDev">The acceleration standard deviation.</param>
///
public KalmanFilter2D(double samplingRate,
double acceleration, double accelerationStdDev)
{
this.acceleration = acceleration;
this.accelStdDev = accelerationStdDev;
this.samplingRate = samplingRate;
initialize();
}
private void initialize()
{
double dt = samplingRate;
A = new double[,]
{
{ 1, 0, dt, 0 },
{ 0, 1, 0, dt },
{ 0, 0, 1, 0 },
{ 0, 0, 0, 1 }
};
B = new double[,]
{
{ (dt * dt) / 2 },
{ (dt * dt) / 2 },
{ dt },
{ dt }
};
C = new double[,]
{
{ 1, 0, 0, 0 },
{ 0, 1, 0, 0 }
};
Ez = new double[2, 2];
double dt2 = dt * dt;
double dt3 = dt2 * dt;
double dt4 = dt2 * dt2;
double aVar = accelStdDev * accelStdDev;
Ex = new double[4, 4]
{
{ dt4 / 4, 0, dt3 / 2, 0 },
{ 0, dt4 / 4, 0, dt3 / 2 },
{ dt3 / 2, 0, dt2, 0 },
{ 0, dt3 / 2, 0, dt2 }
};
Ex.Multiply(aVar, result: Ex);
P = Ex.MemberwiseClone();
}
/// <summary>
/// Registers the occurrence of a value.
/// </summary>
///
/// <param name="value">The value to be registered.</param>
///
public void Push(DoublePoint value)
{
double[,] Qloc = { { value.X }, { value.Y } };
// Predict next state
Q_estimate = Matrix.Dot(A, Q_estimate).Add(B.Multiply(acceleration));
// Predict Covariances
P = Matrix.Dot(A, P.DotWithTransposed(A)).Add(Ex);
Aux = Matrix.Dot(C, P.DotWithTransposed(C).Add(Ez)).PseudoInverse();
// Kalman Gain
K = Matrix.Dot(Matrix.DotWithTransposed(P, C), Aux);
Q_estimate = Q_estimate.Add(Matrix.Dot(K, Qloc.Subtract(Matrix.Dot(C, Q_estimate))));
// Update P (Covariances)
P = Matrix.Dot(diagonal.Subtract(Matrix.Dot(K, C)), P);
}
/// <summary>
/// Clears all measures previously computed.
/// </summary>
///
public void Clear()
{
this.NoiseX = 0;
this.NoiseY = 0;
this.XAxisVelocity = 0;
this.YAxisVelocity = 0;
this.X = 0;
this.Y = 0;
}
}
}
|
using System;
using System.Collections.Generic;
using UnityEngine;
namespace RO.Config
{
public class RoleActionInfoList : ScriptableObject
{
public List<RoleActionInfo> actions;
private Dictionary<string, RoleActionInfo> actionDictionary_;
public Dictionary<string, RoleActionInfo> actionDictionary
{
get
{
if (this.actionDictionary_ == null)
{
this.actionDictionary_ = new Dictionary<string, RoleActionInfo>();
using (List<RoleActionInfo>.Enumerator enumerator = this.actions.GetEnumerator())
{
while (enumerator.MoveNext())
{
RoleActionInfo current = enumerator.get_Current();
this.actionDictionary_.Add(current.name, current);
}
}
}
return this.actionDictionary_;
}
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public abstract class RoleBase : Obj
{
public int BattleID;
public RoleBase(int _bID, GameObject go) : base(go)
{
BattleID = _bID;
}
public abstract void Logic_MoveLeft();
public abstract void Logic_MoveRight();
public abstract void Logic_MoveUp();
public abstract void Logic_MoveDown();
public abstract void View_Move();
}
|
using System.Collections.Generic;
using MovieDAL.Models.Base;
namespace MovieDAL.Models
{
public class MovieGenre : EntityBase
{
public string GenreName { get; set; }
public List<Movie> Movies { get; set; } = new List<Movie>();
}
} |
using MusicAPIStore.Models;
using System.Data.Entity;
namespace MusicAPIStore.Context
{
public class DatabaseContext : DbContext
{
public DatabaseContext() : base ("DefaultConnection")
{
}
public DbSet<RegisterUser> RegisterUser { get; set; }
public DbSet<RegisterCompany> RegisterCompany { get; set; }
public DbSet<TokensManager> TokensManager { get; set; }
public DbSet<ClientKeys> ClientKeys { get; set; }
public DbSet<MusicStore> MusicStore { get; set; }
}
} |
//
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
namespace DotNetNuke.Entities.Urls
{
internal static class UrlEnums
{
internal enum TabKeyPreference
{
TabOK,
TabRedirected,
TabDeleted
}
}
}
|
/*
* Bungie.Net API
*
* These endpoints constitute the functionality exposed by Bungie.net, both for more traditional website functionality and for connectivity to Bungie video games and their related functionality.
*
* OpenAPI spec version: 2.1.1
* Contact: support@bungie.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = BungieNetPlatform.Client.SwaggerDateConverter;
namespace BungieNetPlatform.Model
{
/// <summary>
/// Aggregations of multiple progressions. These are used to apply rewards to multiple progressions at once. They can sometimes have human readable data as well, but only extremely sporadically.
/// </summary>
[DataContract]
public partial class DestinyDefinitionsDestinyProgressionMappingDefinition : IEquatable<DestinyDefinitionsDestinyProgressionMappingDefinition>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="DestinyDefinitionsDestinyProgressionMappingDefinition" /> class.
/// </summary>
/// <param name="DisplayProperties">Infrequently defined in practice. Defer to the individual progressions' display properties..</param>
/// <param name="DisplayUnits">The localized unit of measurement for progression across the progressions defined in this mapping. Unfortunately, this is very infrequently defined. Defer to the individual progressions' display units..</param>
/// <param name="Hash">The unique identifier for this entity. Guaranteed to be unique for the type of entity, but not globally. When entities refer to each other in Destiny content, it is this hash that they are referring to..</param>
/// <param name="Index">The index of the entity as it was found in the investment tables..</param>
/// <param name="Redacted">If this is true, then there is an entity with this identifier/type combination, but BNet is not yet allowed to show it. Sorry!.</param>
public DestinyDefinitionsDestinyProgressionMappingDefinition(DestinyDefinitionsCommonDestinyDisplayPropertiesDefinition DisplayProperties = default(DestinyDefinitionsCommonDestinyDisplayPropertiesDefinition), string DisplayUnits = default(string), uint? Hash = default(uint?), int? Index = default(int?), bool? Redacted = default(bool?))
{
this.DisplayProperties = DisplayProperties;
this.DisplayUnits = DisplayUnits;
this.Hash = Hash;
this.Index = Index;
this.Redacted = Redacted;
}
/// <summary>
/// Infrequently defined in practice. Defer to the individual progressions' display properties.
/// </summary>
/// <value>Infrequently defined in practice. Defer to the individual progressions' display properties.</value>
[DataMember(Name="displayProperties", EmitDefaultValue=false)]
public DestinyDefinitionsCommonDestinyDisplayPropertiesDefinition DisplayProperties { get; set; }
/// <summary>
/// The localized unit of measurement for progression across the progressions defined in this mapping. Unfortunately, this is very infrequently defined. Defer to the individual progressions' display units.
/// </summary>
/// <value>The localized unit of measurement for progression across the progressions defined in this mapping. Unfortunately, this is very infrequently defined. Defer to the individual progressions' display units.</value>
[DataMember(Name="displayUnits", EmitDefaultValue=false)]
public string DisplayUnits { get; set; }
/// <summary>
/// The unique identifier for this entity. Guaranteed to be unique for the type of entity, but not globally. When entities refer to each other in Destiny content, it is this hash that they are referring to.
/// </summary>
/// <value>The unique identifier for this entity. Guaranteed to be unique for the type of entity, but not globally. When entities refer to each other in Destiny content, it is this hash that they are referring to.</value>
[DataMember(Name="hash", EmitDefaultValue=false)]
public uint? Hash { get; set; }
/// <summary>
/// The index of the entity as it was found in the investment tables.
/// </summary>
/// <value>The index of the entity as it was found in the investment tables.</value>
[DataMember(Name="index", EmitDefaultValue=false)]
public int? Index { get; set; }
/// <summary>
/// If this is true, then there is an entity with this identifier/type combination, but BNet is not yet allowed to show it. Sorry!
/// </summary>
/// <value>If this is true, then there is an entity with this identifier/type combination, but BNet is not yet allowed to show it. Sorry!</value>
[DataMember(Name="redacted", EmitDefaultValue=false)]
public bool? Redacted { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class DestinyDefinitionsDestinyProgressionMappingDefinition {\n");
sb.Append(" DisplayProperties: ").Append(DisplayProperties).Append("\n");
sb.Append(" DisplayUnits: ").Append(DisplayUnits).Append("\n");
sb.Append(" Hash: ").Append(Hash).Append("\n");
sb.Append(" Index: ").Append(Index).Append("\n");
sb.Append(" Redacted: ").Append(Redacted).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
{
return this.Equals(input as DestinyDefinitionsDestinyProgressionMappingDefinition);
}
/// <summary>
/// Returns true if DestinyDefinitionsDestinyProgressionMappingDefinition instances are equal
/// </summary>
/// <param name="input">Instance of DestinyDefinitionsDestinyProgressionMappingDefinition to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(DestinyDefinitionsDestinyProgressionMappingDefinition input)
{
if (input == null)
return false;
return
(
this.DisplayProperties == input.DisplayProperties ||
(this.DisplayProperties != null &&
this.DisplayProperties.Equals(input.DisplayProperties))
) &&
(
this.DisplayUnits == input.DisplayUnits ||
(this.DisplayUnits != null &&
this.DisplayUnits.Equals(input.DisplayUnits))
) &&
(
this.Hash == input.Hash ||
(this.Hash != null &&
this.Hash.Equals(input.Hash))
) &&
(
this.Index == input.Index ||
(this.Index != null &&
this.Index.Equals(input.Index))
) &&
(
this.Redacted == input.Redacted ||
(this.Redacted != null &&
this.Redacted.Equals(input.Redacted))
);
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.DisplayProperties != null)
hashCode = hashCode * 59 + this.DisplayProperties.GetHashCode();
if (this.DisplayUnits != null)
hashCode = hashCode * 59 + this.DisplayUnits.GetHashCode();
if (this.Hash != null)
hashCode = hashCode * 59 + this.Hash.GetHashCode();
if (this.Index != null)
hashCode = hashCode * 59 + this.Index.GetHashCode();
if (this.Redacted != null)
hashCode = hashCode * 59 + this.Redacted.GetHashCode();
return hashCode;
}
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
}
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class EnemyHealth : MonoBehaviour, IDamagable {
//private float m_enemyStats.m_health;
[SerializeField]
public int m_objValue;
[SerializeField]
private GameObject m_overlord;
[SerializeField]
private Overlord m_overlordScript;
private Animator m_animator;
public EnemyStats m_enemyStats;
private bool m_bodyDecay;
private float m_bodyTimer = 7;
private float m_hitTimer;
private Color m_colorWhite;
void OnEnable() {
m_enemyStats = GetComponent<EnemyStats>();
m_overlord = GameObject.FindGameObjectWithTag("OVERLORD");
m_overlordScript = m_overlord.gameObject.GetComponent<Overlord>();
m_overlordScript.DestructEnemies.Add(gameObject);
m_animator = GetComponent<Animator>();
Color colorwhite = Color.white;
}
void HitChangeMaterial() {
Material[] colormat = gameObject.GetComponentsInChildren<Material>();
List<Color> oldcolor = new List<Color>();
Color colorwhite = Color.white;
while (m_hitTimer > 0) {
m_hitTimer -= Time.deltaTime;
}
if(m_hitTimer < 0) {
foreach (Material mat in colormat) {
m_hitTimer = 3;
//mat.color = oldcolor[mat];
oldcolor.Remove(mat.color);
mat.color = colorwhite;
}
}
}
public void TakeDamage(int damage) {
if (m_enemyStats.m_health > 0) {
m_enemyStats.m_health -= damage;
}
}
public float GetHitPoints() {
if (m_enemyStats.m_health <= 0) {
m_overlordScript.DestructEnemies.Remove(gameObject);
m_animator.SetTrigger("isDead");
gameObject.GetComponent<AIMovement>().enabled = false;
gameObject.GetComponent<NavMeshAgent>().enabled = false;
m_bodyDecay = true;
StartCoroutine(RemoveBody());
}
return m_enemyStats.m_health;
}
private IEnumerator RemoveBody() {
while (m_bodyDecay) {
if (m_bodyTimer > 0) {
m_bodyTimer -= Time.deltaTime;
}
else if (m_bodyTimer <= 0) {
m_bodyDecay = false;
m_overlordScript.m_money += m_objValue;
Destroy(gameObject);
}
yield return new WaitForEndOfFrame();
}
}
public GameObject GetGameObject() {
return gameObject;
}
}
|
using BPiaoBao.AppServices.DataContracts.DomesticTicket.DataObject;
using BPiaoBao.Client.DomesticTicket.Model;
using BPiaoBao.Client.UIExt;
using BPiaoBao.Client.UIExt.Helper;
using JoveZhao.Framework;
namespace BPiaoBao.Client.DomesticTicket.ViewModel
{
public class InsuranceDetailViewModel : BaseVM
{
public void Init(ResponseInsurance model)
{
if (model == null)
{
throw new CustomException(10001, "传入保单异常");
}
InitData(model);
}
/// <summary>
/// 转换成本地数据
/// </summary>
/// <param name="model"></param>
private void InitData(ResponseInsurance model)
{
InsuranceDetailModel = new InsuranceDetailModel
{
InsuranceNo = model.InsuranceNo,
OrderId = model.OrderId,
InsuranceCount = 1,
SumInsured = model.PolicyAmount,
BuyInsuranceStateText = EnumHelper.GetDescription(model.EnumInsuranceStatus),
BuyInsuranceState = model.EnumInsuranceStatus,
BuyInsuranceType = EnumHelper.GetDescription(model.InsureType),
Name = model.PassengerName,
Mobile = model.Mobile,
Gender = model.SexType == Common.Enums.EnumSexType.Male,
BirthDay = model.Birth
};
switch (model.IdType)
{
case Common.Enums.EnumIDType.NormalId:
InsuranceDetailModel.IsIdType = true;
break;
case Common.Enums.EnumIDType.Passport:
InsuranceDetailModel.IsPassportIdType = true;
break;
case Common.Enums.EnumIDType.MilitaryId:
InsuranceDetailModel.IsMilitaryIdType = true;
break;
case Common.Enums.EnumIDType.BirthDate:
break;
case Common.Enums.EnumIDType.Other:
InsuranceDetailModel.IsOtherType = true;
break;
}
switch (model.PassengerType)
{
case Common.Enums.EnumPassengerType.Adult:
InsuranceDetailModel.IsAdultType = true;
break;
case Common.Enums.EnumPassengerType.Child:
InsuranceDetailModel.IsChildType = true;
break;
case Common.Enums.EnumPassengerType.Baby:
InsuranceDetailModel.IsBabyType = true;
break;
}
InsuranceDetailModel.IdNo = model.CardNo;
InsuranceDetailModel.CreateTime = model.BuyTime;
InsuranceDetailModel.InsuranceStartTime = model.InsuranceLimitStartTime;
InsuranceDetailModel.InsuracneEndTime = model.InsuranceLimitEndTime;
InsuranceDetailModel.FlightNumber = model.FlightNumber;
if (model.StartDateTime.HasValue) InsuranceDetailModel.FlightStartDate = model.StartDateTime.Value;
InsuranceDetailModel.PNR = model.PNR;
InsuranceDetailModel.ToCityName = model.ToCity;
}
#region InsuranceDetailModel
private const string InsuranceDetailModelPropertyName = "InsuranceDetailModel";
private InsuranceDetailModel _insuranceDetailModel;
public InsuranceDetailModel InsuranceDetailModel
{
get { return _insuranceDetailModel; }
set
{
if (_insuranceDetailModel == value) return;
RaisePropertyChanging(InsuranceDetailModelPropertyName);
_insuranceDetailModel = value;
RaisePropertyChanged(InsuranceDetailModelPropertyName);
}
}
#endregion
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DAL;
using DevExpress.XtraReports.UI;
using BUS;
using ControlLocalizer;
using DevExpress.XtraEditors;
using GUI.Report.Bangcandoiketoan;
using DevExpress.XtraSplashScreen;
namespace GUI.Report.Nhap
{
public partial class f_bangcandoiketoan : DevExpress.XtraBars.Ribbon.RibbonForm
{
KetNoiDBDataContext db = new KetNoiDBDataContext();
Boolean doubleclick1 = false;
Boolean doubleclick2 = false;
public f_bangcandoiketoan()
{
InitializeComponent();
rTime.SetTime(thoigian);
}
private void f_chitietnhapkho_Load(object sender, EventArgs e)
{
LanguageHelper.Translate(this);
this.Text = LanguageHelper.TranslateMsgString("." + Name + "_title", "Bảng Cân Đối Kế Toán").ToString();
changeFont.Translate(this);
//translate text
labelControl1.Text = LanguageHelper.TranslateMsgString(".reportKhoangThoiGian", "Khoảng Thời Gian").ToString();
labelControl2.Text = LanguageHelper.TranslateMsgString(".reportTuNgay", "Từ Ngày").ToString();
labelControl3.Text = LanguageHelper.TranslateMsgString(".reportDenNgay", "Đến Ngày").ToString();
labelControl6.Text = LanguageHelper.TranslateMsgString(".reportDanhMuc", "Danh Mục").ToString();
tungay.ReadOnly = true;
denngay.ReadOnly = true;
danhmuc.Text = "Đơn vị - ຫົວໜ່ວຍ";
try
{
var lst = from a in db.dk_rps where a.user == Biencucbo.idnv && a.form == "f_bangcandoiketoan" select a;
nhan.DataSource = lst;
if (danhmuc.Text == "Đơn vị - ຫົວໜ່ວຍ")
{
var list = (from a in db.donvis
select new
{
id = a.id,
name = a.tendonvi,
key = a.id + danhmuc.Text + Biencucbo.idnv + "f_bangcandoiketoan",
MaTim = LayMaTim(a.id)
});
var lst2 = list.ToList().Where(t => t.MaTim.Contains("." + Biencucbo.donvi + "."));
for (int j = 0; j < gridView2.DataRowCount; j++)
{
var lst3 = from a in lst2
where a.key != gridView2.GetRowCellValue(j, "key").ToString()
select a;
lst2 = lst3.ToList();
};
nguon.DataSource = lst2;
}
else
{
gridView1.DeleteSelectedRows();
}
}
catch
{
}
rTime.SetTime2(thoigian);
//var lst = from a in db.dk_rps where a.user == Biencucbo.idnv && a.form == "f_bangcandoiketoan" select a;
//db.dk_rps.DeleteAllOnSubmit(lst);
//db.SubmitChanges();
//nhan.DataSource = lst;
}
private string LayMaTim(string da)
{
var d = (from a in db.donvis select a).Single(t => t.id == da);
string s = "." + d.id + "." + d.iddv + ".";
var find = db.donvis.FirstOrDefault(t => t.id == d.iddv);
if (find != null)
{
string iddv = find.iddv;
if (d.id != find.iddv)
{
if (!s.Contains(iddv))
s += iddv + ".";
}
while (iddv != find.id)
{
if (!s.Contains(find.id))
s += find.id + ".";
find = db.donvis.FirstOrDefault(t => t.id == find.iddv);
}
}
return s;
}
private void thoigian_SelectedIndexChanged(object sender, EventArgs e)
{
changeTime.thoigian_change3(thoigian, tungay, denngay);
}
private void danhmuc_SelectedIndexChanged(object sender, EventArgs e)
{
if (danhmuc.Text == "Đơn vị - ຫົວໜ່ວຍ")
{
try
{
var list = (from a in db.donvis
select new
{
id = a.id,
name = a.tendonvi,
key = a.id + danhmuc.Text + Biencucbo.idnv + "f_bangcandoiketoan",
MaTim = LayMaTim(a.id)
});
var lst2 = list.ToList().Where(t => t.MaTim.Contains("." + Biencucbo.donvi + "."));
for (int j = 0; j < gridView2.DataRowCount; j++)
{
var lst3 = from a in lst2
where a.key != gridView2.GetRowCellValue(j, "key").ToString()
select a;
lst2 = lst3.ToList();
};
nguon.DataSource = lst2;
}
catch (Exception ex)
{
XtraMessageBox.Show(ex.Message);
}
}
}
private void simpleButton1_Click(object sender, EventArgs e)
{
try
{
dk_rp dk = new dk_rp();
dk.id = gridView1.GetFocusedRowCellValue("id").ToString();
dk.name = gridView1.GetFocusedRowCellValue("name").ToString();
dk.key = gridView1.GetFocusedRowCellValue("key").ToString();
dk.loai = danhmuc.Text;
dk.user = Biencucbo.idnv;
dk.form = "f_bangcandoiketoan";
db.dk_rps.InsertOnSubmit(dk);
db.SubmitChanges();
var lst = from a in db.dk_rps where a.user == Biencucbo.idnv && a.form == "f_bangcandoiketoan" select a;
nhan.DataSource = lst;
if (danhmuc.Text == "Đơn vị - ຫົວໜ່ວຍ")
{
var list = (from a in db.donvis
select new
{
id = a.id,
name = a.tendonvi,
key = a.id + danhmuc.Text + Biencucbo.idnv + "f_bangcandoiketoan",
MaTim = LayMaTim(a.id)
});
var lst2 = list.ToList().Where(t => t.MaTim.Contains("." + Biencucbo.donvi + "."));
for (int j = 0; j < gridView2.DataRowCount; j++)
{
var lst3 = from a in lst2
where a.key != gridView2.GetRowCellValue(j, "key").ToString()
select a;
lst2 = lst3.ToList();
};
nguon.DataSource = lst2;
}
else
{
gridView1.DeleteSelectedRows();
}
}
catch
{
}
}
private void gridView1_Click(object sender, EventArgs e)
{
doubleclick1 = false;
}
private void gridView1_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
{
if (doubleclick1 == true)
{
try
{
dk_rp dk = new dk_rp();
dk.id = gridView1.GetFocusedRowCellValue("id").ToString();
dk.name = gridView1.GetFocusedRowCellValue("name").ToString();
dk.key = gridView1.GetFocusedRowCellValue("key").ToString();
dk.loai = danhmuc.Text;
dk.user = Biencucbo.idnv;
dk.form = "f_bangcandoiketoan";
db.dk_rps.InsertOnSubmit(dk);
db.SubmitChanges();
var lst = from a in db.dk_rps where a.user == Biencucbo.idnv && a.form == "f_bangcandoiketoan" select a;
nhan.DataSource = lst;
if (danhmuc.Text == "Đơn vị - ຫົວໜ່ວຍ")
{
var list = (from a in db.donvis
select new
{
id = a.id,
name = a.tendonvi,
key = a.id + danhmuc.Text + Biencucbo.idnv + "f_bangcandoiketoan",
MaTim = LayMaTim(a.id)
});
var lst2 = list.ToList().Where(t => t.MaTim.Contains("." + Biencucbo.donvi + "."));
for (int j = 0; j < gridView2.DataRowCount; j++)
{
var lst3 = from a in lst2
where a.key != gridView2.GetRowCellValue(j, "key").ToString()
select a;
lst2 = lst3.ToList();
};
nguon.DataSource = lst2;
}
else
{
gridView1.DeleteSelectedRows();
}
}
catch
{
}
}
}
private void gridView1_DoubleClick(object sender, EventArgs e)
{
doubleclick1 = true;
}
private void gridView2_DoubleClick(object sender, EventArgs e)
{
doubleclick2 = true;
}
private void gridView2_Click(object sender, EventArgs e)
{
doubleclick2 = false;
}
private void gridView2_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
{
if (doubleclick2 == true)
{
try
{
dk_rp dk = new dk_rp();
var lst = (from a in db.dk_rps where a.user == Biencucbo.idnv && a.form == "f_bangcandoiketoan" select a).Single(t => t.key == gridView2.GetFocusedRowCellValue("key").ToString());
db.dk_rps.DeleteOnSubmit(lst);
db.SubmitChanges();
var lst2 = from a in db.dk_rps where a.user == Biencucbo.idnv && a.form == "f_bangcandoiketoan" select a;
nhan.DataSource = lst2;
}
catch
{
}
if (danhmuc.Text == "Đơn vị - ຫົວໜ່ວຍ")
{
try
{
var list = (from a in db.donvis
select new
{
id = a.id,
name = a.tendonvi,
key = a.id + danhmuc.Text + Biencucbo.idnv + "f_bangcandoiketoan",
MaTim = LayMaTim(a.id)
});
var lst2 = list.ToList().Where(t => t.MaTim.Contains("." + Biencucbo.donvi + "."));
for (int j = 0; j < gridView2.DataRowCount; j++)
{
var lst3 = from a in lst2
where a.key != gridView2.GetRowCellValue(j, "key").ToString()
select a;
lst2 = lst3.ToList();
};
nguon.DataSource = lst2;
}
catch
{
}
}
}
}
private void simpleButton3_Click(object sender, EventArgs e)
{
try
{
dk_rp dk = new dk_rp();
var lst = (from a in db.dk_rps where a.user == Biencucbo.idnv && a.form == "f_bangcandoiketoan" select a).Single(t => t.key == gridView2.GetFocusedRowCellValue("key").ToString());
db.dk_rps.DeleteOnSubmit(lst);
db.SubmitChanges();
var lst2 = from a in db.dk_rps where a.user == Biencucbo.idnv && a.form == "f_bangcandoiketoan" select a;
nhan.DataSource = lst2;
}
catch
{
}
if (danhmuc.Text == "Đơn vị - ຫົວໜ່ວຍ")
{
try
{
var list = (from a in db.donvis
select new
{
id = a.id,
name = a.tendonvi,
key = a.id + danhmuc.Text + Biencucbo.idnv + "f_bangcandoiketoan",
MaTim = LayMaTim(a.id)
});
var lst2 = list.ToList().Where(t => t.MaTim.Contains("." + Biencucbo.donvi + "."));
for (int j = 0; j < gridView2.DataRowCount; j++)
{
var lst3 = from a in lst2
where a.key != gridView2.GetRowCellValue(j, "key").ToString()
select a;
lst2 = lst3.ToList();
};
nguon.DataSource = lst2;
}
catch
{
}
}
}
private void simpleButton2_Click(object sender, EventArgs e)
{
try
{
for (int i = 0; i < gridView1.RowCount; i++)
{
dk_rp dk = new dk_rp();
dk.id = gridView1.GetRowCellValue(i, "id").ToString();
dk.name = gridView1.GetRowCellValue(i, "name").ToString();
dk.key = gridView1.GetRowCellValue(i, "key").ToString();
dk.loai = danhmuc.Text;
dk.user = Biencucbo.idnv;
dk.form = "f_bangcandoiketoan";
db.dk_rps.InsertOnSubmit(dk);
db.SubmitChanges();
var lst = from a in db.dk_rps where a.user == Biencucbo.idnv && a.form == "f_bangcandoiketoan" select a;
nhan.DataSource = lst;
}
if (danhmuc.Text == "Đơn vị - ຫົວໜ່ວຍ")
{
var list = (from a in db.donvis
select new
{
id = a.id,
name = a.tendonvi,
key = a.id + danhmuc.Text + Biencucbo.idnv + "f_bangcandoiketoan",
MaTim = LayMaTim(a.id)
});
var lst2 = list.ToList().Where(t => t.MaTim.Contains("." + Biencucbo.donvi + "."));
for (int j = 0; j < gridView2.DataRowCount; j++)
{
var lst3 = from a in lst2
where a.key != gridView2.GetRowCellValue(j, "key").ToString()
select a;
lst2 = lst3.ToList();
};
nguon.DataSource = lst2;
}
else
{
for (int i = gridView1.RowCount; i > 0; i--)
{
gridView1.DeleteSelectedRows();
}
}
}
catch
{
}
}
private void simpleButton4_Click(object sender, EventArgs e)
{
try
{
var lst = from a in db.dk_rps where a.user == Biencucbo.idnv && a.form == "f_bangcandoiketoan" select a;
db.dk_rps.DeleteAllOnSubmit(lst);
db.SubmitChanges();
nhan.DataSource = lst;
}
catch
{
}
if (danhmuc.Text == "Đơn vị - ຫົວໜ່ວຍ")
{
try
{
var list = (from a in db.donvis
select new
{
id = a.id,
name = a.tendonvi,
key = a.id + danhmuc.Text + Biencucbo.idnv + "f_bangcandoiketoan",
MaTim = LayMaTim(a.id)
});
var lst2 = list.ToList().Where(t => t.MaTim.Contains("." + Biencucbo.donvi + "."));
for (int j = 0; j < gridView2.DataRowCount; j++)
{
var lst3 = from a in lst2
where a.key != gridView2.GetRowCellValue(j, "key").ToString()
select a;
lst2 = lst3.ToList();
};
nguon.DataSource = lst2;
}
catch
{
}
}
}
private void simpleButton5_Click(object sender, EventArgs e)
{
SplashScreenManager.ShowForm(this, typeof(SplashScreen2), true, true, false);
try
{
Biencucbo.loai = "";
Biencucbo.doituong = "";
Biencucbo.congviec = "";
Biencucbo.taikhoan = "";
Biencucbo.muccp = "";
Biencucbo.kho = "";
int check = 0;
Candoi.c100 = 0;
//110
Candoi.c110 = 0;
Candoi.c111 = 0;
Candoi.c112 = 0;
//120
Candoi.c120 = 0;
Candoi.c121 = 0;
Candoi.c122 = 0;
Candoi.c123 = 0;
//130
Candoi.c130 = 0;
Candoi.c131 = 0;
Candoi.c132 = 0;
Candoi.c133 = 0;
Candoi.c134 = 0;
Candoi.c135 = 0;
Candoi.c136 = 0;
Candoi.c137 = 0;
Candoi.c139 = 0;
// 140
Candoi.c140 = 0;
Candoi.c141 = 0;
Candoi.c149 = 0;
// 150
Candoi.c150 = 0;
Candoi.c151 = 0;
Candoi.c152 = 0;
Candoi.c153 = 0;
Candoi.c154 = 0;
Candoi.c155 = 0;
//200
Candoi.c200 = 0;
//210
Candoi.c210 = 0;
Candoi.c211 = 0;
Candoi.c212 = 0;
Candoi.c213 = 0;
Candoi.c214 = 0;
Candoi.c215 = 0;
Candoi.c216 = 0;
Candoi.c219 = 0;
//220
Candoi.c220 = 0;
Candoi.c221 = 0;
Candoi.c222 = 0;
Candoi.c223 = 0;
Candoi.c224 = 0;
Candoi.c225 = 0;
Candoi.c226 = 0;
Candoi.c227 = 0;
Candoi.c228 = 0;
Candoi.c229 = 0;
//230
Candoi.c230 = 0;
Candoi.c231 = 0;
Candoi.c232 = 0;
//240
Candoi.c240 = 0;
Candoi.c241 = 0;
Candoi.c242 = 0;
//250
Candoi.c250 = 0;
Candoi.c251 = 0;
Candoi.c252 = 0;
Candoi.c253 = 0;
Candoi.c254 = 0;
Candoi.c255 = 0;
//260
Candoi.c260 = 0;
Candoi.c261 = 0;
Candoi.c262 = 0;
Candoi.c263 = 0;
Candoi.c268 = 0;
//270
Candoi.c270 = 0;
//300
Candoi.c300 = 0;
//310
Candoi.c310 = 0;
Candoi.c311 = 0;
Candoi.c312 = 0;
Candoi.c313 = 0;
Candoi.c314 = 0;
Candoi.c315 = 0;
Candoi.c316 = 0;
Candoi.c317 = 0;
Candoi.c318 = 0;
Candoi.c319 = 0;
Candoi.c320 = 0;
Candoi.c321 = 0;
Candoi.c322 = 0;
Candoi.c323 = 0;
Candoi.c324 = 0;
//330
Candoi.c330 = 0;
Candoi.c331 = 0;
Candoi.c332 = 0;
Candoi.c333 = 0;
Candoi.c334 = 0;
Candoi.c335 = 0;
Candoi.c336 = 0;
Candoi.c337 = 0;
Candoi.c338 = 0;
Candoi.c339 = 0;
Candoi.c340 = 0;
Candoi.c341 = 0;
Candoi.c342 = 0;
Candoi.c343 = 0;
//400
Candoi.c400 = 0;
//410
Candoi.c410 = 0;
Candoi.c411 = 0;
Candoi.c411a = 0;
Candoi.c411b = 0;
Candoi.c412 = 0;
Candoi.c413 = 0;
Candoi.c414 = 0;
Candoi.c415 = 0;
Candoi.c416 = 0;
Candoi.c417 = 0;
Candoi.c418 = 0;
Candoi.c419 = 0;
Candoi.c420 = 0;
Candoi.c421 = 0;
Candoi.c421a = 0;
Candoi.c421b = 0;
Candoi.c422 = 0;
//430
Candoi.c430 = 0;
Candoi.c431 = 0;
Candoi.c432 = 0;
//440
Candoi.c440 = 0;
// Năm trước
Candoi.d100 = 0;
//110
Candoi.d110 = 0;
Candoi.d111 = 0;
Candoi.d112 = 0;
//120
Candoi.d120 = 0;
Candoi.d121 = 0;
Candoi.d122 = 0;
Candoi.d123 = 0;
//130
Candoi.d130 = 0;
Candoi.d131 = 0;
Candoi.d132 = 0;
Candoi.d133 = 0;
Candoi.d134 = 0;
Candoi.d135 = 0;
Candoi.d136 = 0;
Candoi.d137 = 0;
Candoi.d139 = 0;
// 140
Candoi.d140 = 0;
Candoi.d141 = 0;
Candoi.d149 = 0;
// 150
Candoi.d150 = 0;
Candoi.d151 = 0;
Candoi.d152 = 0;
Candoi.d153 = 0;
Candoi.d154 = 0;
Candoi.d155 = 0;
//200
Candoi.d200 = 0;
//210
Candoi.d210 = 0;
Candoi.d211 = 0;
Candoi.d212 = 0;
Candoi.d213 = 0;
Candoi.d214 = 0;
Candoi.d215 = 0;
Candoi.d216 = 0;
Candoi.d219 = 0;
//220
Candoi.d220 = 0;
Candoi.d221 = 0;
Candoi.d222 = 0;
Candoi.d223 = 0;
Candoi.d224 = 0;
Candoi.d225 = 0;
Candoi.d226 = 0;
Candoi.d227 = 0;
Candoi.d228 = 0;
Candoi.d229 = 0;
//230
Candoi.d230 = 0;
Candoi.d231 = 0;
Candoi.d232 = 0;
//240
Candoi.d240 = 0;
Candoi.d241 = 0;
Candoi.d242 = 0;
//250
Candoi.d250 = 0;
Candoi.d251 = 0;
Candoi.d252 = 0;
Candoi.d253 = 0;
Candoi.d254 = 0;
Candoi.d255 = 0;
//260
Candoi.d260 = 0;
Candoi.d261 = 0;
Candoi.d262 = 0;
Candoi.d263 = 0;
Candoi.d268 = 0;
//270
Candoi.d270 = 0;
//300
Candoi.d300 = 0;
//310
Candoi.d310 = 0;
Candoi.d311 = 0;
Candoi.d312 = 0;
Candoi.d313 = 0;
Candoi.d314 = 0;
Candoi.d315 = 0;
Candoi.d316 = 0;
Candoi.d317 = 0;
Candoi.d318 = 0;
Candoi.d319 = 0;
Candoi.d320 = 0;
Candoi.d321 = 0;
Candoi.d322 = 0;
Candoi.d323 = 0;
Candoi.d324 = 0;
//330
Candoi.d330 = 0;
Candoi.d331 = 0;
Candoi.d332 = 0;
Candoi.d333 = 0;
Candoi.d334 = 0;
Candoi.d335 = 0;
Candoi.d336 = 0;
Candoi.d337 = 0;
Candoi.d338 = 0;
Candoi.d339 = 0;
Candoi.d340 = 0;
Candoi.d341 = 0;
Candoi.d342 = 0;
Candoi.d343 = 0;
//400
Candoi.d400 = 0;
//410
Candoi.d410 = 0;
Candoi.d411 = 0;
Candoi.d411a = 0;
Candoi.d411b = 0;
Candoi.d412 = 0;
Candoi.d413 = 0;
Candoi.d414 = 0;
Candoi.d415 = 0;
Candoi.d416 = 0;
Candoi.d417 = 0;
Candoi.d418 = 0;
Candoi.d419 = 0;
Candoi.d420 = 0;
Candoi.d421 = 0;
Candoi.d421a = 0;
Candoi.d421b = 0;
Candoi.d422 = 0;
//430
Candoi.d430 = 0;
Candoi.d431 = 0;
Candoi.d432 = 0;
//440
Candoi.d440 = 0;
for (int i = 0; i < gridView2.DataRowCount; i++)
{
if (gridView2.GetRowCellValue(i, "loai").ToString() == "Đơn vị - ຫົວໜ່ວຍ")
{
check++;
Biencucbo.kho = Biencucbo.kho + gridView2.GetRowCellValue(i, "id").ToString() + "-" + gridView2.GetRowCellValue(i, "name").ToString() + ", ";
}
}
if (Biencucbo.ngonngu.ToString() == "Vietnam")
{
if (thoigian.Text == "Tùy ý")
{
Biencucbo.time = "Từ ngày: " + tungay.Text + " Đến ngày: " + denngay.Text;
}
else if (thoigian.Text == "Cả Năm")
{
Biencucbo.time = thoigian.Text + " " + DateTime.Now.Year;
}
else
{
Biencucbo.time = thoigian.Text + ", năm " + DateTime.Now.Year;
}
}
else
{
if (thoigian.Text == "ແລ້ວແຕ່")
{
Biencucbo.time = "ແຕ່: " + tungay.Text + " ເຖິງ: " + denngay.Text;
}
else if (thoigian.Text == "ໝົດປີ")
{
Biencucbo.time = thoigian.Text + " " + DateTime.Now.Year;
}
else
{
Biencucbo.time = thoigian.Text + ", ປີ " + DateTime.Now.Year;
}
}
//var lst = (from a in db.dk_rps where a.user == Biencucbo.idnv select a);
var lst1 = (from a in db.ct_tks
select a);
var lst1a = (from a in db.sodubandaus
select a);
if (check != 0)
{
lst1 = (from a in db.ct_tks
join b in db.dk_rps on a.iddv equals b.id
where b.user == Biencucbo.idnv && b.loai == "Đơn vị - ຫົວໜ່ວຍ" && b.form == "f_bangcandoiketoan"
select a);
lst1a = (from a in db.sodubandaus
join b in db.dk_rps on a.iddv equals b.id
where b.user == Biencucbo.idnv && b.loai == "Đơn vị - ຫົວໜ່ວຍ" && b.form == "f_bangcandoiketoan"
select a);
}
var tk = from b in db.dmtks where b.active == true select b;
var lst2 = (from a in lst1
join b in tk on a.tk_no equals b.matk
where a.ngaychungtu < tungay.DateTime
select new
{
taikhoan = a.tk_no,
iddt = a.dt_no,
psno = a.PS,
psco = a.PS - a.PS,
}).Concat(from a in lst1
join b in tk on a.tk_co equals b.matk
where a.ngaychungtu < tungay.DateTime /*&& a.ngaychungtu <= denngay.DateTime*/
select new
{
taikhoan = a.tk_co,
iddt = a.dt_co,
psno = a.PS - a.PS,
psco = a.PS,
}).Concat(from a in lst1a
join b in tk on a.matk equals b.matk
select new
{
taikhoan = a.matk,
iddt = a.iddt,
psno = a.psno == null ? 0 : a.psno,
psco = a.psco == null ? 0 : a.psco,
});
var lst3 = (from a in lst2
join b in db.dmtks on a.taikhoan equals b.matk into k
//where b.kieusodu == "DEBCRD"
from b in k.DefaultIfEmpty()
group a by new
{
b.kieusodu,
a.taikhoan,
b.tentk,
a.iddt,
}
into g
select new
{
g.Key.kieusodu,
taikhoan = g.Key.taikhoan,
iddt = g.Key.iddt,
tentk = g.Key.tentk,
psno = g.Sum(t => t.psno),
psco = g.Sum(t => t.psco),
}
);
var lst4 = from a in lst3
select new
{
a.taikhoan,
a.tentk,
a.iddt,
//no = a.kieusodu == "CRD" ? (a.psco - a.psno < 0 ? a.psno - a.psco : 0) : (a.psno - a.psco > 0 ? a.psno - a.psco : 0),
//co = a.kieusodu == "CRD" ? (a.psco - a.psno > 0 ? a.psco - a.psno : 0) : (a.psno - a.psco < 0 ? a.psco - a.psno : 0),
no = a.kieusodu == "CRD" ? 0 : (a.kieusodu == "DEB" ? a.psno - a.psco : (a.psno - a.psco > 0 ? a.psno - a.psco : 0)),
co = a.kieusodu == "DEB" ? 0 : (a.kieusodu == "CRD" ? a.psco - a.psno : (a.psno - a.psco < 0 ? a.psco - a.psno : 0)),
};
var ltdau = (from a in lst4
group a by new
{
a.taikhoan,
a.tentk,
} into g
select new
{
g.Key.taikhoan,
g.Key.tentk,
psno = g.Sum(t => t.no),
psco = g.Sum(t => t.co),
});
var lst3a = (from a in lst2
join b in db.dmtks on a.taikhoan equals b.matk into k
from b in k.DefaultIfEmpty()
//where b.kieusodu != "DEBCRD"
group a by new
{
b.kieusodu,
a.taikhoan,
b.tentk,
//a.iddt,
}
into g
select new
{
g.Key.kieusodu,
taikhoan = g.Key.taikhoan,
//iddt = g.Key.iddt,
tentk = g.Key.tentk,
psno = g.Sum(t => t.psno),
psco = g.Sum(t => t.psco),
});
var lst4a = from a in lst3a
select new
{
a.taikhoan,
a.tentk,
no = a.kieusodu == "CRD" ? 0 : (a.kieusodu == "DEB" ? a.psno - a.psco : (a.psno - a.psco > 0 ? a.psno - a.psco : 0)),
co = a.kieusodu == "DEB" ? 0 : (a.kieusodu == "CRD" ? a.psco - a.psno : (a.psno - a.psco < 0 ? a.psco - a.psno : 0)),
};
var tkdau = from a in lst4a
group a by new
{
a.taikhoan,
a.tentk,
} into g
select new
{
g.Key.taikhoan,
g.Key.tentk,
psno = g.Sum(t => t.no),
psco = g.Sum(t => t.co),
};
lst2 = (from a in lst1
join b in tk on a.tk_no equals b.matk
where a.ngaychungtu <= denngay.DateTime /*&& a.ngaychungtu <= denngay.DateTime*/
select new
{
taikhoan = a.tk_no,
iddt = a.dt_no,
psno = a.PS,
psco = a.PS - a.PS,
}).Concat(from a in lst1
join b in tk on a.tk_co equals b.matk
where a.ngaychungtu <= denngay.DateTime /*&& a.ngaychungtu <= denngay.DateTime*/
select new
{
taikhoan = a.tk_co,
iddt = a.dt_co,
psno = a.PS - a.PS,
psco = a.PS,
}).Concat(from a in lst1a
join b in tk on a.matk equals b.matk
select new
{
taikhoan = a.matk,
iddt = a.iddt,
psno = a.psno == null ? 0 : a.psno,
psco = a.psco == null ? 0 : a.psco,
});
lst3 = (from a in lst2
join b in db.dmtks on a.taikhoan equals b.matk
//where b.kieusodu == "DEBCRD"
group a by new
{
b.kieusodu,
a.taikhoan,
b.tentk,
a.iddt,
}
into g
select new
{
g.Key.kieusodu,
taikhoan = g.Key.taikhoan,
iddt = g.Key.iddt,
tentk = g.Key.tentk,
psno = g.Sum(t => t.psno),
psco = g.Sum(t => t.psco)
});
lst4 = from a in lst3
select new
{
a.taikhoan,
a.tentk,
a.iddt,
no = a.kieusodu == "CRD" ? 0 : (a.kieusodu == "DEB" ? a.psno - a.psco : (a.psno - a.psco > 0 ? a.psno - a.psco : 0)),
co = a.kieusodu == "DEB" ? 0 : (a.kieusodu == "CRD" ? a.psco - a.psno : (a.psno - a.psco < 0 ? a.psco - a.psno : 0)),
};
var ltcuoi = (from a in lst4
group a by new
{
a.taikhoan,
a.tentk,
} into g
select new
{
g.Key.taikhoan,
g.Key.tentk,
psno = g.Sum(t => t.no),
psco = g.Sum(t => t.co),
});
lst3a = (from a in lst2
join b in db.dmtks on a.taikhoan equals b.matk into k
from b in k.DefaultIfEmpty()
//where b.kieusodu != "DEBCRD"
group a by new
{
b.kieusodu,
a.taikhoan,
b.tentk,
//a.iddt,
}
into g
select new
{
g.Key.kieusodu,
taikhoan = g.Key.taikhoan,
//iddt = g.Key.iddt,
tentk = g.Key.tentk,
psno = g.Sum(t => t.psno),
psco = g.Sum(t => t.psco),
});
lst4a = from a in lst3a
select new
{
a.taikhoan,
a.tentk,
no = a.kieusodu == "CRD" ? 0 : (a.kieusodu == "DEB" ? a.psno - a.psco : (a.psno - a.psco > 0 ? a.psno - a.psco : 0)),
co = a.kieusodu == "DEB" ? 0 : (a.kieusodu == "CRD" ? a.psco - a.psno : (a.psno - a.psco < 0 ? a.psco - a.psno : 0)),
};
var tkcuoi = (from a in lst4a
group a by new
{
a.taikhoan,
a.tentk,
} into g
select new
{
g.Key.taikhoan,
g.Key.tentk,
psno = g.Sum(t => t.no),
psco = g.Sum(t => t.co),
});
var lttong = (from a in db.dmtks
join d in ltcuoi on a.matk equals d.taikhoan into k
join b in ltdau on a.matk equals b.taikhoan into g
from cuoi in k.DefaultIfEmpty()
from dau in g.DefaultIfEmpty()
//where dau.psno != 0 || dau.psco != 0 || cuoi.psno != 0 || cuoi.psco != 0
select new
{
a.matk,
a.tentk,
tkgoc = catchuoi(a.matk),
tkcap2 = tkc2(a.matk),
tkcap3 = tkc3(a.matk),
ctno_dau = dau.psno,
ctco_dau = dau.psco,
ctno_cuoi = cuoi.psno,
ctco_cuoi = cuoi.psco,
psno_dau = dau.psno - dau.psno,
psco_dau = dau.psco - dau.psco,
psno_cuoi = cuoi.psno - cuoi.psno,
psco_cuoi = cuoi.psco - cuoi.psco,
});
var tktong = (from a in db.dmtks
join b in tkdau on a.matk equals b.taikhoan into g
join d in tkcuoi on a.matk equals d.taikhoan into k
from dau in g.DefaultIfEmpty()
from cuoi in k.DefaultIfEmpty()
where dau.psno != 0 || dau.psco != 0 || cuoi.psno != 0 || cuoi.psco != 0
select new
{
a.matk,
a.tentk,
tkgoc = catchuoi(a.matk),
tkcap2 = tkc2(a.matk),
tkcap3 = tkc3(a.matk),
ctno_dau = dau.psno - dau.psno,
ctco_dau = dau.psco - dau.psco,
ctno_cuoi = cuoi.psno - cuoi.psno,
ctco_cuoi = cuoi.psco - cuoi.psco,
psno_dau = dau.psno,
psco_dau = dau.psco,
psno_cuoi = cuoi.psno,
psco_cuoi = cuoi.psco,
});
//var tong = tktong.Union(lttong).OrderBy(t => t.matk);
var tong = tktong.Union(lttong).OrderBy(t => t.matk).ToList();
#region Tài sản ngắn hạn (100)
#region 110
// 111
var gt = (from a in tong where a.tkgoc == "111" || a.tkgoc == "112" || a.tkgoc == "113" select a);
if (gt.Count() == 0)
{
Candoi.d111 = 0;
Candoi.c111 = 0;
}
else
{
Candoi.d111 = double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c111 = double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
// 112
gt = (from a in tong where a.tkcap3 == "12811" || a.tkcap3 == "12881" select a);
if (gt.Count() == 0)
{
Candoi.d112 = 0;
Candoi.c112 = 0;
}
else
{
Candoi.d112 = double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c112 = double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
Candoi.c110 = Candoi.c111 + Candoi.c112;
Candoi.d110 = Candoi.d111 + Candoi.d112;
#endregion
#region 120
// 121
gt = (from a in tong where a.tkgoc == "121" select a);
if (gt.Count() == 0)
{
Candoi.d121 = 0;
Candoi.c121 = 0;
}
else
{
Candoi.d121 = double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c121 = double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
// 122
gt = (from a in tong where a.tkcap2 == "2291" select a);
if (gt.Count() == 0)
{
Candoi.d122 = 0;
Candoi.c122 = 0;
}
else
{
Candoi.d122 = (-1) * double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c122 = (-1) * double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
//123
gt = (from a in tong where a.tkcap3 == "12811" || a.tkcap3 == "12821" || a.tkcap3 == "12881" select a);
if (gt.Count() == 0)
{
Candoi.d123 = 0;
Candoi.c123 = 0;
}
else
{
Candoi.d123 = double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c123 = double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
Candoi.d120 = Candoi.d121 + Candoi.d122 + Candoi.d123;
Candoi.c120 = Candoi.c121 + Candoi.c122 + Candoi.c123;
#endregion
#region 130
//131
gt = (from a in tong where a.tkcap2 == "1311" select a);
if (gt.Count() == 0)
{
Candoi.d131 = 0;
Candoi.c131 = 0;
}
else
{
Candoi.d131 = double.Parse(gt.Sum(t => t.ctno_dau).ToString());
Candoi.c131 = double.Parse(gt.Sum(t => t.ctno_cuoi).ToString());
}
// 132
gt = (from a in tong where a.tkcap2 == "3311" select a);
if (gt.Count() == 0)
{
Candoi.d132 = 0;
Candoi.c132 = 0;
}
else
{
Candoi.d132 = double.Parse(gt.Sum(t => t.ctno_dau).ToString());
Candoi.c132 = double.Parse(gt.Sum(t => t.ctno_cuoi).ToString());
}
// 133
gt = (from a in tong where a.tkcap3 == "13621" || a.tkcap3 == "13631" || a.tkcap3 == "13681" select a);
if (gt.Count() == 0)
{
Candoi.d133 = 0;
Candoi.c133 = 0;
}
else
{
Candoi.d133 = double.Parse(gt.Sum(t => t.ctno_dau).ToString());
Candoi.c133 = double.Parse(gt.Sum(t => t.ctno_cuoi).ToString());
}
//134
gt = (from a in tong where a.tkgoc == "337" select a);
if (gt.Count() == 0)
{
Candoi.d134 = 0;
Candoi.c134 = 0;
}
else
{
Candoi.d134 = double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c134 = double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
// 135
gt = (from a in tong where a.tkcap3 == "12831" select a);
if (gt.Count() == 0)
{
Candoi.d135 = 0;
Candoi.c135 = 0;
}
else
{
Candoi.d135 = double.Parse(gt.Sum(t => t.ctno_dau).ToString());
Candoi.c135 = double.Parse(gt.Sum(t => t.ctno_cuoi).ToString());
}
// 136
gt = (from a in tong where a.tkcap3 == "13851" || a.tkcap3 == "13881" || a.tkcap2 == "3341" || a.tkcap2 == "3348" || a.tkcap2 == "3381" || a.tkcap2 == "3382" || a.tkcap2 == "3383" || a.tkcap2 == "3384" || a.tkcap2 == "3385" || a.tkcap2 == "3386" || a.tkcap3 == "33871" || a.tkcap3 == "33881" || a.tkcap2 == "1411" || a.tkcap2 == "2441" select a);
if (gt.Count() == 0)
{
Candoi.d136 = 0;
Candoi.c136 = 0;
}
else
{
Candoi.d136 = double.Parse(gt.Sum(t => t.ctno_dau).ToString());
Candoi.c136 = double.Parse(gt.Sum(t => t.ctno_cuoi).ToString());
}
// 137
gt = (from a in tong where a.tkcap3 == "22931" select a);
if (gt.Count() == 0)
{
Candoi.d137 = 0;
Candoi.c137 = 0;
}
else
{
Candoi.d137 = (-1) * double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c137 = (-1) * double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
// 139
gt = (from a in tong where a.tkcap2 == "1381" select a);
if (gt.Count() == 0)
{
Candoi.d139 = 0;
Candoi.c139 = 0;
}
else
{
Candoi.d139 = double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c139 = double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
Candoi.d130 = Candoi.d131 + Candoi.d132 + Candoi.d133 + Candoi.d134 + Candoi.d135 + Candoi.d136 + Candoi.d137 + Candoi.d139;
Candoi.c130 = Candoi.c131 + Candoi.c132 + Candoi.c133 + Candoi.c134 + Candoi.c135 + Candoi.c136 + Candoi.c137 + Candoi.c139;
#endregion
#region 140
//141
gt = (from a in tong where a.tkgoc == "151" || a.tkgoc == "152" || a.tkgoc == "153" || a.tkgoc == "154" || a.tkgoc == "155" || a.tkgoc == "156" || a.tkgoc == "157" || a.tkgoc == "158" select a);
if (gt.Count() == 0)
{
Candoi.d141 = 0;
Candoi.c141 = 0;
}
else
{
Candoi.d141 = double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c141 = double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
// 149
gt = (from a in tong where a.tkcap2 == "2294" select a);
if (gt.Count() == 0)
{
Candoi.d149 = 0;
Candoi.c149 = 0;
}
else
{
Candoi.d149 = (-1) * double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c149 = (-1) * double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
Candoi.d140 = Candoi.d141 + Candoi.d149;
Candoi.c140 = Candoi.c141 + Candoi.c149;
#endregion
#region 150
// 151
gt = (from a in tong where a.tkcap2 == "2421" select a);
if (gt.Count() == 0)
{
Candoi.d151 = 0;
Candoi.c151 = 0;
}
else
{
Candoi.d151 = double.Parse(gt.Sum(t => t.ctno_dau).ToString());
Candoi.c151 = double.Parse(gt.Sum(t => t.ctno_cuoi).ToString());
}
// 152
gt = (from a in tong where a.tkgoc == "133" select a);
if (gt.Count() == 0)
{
Candoi.d152 = 0;
Candoi.c152 = 0;
}
else
{
Candoi.d152 = double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c152 = double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
// 153
gt = (from a in tong where a.tkgoc == "333" select a);
if (gt.Count() == 0)
{
Candoi.d153 = 0;
Candoi.c153 = 0;
}
else
{
Candoi.d153 = double.Parse(gt.Sum(t => t.ctno_dau).ToString());
Candoi.c153 = double.Parse(gt.Sum(t => t.ctno_cuoi).ToString());
}
// 154
gt = (from a in tong where a.tkgoc == "171" select a);
if (gt.Count() == 0)
{
Candoi.d154 = 0;
Candoi.c154 = 0;
}
else
{
Candoi.d154 = double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c154 = double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
// 155
gt = (from a in tong where a.tkcap3 == "22881" select a);
if (gt.Count() == 0)
{
Candoi.d155 = 0;
Candoi.c155 = 0;
}
else
{
Candoi.d155 = double.Parse(gt.Sum(t => t.ctno_dau).ToString());
Candoi.c155 = double.Parse(gt.Sum(t => t.ctno_cuoi).ToString());
}
Candoi.d150 = Candoi.d151 + Candoi.d152 + Candoi.d153 + Candoi.d154 + Candoi.d155;
Candoi.c150 = Candoi.c151 + Candoi.c152 + Candoi.c153 + Candoi.c154 + Candoi.c155;
#endregion
Candoi.d100 = Candoi.d110 + Candoi.d120 + Candoi.d130 + Candoi.d140 + Candoi.d150;
Candoi.c100 = Candoi.c110 + Candoi.c120 + Candoi.c130 + Candoi.c140 + Candoi.c150;
#endregion
#region Tài sản Dài Hạn (200)
#region 210
// 211
gt = (from a in tong where a.tkcap2 == "1312" select a);
if (gt.Count() == 0)
{
Candoi.d211 = 0;
Candoi.c211 = 0;
}
else
{
Candoi.d211 = double.Parse(gt.Sum(t => t.ctno_dau).ToString());
Candoi.c211 = double.Parse(gt.Sum(t => t.ctno_cuoi).ToString());
}
// 212
gt = (from a in tong where a.tkcap2 == "3312" select a);
if (gt.Count() == 0)
{
Candoi.d212 = 0;
Candoi.c212 = 0;
}
else
{
Candoi.d212 = double.Parse(gt.Sum(t => t.ctno_dau).ToString());
Candoi.c212 = double.Parse(gt.Sum(t => t.ctno_cuoi).ToString());
}
// 213
gt = (from a in tong where a.tkcap2 == "1361" select a);
if (gt.Count() == 0)
{
Candoi.d213 = 0;
Candoi.c213 = 0;
}
else
{
Candoi.d213 = double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c213 = double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
// 214
gt = (from a in tong where a.tkcap3 == "16322" || a.tkcap3 == "13632" || a.tkcap3 == "13682" select a);
if (gt.Count() == 0)
{
Candoi.d214 = 0;
Candoi.c214 = 0;
}
else
{
Candoi.d214 = double.Parse(gt.Sum(t => t.ctno_dau).ToString());
Candoi.c214 = double.Parse(gt.Sum(t => t.ctno_cuoi).ToString());
}
//215
gt = (from a in tong where a.tkcap3 == "12832" select a);
if (gt.Count() == 0)
{
Candoi.d215 = 0;
Candoi.c215 = 0;
}
else
{
Candoi.d215 = double.Parse(gt.Sum(t => t.ctno_dau).ToString());
Candoi.c215 = double.Parse(gt.Sum(t => t.ctno_cuoi).ToString());
}
//216
gt = (from a in tong where a.tkcap3 == "13852" || a.tkcap3 == "13882" || a.tkcap2 == "3342" || a.tkcap3 == "33872" || a.tkcap3 == "33882" || a.tkcap2 == "1412" || a.tkcap2 == "2242" select a);
if (gt.Count() == 0)
{
Candoi.d216 = 0;
Candoi.c216 = 0;
}
else
{
Candoi.d216 = double.Parse(gt.Sum(t => t.ctno_dau).ToString());
Candoi.c216 = double.Parse(gt.Sum(t => t.ctno_cuoi).ToString());
}
// 219
gt = (from a in tong where a.tkcap3 == "22932" select a);
if (gt.Count() == 0)
{
Candoi.d219 = 0;
Candoi.c219 = 0;
}
else
{
Candoi.d219 = (-1) * double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c219 = (-1) * double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
Candoi.d210 = Candoi.d211 + Candoi.d212 + Candoi.d213 + Candoi.d214 + Candoi.d215 + Candoi.d216 + Candoi.d219;
Candoi.c210 = Candoi.c211 + Candoi.c212 + Candoi.c213 + Candoi.c214 + Candoi.c215 + Candoi.c216 + Candoi.c219;
#endregion
#region 220
// 221
// 222
gt = (from a in tong where a.tkgoc == "211" select a);
if (gt.Count() == 0)
{
Candoi.d222 = 0;
Candoi.c222 = 0;
}
else
{
Candoi.d222 = double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c222 = double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
// 223
gt = (from a in tong where a.tkcap2 == "2141" select a);
if (gt.Count() == 0)
{
Candoi.d223 = 0;
Candoi.c223 = 0;
}
else
{
Candoi.d223 = (-1) * double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c223 = (-1) * double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
Candoi.d221 = Candoi.d222 + Candoi.d223;
Candoi.c221 = Candoi.c222 + Candoi.c223;
// 225
gt = (from a in tong where a.tkgoc == "212" select a);
if (gt.Count() == 0)
{
Candoi.d225 = 0;
Candoi.c225 = 0;
}
else
{
Candoi.d225 = double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c225 = double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
//226
gt = (from a in tong where a.tkcap2 == "2142" select a);
if (gt.Count() == 0)
{
Candoi.d226 = 0;
Candoi.c226 = 0;
}
else
{
Candoi.d226 = (-1) * double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c226 = (-1) * double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
// 224
Candoi.d224 = Candoi.d225 + Candoi.d226;
Candoi.c224 = Candoi.c225 + Candoi.c226;
// 228
gt = (from a in tong where a.tkgoc == "213" select a);
if (gt.Count() == 0)
{
Candoi.d228 = 0;
Candoi.c228 = 0;
}
else
{
Candoi.d228 = double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c228 = double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
// 229
gt = (from a in tong where a.tkcap2 == "2143" select a);
if (gt.Count() == 0)
{
Candoi.d229 = 0;
Candoi.c229 = 0;
}
else
{
Candoi.d229 = (-1) * double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c229 = (-1) * double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
//227
Candoi.d227 = Candoi.d228 + Candoi.d229;
Candoi.c227 = Candoi.c228 + Candoi.c229;
Candoi.d220 = Candoi.d221 + Candoi.d224 + Candoi.d227;
Candoi.c220 = Candoi.c221 + Candoi.c224 + Candoi.c227;
#endregion
#region 230
//231
gt = (from a in tong where a.tkgoc == "217" select a);
if (gt.Count() == 0)
{
Candoi.d231 = 0;
Candoi.c231 = 0;
}
else
{
Candoi.d231 = double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c231 = double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
// 232
gt = (from a in tong where a.tkcap2 == "2147" select a);
if (gt.Count() == 0)
{
Candoi.d232 = 0;
Candoi.c232 = 0;
}
else
{
Candoi.d232 = (-1) * double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c232 = (-1) * double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
Candoi.d230 = Candoi.d231 + Candoi.d232;
Candoi.c230 = Candoi.c231 + Candoi.c232;
#endregion
#region 240
//241
gt = (from a in tong where a.tkgoc == "154" select a);
if (gt.Count() == 0)
{
Candoi.d241 = 0;
Candoi.c241 = 0;
}
else
{
Candoi.d241 = double.Parse(gt.Sum(t => t.ctno_dau).ToString());
Candoi.c241 = double.Parse(gt.Sum(t => t.ctno_cuoi).ToString());
}
gt = (from a in tong where a.tkcap2 == "2294" select a);
if (gt.Count() == 0)
{
Candoi.d241 = Candoi.d241 + 0;
Candoi.c241 = Candoi.c241 + 0;
}
else
{
Candoi.d241 = Candoi.d241 + double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c241 = Candoi.c241 + double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
// 242
gt = (from a in tong where a.tkgoc == "241" select a);
if (gt.Count() == 0)
{
Candoi.d242 = 0;
Candoi.c242 = 0;
}
else
{
Candoi.d242 = double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c242 = double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
Candoi.d240 = Candoi.d241 + Candoi.d242;
Candoi.c240 = Candoi.c241 + Candoi.c242;
#endregion
#region 250
// 251
gt = (from a in tong where a.tkgoc == "211" select a);
if (gt.Count() == 0)
{
Candoi.d251 = 0;
Candoi.c251 = 0;
}
else
{
Candoi.d251 = double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c251 = double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
//252
gt = (from a in tong where a.tkgoc == "222" select a);
if (gt.Count() == 0)
{
Candoi.d252 = 0;
Candoi.c252 = 0;
}
else
{
Candoi.d252 = double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c252 = double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
// 253
gt = (from a in tong where a.tkcap2 == "2281" select a);
if (gt.Count() == 0)
{
Candoi.d253 = 0;
Candoi.c253 = 0;
}
else
{
Candoi.d253 = double.Parse(gt.Sum(t => t.ctno_dau).ToString());
Candoi.c253 = double.Parse(gt.Sum(t => t.ctno_cuoi).ToString());
}
// 254
gt = (from a in tong where a.tkcap2 == "2292" select a);
if (gt.Count() == 0)
{
Candoi.d254 = 0;
Candoi.c254 = 0;
}
else
{
Candoi.d254 = (-1) * double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c254 = (-1) * double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
// 255
gt = (from a in tong where a.tkcap3 == "12812" || a.tkcap3 == "12822" || a.tkcap3 == "12882" select a);
if (gt.Count() == 0)
{
Candoi.d255 = 0;
Candoi.c255 = 0;
}
else
{
Candoi.d255 = double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c255 = double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
Candoi.d250 = Candoi.d251 + Candoi.d252 + Candoi.d253 + Candoi.d254 + Candoi.d255;
Candoi.c250 = Candoi.c251 + Candoi.c252 + Candoi.c253 + Candoi.c254 + Candoi.c255;
#endregion
#region 260
//261
gt = (from a in tong where a.tkcap2 == "2422" select a);
if (gt.Count() == 0)
{
Candoi.d261 = 0;
Candoi.c261 = 0;
}
else
{
Candoi.d261 = double.Parse(gt.Sum(t => t.ctno_dau).ToString());
Candoi.c261 = double.Parse(gt.Sum(t => t.ctno_cuoi).ToString());
}
// 262
gt = (from a in tong where a.tkgoc == "243" select a);
if (gt.Count() == 0)
{
Candoi.d262 = 0;
Candoi.c262 = 0;
}
else
{
Candoi.d262 = double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c262 = double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
//263
gt = (from a in tong where a.tkcap2 == "1534" select a);
if (gt.Count() == 0)
{
Candoi.d263 = 0;
Candoi.c263 = 0;
}
else
{
Candoi.d263 = double.Parse(gt.Sum(t => t.ctno_dau).ToString());
Candoi.c263 = double.Parse(gt.Sum(t => t.ctno_cuoi).ToString());
}
gt = (from a in tong where a.tkcap2 == "2294" select a);
if (gt.Count() == 0)
{
Candoi.d263 = Candoi.d263 + 0;
Candoi.c263 = Candoi.c263 + 0;
}
else
{
Candoi.d263 = Candoi.d263 + double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c263 = Candoi.c263 + double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
//268
gt = (from a in tong where a.tkcap3 == "22882" select a);
if (gt.Count() == 0)
{
Candoi.d268 = 0;
Candoi.c268 = 0;
}
else
{
Candoi.d268 = double.Parse(gt.Sum(t => t.ctno_dau).ToString());
Candoi.c268 = double.Parse(gt.Sum(t => t.ctno_cuoi).ToString());
}
Candoi.d260 = Candoi.d261 + Candoi.d262 + Candoi.d263 + Candoi.d268;
Candoi.c260 = Candoi.c261 + Candoi.c262 + Candoi.c263 + Candoi.c268;
#endregion
Candoi.d200 = Candoi.d210 + Candoi.d220 + Candoi.d230 + Candoi.d240 + Candoi.d250 + Candoi.d260;
Candoi.c200 = Candoi.c210 + Candoi.c220 + Candoi.c230 + Candoi.c240 + Candoi.c250 + Candoi.c260;
#endregion
#region 270
Candoi.d270 = Candoi.d100 + Candoi.d200;
Candoi.c270 = Candoi.c100 + Candoi.c200;
#endregion
#region Nợ Phải Trả (300)
#region 310
//311
gt = (from a in tong where a.tkcap2 == "3311" select a);
if (gt.Count() == 0)
{
Candoi.d311 = 0;
Candoi.c311 = 0;
}
else
{
Candoi.d311 = double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c311 = double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
// 312
gt = (from a in tong where a.tkcap2 == "1311" select a);
if (gt.Count() == 0)
{
Candoi.d312 = 0;
Candoi.c312 = 0;
}
else
{
Candoi.d312 = double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c312 = double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
// 313
gt = (from a in tong where a.tkgoc == "333" select a);
if (gt.Count() == 0)
{
Candoi.d313 = 0;
Candoi.c313 = 0;
}
else
{
Candoi.d313 = double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c313 = double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
// 314
gt = (from a in tong where a.tkcap2 == "3341" || a.tkcap2 == "3348" select a);
if (gt.Count() == 0)
{
Candoi.d314 = 0;
Candoi.c314 = 0;
}
else
{
Candoi.d314 = double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c314 = double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
//315
gt = (from a in tong where a.tkcap2 == "3351" select a);
if (gt.Count() == 0)
{
Candoi.d315 = 0;
Candoi.c315 = 0;
}
else
{
Candoi.d315 = double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c315 = double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
//316
gt = (from a in tong where a.tkcap3 == "33621" || a.tkcap3 == "33631" || a.tkcap3 == "33681" select a);
if (gt.Count() == 0)
{
Candoi.d316 = 0;
Candoi.c316 = 0;
}
else
{
Candoi.d316 = double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c316 = double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
// 317
gt = (from a in tong where a.tkgoc == "337" select a);
if (gt.Count() == 0)
{
Candoi.d317 = 0;
Candoi.c317 = 0;
}
else
{
Candoi.d317 = double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c317 = double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
//318
gt = (from a in tong where a.tkcap3 == "33871" select a);
if (gt.Count() == 0)
{
Candoi.d318 = 0;
Candoi.c318 = 0;
}
else
{
Candoi.d318 = double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c318 = double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
//319
gt = (from a in tong where a.tkcap2 == "3381" || a.tkcap2 == "3382" || a.tkcap2 == "3383" || a.tkcap2 == "3384" || a.tkcap2 == "3385" || a.tkcap2 == "3386" || a.tkcap3 == "33871" || a.tkcap3 == "33881" || a.tkcap2 == "1381" || a.tkcap2 == "3441" select a);
if (gt.Count() == 0)
{
Candoi.d319 = 0;
Candoi.c319 = 0;
}
else
{
Candoi.d319 = double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c319 = double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
// 320
gt = (from a in tong where a.tkcap3 == "34111" || a.tkcap3 == "34121" || a.matk == "343111" select a);
if (gt.Count() == 0)
{
Candoi.d320 = 0;
Candoi.c320 = 0;
}
else
{
Candoi.d320 = double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c320 = double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
// 321
gt = (from a in tong where a.tkcap3 == "35211" || a.tkcap3 == "35221" || a.tkcap3 == "35231" || a.tkcap3 == "35241" select a);
if (gt.Count() == 0)
{
Candoi.d321 = 0;
Candoi.c321 = 0;
}
else
{
Candoi.d321 = double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c321 = double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
// 322
gt = (from a in tong where a.tkgoc == "353" select a);
if (gt.Count() == 0)
{
Candoi.d322 = 0;
Candoi.c322 = 0;
}
else
{
Candoi.d322 = double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c322 = double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
// 323
gt = (from a in tong where a.tkgoc == "357" select a);
if (gt.Count() == 0)
{
Candoi.d323 = 0;
Candoi.c323 = 0;
}
else
{
Candoi.d323 = double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c323 = double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
// 324
gt = (from a in tong where a.tkgoc == "171" select a);
if (gt.Count() == 0)
{
Candoi.d324 = 0;
Candoi.c324 = 0;
}
else
{
Candoi.d324 = double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c324 = double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
Candoi.d310 = Candoi.d311 + Candoi.d312 + Candoi.d313 + Candoi.d314 + Candoi.d315 + Candoi.d316 + Candoi.d317 + Candoi.d318 + Candoi.d319 + Candoi.d320 + Candoi.d321 + Candoi.d322 + Candoi.d323 + Candoi.d324;
Candoi.c310 = Candoi.c311 + Candoi.c312 + Candoi.c313 + Candoi.c314 + Candoi.c315 + Candoi.c316 + Candoi.c317 + Candoi.c318 + Candoi.c319 + Candoi.c320 + Candoi.c321 + Candoi.c322 + Candoi.c323 + Candoi.c324;
#endregion
#region 330
//331
gt = (from a in tong where a.tkcap2 == "3312" select a);
if (gt.Count() == 0)
{
Candoi.d331 = 0;
Candoi.c331 = 0;
}
else
{
Candoi.d331 = double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c331 = double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
//332
gt = (from a in tong where a.tkcap2 == "1312" select a);
if (gt.Count() == 0)
{
Candoi.d332 = 0;
Candoi.c332 = 0;
}
else
{
Candoi.d332 = double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c332 = double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
//333
gt = (from a in tong where a.tkcap2 == "3352" select a);
if (gt.Count() == 0)
{
Candoi.d333 = 0;
Candoi.c333 = 0;
}
else
{
Candoi.d333 = double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c333 = double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
// 334
gt = (from a in tong where a.tkcap3 == "3361" select a);
if (gt.Count() == 0)
{
Candoi.d334 = 0;
Candoi.c334 = 0;
}
else
{
Candoi.d334 = double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c334 = double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
//335
gt = (from a in tong where a.tkcap3 == "33622" || a.tkcap3 == "33632" || a.tkcap3 == "33682" select a);
if (gt.Count() == 0)
{
Candoi.d316 = 0;
Candoi.c316 = 0;
}
else
{
Candoi.d316 = double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c316 = double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
// 336
gt = (from a in tong where a.tkcap3 == "33872" select a);
if (gt.Count() == 0)
{
Candoi.d336 = 0;
Candoi.c336 = 0;
}
else
{
Candoi.d336 = double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c336 = double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
//337
gt = (from a in tong where a.tkcap3 == "33882" || a.tkcap2 == "3342" select a);
if (gt.Count() == 0)
{
Candoi.d337 = 0;
Candoi.c337 = 0;
}
else
{
Candoi.d337 = double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c337 = double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
// 338
gt = (from a in tong where a.tkcap3 == "34112" || a.tkcap3 == "34122" select a);
if (gt.Count() == 0)
{
Candoi.d338 = 0;
Candoi.c338 = 0;
}
else
{
Candoi.d338 = double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c338 = double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
gt = (from a in tong where a.matk == "343112" select a);
if (gt.Count() == 0)
{
Candoi.d338 = Candoi.d338 + 0;
Candoi.c338 = Candoi.c338 + 0;
}
else
{
Candoi.d338 = Candoi.d338 - double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c338 = Candoi.c338 - double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
gt = (from a in tong where a.tkcap3 == "34312" select a);
if (gt.Count() == 0)
{
Candoi.d338 = Candoi.d338 + 0;
Candoi.c338 = Candoi.c338 + 0;
}
else
{
Candoi.d338 = Candoi.d338 - double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c338 = Candoi.c338 - double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
gt = (from a in tong where a.tkcap3 == "34313" select a);
if (gt.Count() == 0)
{
Candoi.d338 = Candoi.d338 + 0;
Candoi.c338 = Candoi.c338 + 0;
}
else
{
Candoi.d311 = Candoi.d338 + double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c338 = Candoi.c338 + double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
// 339
gt = (from a in tong where a.tkcap2 == "3432" select a);
if (gt.Count() == 0)
{
Candoi.d339 = 0;
Candoi.c339 = 0;
}
else
{
Candoi.d339 = double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c339 = double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
// 340
gt = (from a in tong where a.tkcap3 == "41112" select a);
if (gt.Count() == 0)
{
Candoi.d340 = 0;
Candoi.c340 = 0;
}
else
{
Candoi.d340 = double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c340 = double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
// 341
gt = (from a in tong where a.tkgoc == "347" select a);
if (gt.Count() == 0)
{
Candoi.d341 = 0;
Candoi.c341 = 0;
}
else
{
Candoi.d341 = double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c341 = double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
// 342
gt = (from a in tong where a.tkcap3 == "35212" || a.tkcap3 == "35222" || a.tkcap3 == "35232" || a.tkcap3 == "35242" select a);
if (gt.Count() == 0)
{
Candoi.d342 = 0;
Candoi.c342 = 0;
}
else
{
Candoi.d342 = double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c342 = double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
//343
gt = (from a in tong where a.tkgoc == "356" select a);
if (gt.Count() == 0)
{
Candoi.d343 = 0;
Candoi.c343 = 0;
}
else
{
Candoi.d343 = double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c343 = double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
// 330
Candoi.d330 = Candoi.d331 + Candoi.d332 + Candoi.d333 + Candoi.d334 + Candoi.d335 + Candoi.d336 + Candoi.d337 + Candoi.d338 + Candoi.d339 + Candoi.d340 + Candoi.d341 + Candoi.d342 + Candoi.d343;
Candoi.c330 = Candoi.c331 + Candoi.c332 + Candoi.c333 + Candoi.c334 + Candoi.c335 + Candoi.c336 + Candoi.c337 + Candoi.c338 + Candoi.c339 + Candoi.c340 + Candoi.c341 + Candoi.c342 + Candoi.c343;
#endregion
Candoi.d300 = Candoi.d310 + Candoi.d330;
Candoi.c300 = Candoi.c310 + Candoi.c330;
#endregion
#region 400
#region 410
//411a
gt = (from a in tong where a.tkcap3 == "41111" select a);
if (gt.Count() == 0)
{
Candoi.d411a = 0;
Candoi.c411a = 0;
}
else
{
Candoi.d411a = double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c411a = double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
//411b
gt = (from a in tong where a.matk == "41112" select a);
if (gt.Count() == 0)
{
Candoi.d411b = 0;
Candoi.c411b = 0;
}
else
{
Candoi.d411b = double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c411b = double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
// 411
Candoi.d411 = Candoi.d411a + Candoi.d411b;
// 412
gt = (from a in tong where a.tkcap2 == "4112" select a);
if (gt.Count() == 0)
{
Candoi.d412 = 0;
Candoi.c412 = 0;
}
else
{
Candoi.d412 = double.Parse(gt.Sum(t => t.psco_dau).ToString()) - double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c412 = double.Parse(gt.Sum(t => t.psco_cuoi).ToString()) - double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
// 413
gt = (from a in tong where a.tkcap2 == "4113" select a);
if (gt.Count() == 0)
{
Candoi.d413 = 0;
Candoi.c413 = 0;
}
else
{
Candoi.d413 = double.Parse(gt.Sum(t => t.ctco_dau).ToString());
Candoi.c413 = double.Parse(gt.Sum(t => t.ctco_cuoi).ToString());
}
// 414
gt = (from a in tong where a.tkcap2 == "4118" select a);
if (gt.Count() == 0)
{
Candoi.d414 = 0;
Candoi.c414 = 0;
}
else
{
Candoi.d414 = double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c414 = double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
//415
gt = (from a in tong where a.tkgoc == "419" select a);
if (gt.Count() == 0)
{
Candoi.d415 = 0;
Candoi.c415 = 0;
}
else
{
Candoi.d415 = (-1) * double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c415 = (-1) * double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
//416
gt = (from a in tong where a.tkgoc == "412" select a);
if (gt.Count() == 0)
{
Candoi.d416 = 0;
Candoi.c416 = 0;
}
else
{
Candoi.d416 = double.Parse(gt.Sum(t => t.psco_dau).ToString()) - double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c416 = double.Parse(gt.Sum(t => t.psco_cuoi).ToString()) - double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
// 417
gt = (from a in tong where a.tkgoc == "413" select a);
if (gt.Count() == 0)
{
Candoi.d417 = 0;
Candoi.c417 = 0;
}
else
{
Candoi.d417 = double.Parse(gt.Sum(t => t.psco_dau).ToString()) - double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c417 = double.Parse(gt.Sum(t => t.psco_cuoi).ToString()) - double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
//418
gt = (from a in tong where a.tkgoc == "414" select a);
if (gt.Count() == 0)
{
Candoi.d418 = 0;
Candoi.c418 = 0;
}
else
{
Candoi.d418 = double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c418 = double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
//419
gt = (from a in tong where a.tkgoc == "417" select a);
if (gt.Count() == 0)
{
Candoi.d419 = 0;
Candoi.c419 = 0;
}
else
{
Candoi.d419 = double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c419 = double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
// 420
gt = (from a in tong where a.tkgoc == "418" select a);
if (gt.Count() == 0)
{
Candoi.d420 = 0;
Candoi.c420 = 0;
}
else
{
Candoi.d420 = double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c420 = double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
//421a
//gt = (from a in tong where a.tkcap2 == "4211" select a);
var lst4212 = (from a in db.ct_tks
join b in db.dk_rps on a.iddv equals b.id
where b.user == Biencucbo.idnv && b.loai == "Đơn vị - ຫົວໜ່ວຍ" && b.form == "f_bangcandoiketoan"
where a.tk_no == "911" || a.tk_co == "911"
where a.ngaychungtu < tungay.DateTime
select a);
if (lst4212.Count() == 0)
{
Candoi.c421a = 0;
}
else
{
var co = (from a in lst4212
select new
{
co = a.tk_co == "911" ? a.PS : 0,
}).Sum(t => t.co);
var no = (from a in lst4212
select new
{
no = a.tk_no == "911" ? a.PS : 0
}).Sum(t => t.no);
double? b = co - no;
Candoi.c421a = double.Parse(b.ToString());
}
//421b
//gt = (from a in tong where a.tkcap2 == "4212" select a);
lst4212 = (from a in db.ct_tks
join b in db.dk_rps on a.iddv equals b.id
where b.user == Biencucbo.idnv && b.loai == "Đơn vị - ຫົວໜ່ວຍ" && b.form == "f_bangcandoiketoan"
where a.tk_no == "911" || a.tk_co == "911"
where a.ngaychungtu < tungay.DateTime
select a);
if (lst4212.Count() == 0)
{
Candoi.d421b = 0;
}
else
{
var co = (from a in lst4212
select new
{
co = a.tk_co == "911" ? a.PS : 0,
}).Sum(t => t.co);
var no = (from a in lst4212
select new
{
no = a.tk_no == "911" ? a.PS : 0
}).Sum(t => t.no);
double? b = co - no;
Candoi.d421b = double.Parse(b.ToString());
}
// cuoi ky
lst4212 = (from a in db.ct_tks
join b in db.dk_rps on a.iddv equals b.id
where b.user == Biencucbo.idnv && b.loai == "Đơn vị - ຫົວໜ່ວຍ" && b.form == "f_bangcandoiketoan"
where a.tk_no == "911" || a.tk_co == "911"
where a.ngaychungtu >= tungay.DateTime && a.ngaychungtu <= denngay.DateTime
select a);
if (lst4212.Count() == 0)
{
Candoi.c421b = 0;
}
else
{
var co = (from a in lst4212
select new
{
co = a.tk_co == "911" ? a.PS : 0,
}).Sum(t => t.co);
var no = (from a in lst4212
select new
{
no = a.tk_no == "911" ? a.PS : 0
}).Sum(t => t.no);
double? b = co - no;
Candoi.c421b = double.Parse(b.ToString());
}
//421
Candoi.d421 = Candoi.d421a + Candoi.d421b;
Candoi.c421 = Candoi.c421a + Candoi.c421b;
// 422
gt = (from a in tong where a.tkgoc == "441" select a);
if (gt.Count() == 0)
{
Candoi.d422 = 0;
Candoi.c422 = 0;
}
else
{
Candoi.d422 = double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c422 = double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
// 410
Candoi.d410 = Candoi.d411 + Candoi.d412 + Candoi.d413 + Candoi.d414 + Candoi.d415 + Candoi.d416 + Candoi.d417 + Candoi.d418 + Candoi.d419 + Candoi.d420 + Candoi.d421 + Candoi.d422;
Candoi.c410 = Candoi.c411 + Candoi.c412 + Candoi.c413 + Candoi.c414 + Candoi.c415 + Candoi.c416 + Candoi.c417 + Candoi.c418 + Candoi.c419 + Candoi.c420 + Candoi.c421 + Candoi.c422;
#endregion
#region 430
//431
gt = (from a in tong where a.tkgoc == "461" select a);
if (gt.Count() == 0)
{
Candoi.d431 = 0;
Candoi.c431 = 0;
}
else
{
Candoi.d431 = double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c431 = double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
gt = (from a in tong where a.tkgoc == "161" select a);
if (gt.Count() != 0)
{
Candoi.d431 = Candoi.d431 - double.Parse(gt.Sum(t => t.psno_dau).ToString());
Candoi.c431 = Candoi.c431 - double.Parse(gt.Sum(t => t.psno_cuoi).ToString());
}
// 432
gt = (from a in tong where a.tkgoc == "466" select a);
if (gt.Count() == 0)
{
Candoi.d432 = 0;
Candoi.c432 = 0;
}
else
{
Candoi.d432 = double.Parse(gt.Sum(t => t.psco_dau).ToString());
Candoi.c432 = double.Parse(gt.Sum(t => t.psco_cuoi).ToString());
}
// 430
Candoi.d430 = Candoi.d431 + Candoi.d432;
Candoi.c430 = Candoi.c431 + Candoi.c432;
#endregion
// 400
Candoi.d400 = Candoi.d410 + Candoi.d430;
Candoi.c400 = Candoi.c410 + Candoi.c430;
#endregion
//440
Candoi.d440 = Candoi.d300 + Candoi.d400;
Candoi.c440 = Candoi.c300 + Candoi.c400;
r_candoiketoan200 xtra = new r_candoiketoan200();
ReportPrintTool rpt = new ReportPrintTool(xtra);
rpt.PreviewForm.MdiParent = Application.OpenForms[0];
rpt.PreviewForm.Text = "Báo Cáo Bảng Cân Đối Kế Toán";
rpt.ShowPreview();
//ReportPrintTool printTool = new ReportPrintTool(xtra);
//printTool.PreviewRibbonForm.MdiParent = this; /*(System.Windows.Forms.Form)Application.MainWindow.Template;*/
//printTool.ShowRibbonPreview();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
SplashScreenManager.CloseForm(false);
}
string catchuoi(string a)
{
string b;
b = a.Substring(0, 3);
return b;
}
string tkc2(string a)
{
string b;
if (a.Length >= 4)
{
b = a.Substring(0, 4);
return b;
}
else
{
b = a.Substring(0, 3);
return b;
}
}
string tkc3(string a)
{
string b;
if (a.Length >= 5)
{
b = a.Substring(0, 5);
return b;
}
else
{
b = a.Substring(0, 3);
return b;
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace MprGenerationContracts
{
/// <summary>
///
/// </summary>
public enum Orientation { Transverse, Coronal, Sagittal };
/// <summary>
///
/// </summary>
[DataContract]
public class MprGenerationRequestV1
{
[DataMember]
public DateTime RequestTime
{
get;
set;
}
[DataMember]
public Guid ImageVolumeId
{
get;
set;
}
[DataMember]
public Orientation Orientation
{
get;
set;
}
[DataMember]
public int SlicePosition
{
get;
set;
}
[DataMember]
public int WindowCenter
{
get;
set;
}
[DataMember]
public int WindowWidth
{
get;
set;
}
}
}
|
using System;
namespace MatrixMassiv
{
public class Class1
{
}
}
|
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Proyecto_Web.Modelos;
namespace Proyecto_Web.Vistas.Private
{
public partial class index_admin : System.Web.UI.Page
{
USUARIO Mod_Usuario = new USUARIO();
PROVEEDOR mo_pro = new PROVEEDOR();
DataTable DT_CANT_USER;
public string cant_user,cant_prueba;
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (Session["CORREO_ELECTRONICO"].ToString().Equals(null))
{
Response.Redirect("~/Vistas/Public/Index.aspx");
}
}
catch (Exception)
{
Response.Redirect("~/Vistas/Public/Index.aspx");
}
DT_CANT_USER = Mod_Usuario.ConsultarCant_Usuarios();
if (!IsPostBack)
{
try
{
cant_user = DT_CANT_USER.Rows[0]["COUNT(usuario.USU_CORREO_ELECTRONICO)"].ToString();
cant_prueba = mo_pro.ConsultarNumero_pruebas().Rows[0]["COUNT(ID_RESULTADOS_PRUEBAS)"].ToString();
}
catch (Exception)
{
cant_user = "0";
}
}
else
{
}
}
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Script.Serialization;
using Lab2.Models;
namespace Lab2.Controllers
{
[Route("[controller]")]
public class HomeController : Controller
{
JavaScriptSerializer _js = new JavaScriptSerializer();
[HttpGet]
public ActionResult Index()
{
//ViewBag.ResultValue = _js.Serialize(new {result = Result.result});
return View();
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Data.Core;
using LearningEnglishWeb.Areas.Training.Infrastructure.Factories.Abstractions;
using LearningEnglishWeb.Areas.Training.Models;
using LearningEnglishWeb.Areas.Training.Models.CollectWord;
using LearningEnglishWeb.Areas.Training.Services;
using LearningEnglishWeb.Areas.Training.Services.Dtos;
namespace LearningEnglishWeb.Areas.Training.Infrastructure.Factories
{
public class CollectWordTrainingFactory : TrainingFactoryBase<CollectWordTraining>
{
public CollectWordTrainingFactory(ITrainingService trainingService, TrainingSettings trainingSettings)
: base(trainingService, TrainingTypeEnum.CollectWord, trainingSettings)
{
}
public override async Task<CollectWordTraining> GetTraining()
{
IEnumerable<QuestionWithLettersDto> questionsDto = await GetQuestions<QuestionWithLettersDto>();
var questions = questionsDto.Select(q => new CollectWordQuestion(q.Number, q.ToUserWord(), q.AnswerLetters));
return new CollectWordTraining(questions, TrainingSettings.IsReverseWay);
}
}
}
|
using System.Collections.Generic;
namespace JKMServices.BLL.EmailEngine
{
public interface IEmailTemplate
{
bool Send<T>(List<T> obj, int numberOfTimeToTry = 1, string[] attachments = null);
void MailConfiguration(string customerId, string templateCode);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace qmaster
{
public partial class staff_home : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = "<b><font color=Brown>" + "WELLCOME STAFF:: " + "</font>" + "<b><font color=red>" + Session["staff_id"] + "</font>";
}
protected void Button1_Click(object sender, EventArgs e)
{
Session.Abandon();
Session.Clear();
Response.Redirect("login.aspx");
}
}
} |
namespace RedLine.Models.Browsers.Edge
{
public enum VAULT_ELEMENT_TYPE
{
Undefined = -1,
Boolean,
Short,
UnsignedShort,
Int,
UnsignedInt,
Double,
Guid,
String,
ByteArray,
TimeStamp,
ProtectedArray,
Attribute,
Sid,
Last
}
}
|
using Caliburn.Micro;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TacticalMaddiAdminTool.Services;
namespace TacticalMaddiAdminTool.ViewModels
{
public class SetsViewModel : Screen
{
public SetsViewModel(SetsProvider setsProvider, ItemsViewModel setsViewModel)
{
DisplayName = "Sets";
setsViewModel.SetItemsProvider(setsProvider);
Items = setsViewModel;
}
public ItemsViewModel Items { get; private set; }
}
}
|
using Controller;
using Coolables;
using UnityEngine;
using UnityEngine.UI;
namespace Submarine
{
public class SubmarineEngine : CoolableComponent, IControllable
{
private Vector2 _motorControll;
private Rigidbody2D _rigidbody2D;
public int EnginePower;
public Text MotorHeatText;
protected override int TemperatureFactor
{
get { return 100; }
}
protected override int CriticalTemp
{
get { return 200; }
}
public void UpdateAxis(Vector2 controllVector)
{
_motorControll = controllVector;
}
private void OnEnable()
{
_rigidbody2D = GetComponent<Rigidbody2D>();
Heat = 10;
ControllerManager.Target = gameObject;
}
private void FixedUpdate()
{
Ui();
var weightLift = _rigidbody2D.mass*0.8f;
var baseLift = weightLift*Vector2.up;
var baseFactor = 1f;
if (IsHeatCritical())
baseFactor = baseFactor/2.2f;
var force = baseFactor*EnginePower*_motorControll;
Heat += (int) force.magnitude/45;
_rigidbody2D.AddForce(force + baseLift);
}
private void Ui()
{
if (MotorHeatText == null)
return;
var temp = GetTemperature();
MotorHeatText.text = string.Format("Engine: {0}°C", temp);
if (IsHeatCritical())
MotorHeatText.color = Color.red;
else
MotorHeatText.color = Color.black;
}
public override int GetMaxHeatTransfere()
{
var fastCooling = Mathf.Max((int) Mathf.Log10(Heat), 0);
return 15 + 4*fastCooling;
}
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
namespace lwenctools
{
public class MPEG1VideoSettings : IExecutionPlanSettings
{
public int MaxSlices { get; set; }
public bool TwoPass { get; set; }
public bool AutoRD { get; set; }
public bool FullRange { get; set; }
public int NumBFrames { get; set; }
public int BStrategy { get; set; }
public bool UseCBR { get; set; }
public bool UseQuality { get; set; }
public int Quality { get; set; }
public int BitrateMinPresetIndex { get; set; }
public int BitrateMin { get; set; }
public int BitrateMaxPresetIndex { get; set; }
public int BitrateMax { get; set; }
public int BitrateBufferSize { get; set; }
public int MotionEstimationPresetIndex { get; set; }
void IExecutionPlanSettings.LoadFromXml(XmlElement xml)
{
int temp;
if (int.TryParse(xml.GetAttribute("MaxSlices"), out temp))
MaxSlices = temp;
TwoPass = (xml.GetAttribute("TwoPass") != "False");
AutoRD = (xml.GetAttribute("AutoRD") != "False");
FullRange = (xml.GetAttribute("FullRange") != "False");
if (int.TryParse(xml.GetAttribute("BFrames"), out temp))
NumBFrames = temp;
if (int.TryParse(xml.GetAttribute("BStrategy"), out temp))
BStrategy = temp;
UseCBR = (xml.GetAttribute("UseCBR") != "False");
UseQuality = (xml.GetAttribute("UseQuality") != "False");
if (int.TryParse(xml.GetAttribute("Quality"), out temp))
Quality = temp;
if (int.TryParse(xml.GetAttribute("BitrateMinPreset"), out temp))
BitrateMinPresetIndex = temp;
if (int.TryParse(xml.GetAttribute("BitrateMin"), out temp))
BitrateMin = temp;
if (int.TryParse(xml.GetAttribute("BitrateBufferSize"), out temp))
BitrateBufferSize = temp;
if (int.TryParse(xml.GetAttribute("BitrateMaxPreset"), out temp))
BitrateMaxPresetIndex = temp;
if (int.TryParse(xml.GetAttribute("BitrateMax"), out temp))
BitrateMax = temp;
if (int.TryParse(xml.GetAttribute("MotionEstimationPresetIndex"), out temp))
MotionEstimationPresetIndex = temp;
}
void IExecutionPlanSettings.SaveToXml(XmlElement xml)
{
xml.SetAttribute("MaxSlices", MaxSlices.ToString());
xml.SetAttribute("TwoPass", TwoPass ? "True" : "False");
xml.SetAttribute("AutoRD", AutoRD ? "True" : "False");
xml.SetAttribute("FullRange", FullRange ? "True" : "False");
xml.SetAttribute("BFrames", NumBFrames.ToString());
xml.SetAttribute("BStrategy", BStrategy.ToString());
xml.SetAttribute("UseCBR", UseCBR ? "True" : "False");
xml.SetAttribute("UseQuality", UseQuality ? "True" : "False");
xml.SetAttribute("Quality", Quality.ToString());
xml.SetAttribute("BitrateMinPreset", BitrateMinPresetIndex.ToString());
xml.SetAttribute("BitrateMin", BitrateMin.ToString());
xml.SetAttribute("BitrateBufferSize", BitrateBufferSize.ToString());
xml.SetAttribute("BitrateMaxPreset", BitrateMaxPresetIndex.ToString());
xml.SetAttribute("BitrateMax", BitrateMax.ToString());
xml.SetAttribute("MotionEstimationPresetIndex", MotionEstimationPresetIndex.ToString());
}
void IExecutionPlanSettings.CreateCommands(List<ExecutionPlan> plans, Dictionary<string, object> externalSettings, PlanCompletionDelegate pcd)
{
string lwmuxPath = (string)externalSettings["lwmuxPath"];
string rerangePath = (string)externalSettings["lwrerangePath"];
string ffmpegPath = (string)externalSettings["ffmpegPath"];
string inputFile = (string)externalSettings["InputFile"];
string outputFile = (string)externalSettings["OutputFile"];
List<string> ffEncArgs = new List<string>();
List<string> ffPass1Args = new List<string>();
List<string> ffPass2Args = new List<string>();
ffEncArgs.Add("-idct");
ffEncArgs.Add("int");
if (MaxSlices > 0)
{
ffEncArgs.Add("-slices");
ffEncArgs.Add(MaxSlices.ToString());
}
if (AutoRD)
{
ffEncArgs.Add("-trellis");
ffEncArgs.Add("2");
ffEncArgs.Add("-mbd");
ffEncArgs.Add("rd");
ffEncArgs.Add("-cmp");
ffEncArgs.Add("2");
ffEncArgs.Add("-subcmp");
ffEncArgs.Add("2");
ffEncArgs.Add("-skipcmp");
ffEncArgs.Add("2");
ffEncArgs.Add("-mbcmp");
ffEncArgs.Add("2");
ffEncArgs.Add("-mpv_flags");
ffEncArgs.Add("+qp_rd+mv0");
}
ffEncArgs.Add("-bf");
ffEncArgs.Add(NumBFrames.ToString());
ffPass1Args.Add("-b_strategy");
ffPass1Args.Add(BStrategy.ToString());
if (UseCBR)
{
ffEncArgs.Add("-b:v");
ffEncArgs.Add(((BitrateMin + BitrateMax) / 2).ToString() + "k");
ffEncArgs.Add("-minrate");
ffEncArgs.Add(BitrateMin.ToString() + "k");
}
if (UseQuality)
{
ffEncArgs.Add("-q:v");
ffEncArgs.Add((32 - Quality).ToString());
// Stupid trick to avoid problems where ffmpeg rejects the video because the bitrate is too low, even though
// it'll make no attempt to actually hit the rate.
ffEncArgs.Add("-b:v");
ffEncArgs.Add(BitrateMax.ToString() + "k");
}
ffEncArgs.Add("-threads");
ffEncArgs.Add(Environment.ProcessorCount.ToString());
ffEncArgs.Add("-an");
ffEncArgs.Add("-y");
ffEncArgs.Add("-maxrate");
ffEncArgs.Add(BitrateMax.ToString() + "k");
if (TwoPass)
{
// Pass 1
{
ExecutionPlan plan = new ExecutionPlan();
if (FullRange)
{
// Loading stage
{
List<string> stageArgs = new List<string>();
stageArgs.Add("-i");
stageArgs.Add(inputFile);
stageArgs.Add("-f");
stageArgs.Add("yuv4mpegpipe");
stageArgs.Add("-strict");
stageArgs.Add("-1");
stageArgs.Add("-pix_fmt");
stageArgs.Add("yuv420p12le");
stageArgs.Add("-");
plan.AddStage(new ExecutionStage(ffmpegPath, stageArgs.ToArray()));
}
// Rerange stage
{
plan.AddStage(new ExecutionStage(rerangePath, new string[0]));
}
// Encoding stage
{
List<string> stageArgs = new List<string>();
stageArgs.Add("-i");
stageArgs.Add("-");
stageArgs.AddRange(ffEncArgs);
stageArgs.AddRange(ffPass1Args);
stageArgs.Add("-f");
stageArgs.Add("mpeg1video");
stageArgs.Add("-pass");
stageArgs.Add("1");
stageArgs.Add("-passlogfile");
stageArgs.Add(outputFile + ".p");
stageArgs.Add("NUL");
plan.AddStage(new ExecutionStage(ffmpegPath, stageArgs.ToArray()));
}
}
else
{
List<string> stageArgs = new List<string>();
stageArgs.Add("-i");
stageArgs.Add(inputFile);
stageArgs.AddRange(ffEncArgs);
stageArgs.AddRange(ffPass1Args);
stageArgs.Add("-f");
stageArgs.Add("mpeg1video");
stageArgs.Add("-pass");
stageArgs.Add("1");
stageArgs.Add("-passlogfile");
stageArgs.Add(outputFile + ".p");
stageArgs.Add("NUL");
plan.AddStage(new ExecutionStage(ffmpegPath, stageArgs.ToArray()));
}
plan.AddTemporaryFile(outputFile + ".p-0.log");
plans.Add(plan);
}
// Pass 2
{
ExecutionPlan plan = new ExecutionPlan();
if (FullRange)
{
// Loading stage
{
List<string> stageArgs = new List<string>();
stageArgs.Add("-i");
stageArgs.Add(inputFile);
stageArgs.Add("-f");
stageArgs.Add("yuv4mpegpipe");
stageArgs.Add("-strict");
stageArgs.Add("-1");
stageArgs.Add("-pix_fmt");
stageArgs.Add("yuv420p12le");
stageArgs.Add("-");
plan.AddStage(new ExecutionStage(ffmpegPath, stageArgs.ToArray()));
}
// Rerange stage
{
plan.AddStage(new ExecutionStage(rerangePath, new string[0]));
}
// Encoding stage
{
List<string> stageArgs = new List<string>();
stageArgs.Add("-i");
stageArgs.Add("-");
stageArgs.AddRange(ffEncArgs);
stageArgs.AddRange(ffPass2Args);
stageArgs.Add("-f");
stageArgs.Add("mpeg1video");
stageArgs.Add("-pass");
stageArgs.Add("2");
stageArgs.Add("-passlogfile");
stageArgs.Add(outputFile + ".p");
stageArgs.Add(outputFile + ".m1v");
plan.AddStage(new ExecutionStage(ffmpegPath, stageArgs.ToArray()));
}
}
else
{
List<string> stageArgs = new List<string>();
stageArgs.Add("-i");
stageArgs.Add(inputFile);
stageArgs.AddRange(ffEncArgs);
stageArgs.AddRange(ffPass2Args);
stageArgs.Add("-f");
stageArgs.Add("mpeg1video");
stageArgs.Add("-pass");
stageArgs.Add("2");
stageArgs.Add("-passlogfile");
stageArgs.Add(outputFile + ".p");
stageArgs.Add(outputFile + ".m1v");
plan.AddStage(new ExecutionStage(ffmpegPath, stageArgs.ToArray()));
}
plan.AddCleanupFile(outputFile + ".p-0.log");
plan.AddTemporaryFile(outputFile + ".m1v");
plans.Add(plan);
}
}
else
{
// 1-pass mode
ExecutionPlan plan = new ExecutionPlan();
if (FullRange)
{
// Loading stage
{
List<string> stageArgs = new List<string>();
stageArgs.Add("-i");
stageArgs.Add(inputFile);
stageArgs.Add("-f");
stageArgs.Add("yuv4mpegpipe");
stageArgs.Add("-strict");
stageArgs.Add("-1");
stageArgs.Add("-pix_fmt");
stageArgs.Add("yuv420p12le");
stageArgs.Add("-");
plan.AddStage(new ExecutionStage(ffmpegPath, stageArgs.ToArray()));
}
// Rerange stage
{
plan.AddStage(new ExecutionStage(rerangePath, new string[0]));
}
// Encoding stage
{
List<string> stageArgs = new List<string>();
stageArgs.Add("-i");
stageArgs.Add("-");
stageArgs.AddRange(ffEncArgs);
stageArgs.AddRange(ffPass1Args);
stageArgs.AddRange(ffPass2Args);
stageArgs.Add("-f");
stageArgs.Add("mpeg1video");
stageArgs.Add(outputFile + ".m1v");
plan.AddStage(new ExecutionStage(ffmpegPath, stageArgs.ToArray()));
}
}
else
{
List<string> stageArgs = new List<string>();
stageArgs.Add("-i");
stageArgs.Add(inputFile);
stageArgs.AddRange(ffEncArgs);
stageArgs.AddRange(ffPass1Args);
stageArgs.AddRange(ffPass2Args);
stageArgs.Add("-f");
stageArgs.Add("mpeg1video");
stageArgs.Add(outputFile + ".m1v");
plan.AddStage(new ExecutionStage(ffmpegPath, stageArgs.ToArray()));
}
plan.AddTemporaryFile(outputFile + ".m1v");
plans.Add(plan);
}
// M1V import
{
ExecutionPlan plan = new ExecutionPlan();
List<string> args = new List<string>();
args.Add("importm1v");
args.Add(outputFile + ".m1v");
args.Add(outputFile);
if (FullRange)
args.Add("1");
else
args.Add("0");
plan.AddStage(new ExecutionStage(lwmuxPath, args.ToArray()));
plan.CompletionCallback = pcd;
plan.AddCleanupFile(outputFile + ".m1v");
plans.Add(plan);
}
}
bool IExecutionPlanSettings.Validate(List<string> outErrors)
{
bool isOK = true;
if (UseCBR)
{
if (BitrateMax < BitrateMin)
{
outErrors.Add("M1V: Bitrate minimum was set higher than bitrate maximum");
isOK = false;
}
}
return isOK;
}
public MPEG1VideoSettings()
{
Quality = 20;
UseQuality = true;
BitrateMaxPresetIndex = 3;
NumBFrames = 5;
BStrategy = 1;
MotionEstimationPresetIndex = 0;
BitrateMinPresetIndex = 3;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrainDuelsLib.widgets;
using BrainDuelsLib.web;
using BrainDuelsLib.threads;
using UnityEngine;
using Assets;
using BrainDuelsLib.model.entities;
using Assets.Go;
public partial class LobbyFormControl : ControlBase
{
public GameScrollableList gamesList;
public PlayerScrollableList playersList;
public CreateNewGamePopup createGamePopup;
public UIButton createGameButton;
public UISprite gamesListSprite;
public UISprite playerListSprite;
public UILabel createGamePopupLabel;
public UIButton createGamePopupCancelButton;
public UISprite newChallengePopup;
public UILabel newChallengeFromLabel;
public UILabel newChallengeGameString;
public UILabel newChallengeTimeString;
public UILabel newChallengeSizeString;
public UILabel newChallengeHandiString;
public UIButton acceptChallengeButton;
public UIButton rejectChallengeButton;
public class IncomingChallenge
{
public int ch;
public string title;
public string settings;
public int id;
}
public List<IncomingChallenge> incomingChallenges = new List<IncomingChallenge>();
List<Game> prev = new List<Game>();
public void callCreateGamePopup(bool isPrivate, Action action)
{
if (isPrivate)
{
createGamePopupLabel.text = "Create private challenge";
}
else
{
createGamePopupLabel.text = "Create public challenge";
}
if (Utils.IsUnvisible(createGamePopup.transform))
{
Utils.MakeVisible(createGamePopup.transform);
}
else
{
Utils.MakeUnvisible(createGamePopup.transform);
}
createGamePopup.create.isEnabled = true;
createGamePopup.create.onClick.Clear();
createGamePopup.create.onClick.Add(new EventDelegate(new EventDelegate.Callback(
delegate
{
action();
}
)));
createGamePopupCancelButton.onClick.Clear();
createGamePopupCancelButton.onClick.Add(new EventDelegate(new EventDelegate.Callback(
delegate
{
if (Utils.IsUnvisible(createGamePopup.transform))
{
Utils.MakeVisible(createGamePopup.transform);
}
else
{
Utils.MakeUnvisible(createGamePopup.transform);
}
}
)));
}
public void SetPlayBarPart(LobbyWidget lobbyWidget)
{
this.gamesListSprite.spriteName = "nicht";
this.playerListSprite.spriteName = "nicht";
GameScrollableList.me = tai.id;
this.gamesList.transform.localPosition = new Vector3(0, 0, 0);
this.playersList.transform.localPosition = new Vector3(0, -10, 0);
this.createGamePopup.transform.localPosition = new Vector3(this.createGamePopup.transform.localPosition.x, 0, 0);
this.newChallengePopup.transform.localPosition = new Vector3(this.newChallengePopup.transform.localPosition.x, 0, 0);
lobbyWidget.Callbacks.gamesCallback = UpdateGames;
lobbyWidget.Callbacks.getPlayersCallback = UpdatePlayers;
//setMock();
Utils.MakeUnvisible(createGamePopup.transform);
Utils.MakeUnvisible(this.newChallengePopup.transform);
createGameButton.onClick.Add(new EventDelegate(new EventDelegate.Callback(
delegate
{
callCreateGamePopup(false, delegate
{
Settings settings = createGamePopup.GetSettings();
String title = createGamePopup.GetGame();
if (title.Equals("hidden-move-go"))
{
settings.handi = false;
}
this.lobbyWidget.CreateNewGame(2, title, Settings.Save(settings));
if (!Utils.IsUnvisible(createGamePopup.transform))
{
Utils.MakeUnvisible(createGamePopup.transform);
}
});
}
)));
lobbyWidget.Callbacks.rejectedChallengeCallback = delegate (int a, string aa, string aaa, int aaaa)
{
if (Utils.IsUnvisible(createGamePopup.transform))
{
//Utils.MakeVisible(createGamePopup.transform);
}
else
{
Utils.MakeUnvisible(createGamePopup.transform);
}
};
lobbyWidget.Callbacks.newChallengeCallback = delegate (int a, string aa, string aaa, int aaaa)
{
for (int i = 0; i < this.incomingChallenges.Count(); i++)
{
lobbyWidget.RejectChallenge(incomingChallenges[i].ch, incomingChallenges[i].title, incomingChallenges[i].settings, incomingChallenges[i].id);
}
incomingChallenges.Clear();
IncomingChallenge me = new IncomingChallenge();
int id = a;
string title = aa;
string settings = aaa;
int chId = aaaa;
me.ch = id;
me.title = title;
me.settings = settings;
me.id = chId;
incomingChallenges.Add(me);
if (Utils.IsUnvisible(newChallengePopup.transform))
{
Utils.MakeVisible(newChallengePopup.transform);
}
User opponent = Server.GetUser(tai, id);
Settings set = Settings.Load(settings);
newChallengeFromLabel.text = opponent.login + "(" + opponent.GetRankString() + ")";
if (title.Equals("go"))
{
this.newChallengeGameString.text = "Go";
}
if (title.Equals("one-color-go"))
{
this.newChallengeGameString.text = "One color Go";
}
if (title.Equals("blind-go"))
{
this.newChallengeGameString.text = "Blind Go";
}
if (title.Equals("hidden-move-go"))
{
this.newChallengeGameString.text = "Hidden move Go";
}
this.newChallengeTimeString.text = set.GetTimeControl();
this.newChallengeHandiString.text = set.GetHandi() ? "Yes" : "No";
this.newChallengeSizeString.text = set.size + "*" + set.size;
acceptChallengeButton.onClick.Clear();
acceptChallengeButton.onClick.Add(new EventDelegate(new EventDelegate.Callback(
delegate
{
lobbyWidget.AcceptChallenge(a, aa, aaa, aaaa);
}
)));
rejectChallengeButton.onClick.Clear();
this.rejectChallengeButton.onClick.Add(new EventDelegate(new EventDelegate.Callback(
delegate
{
lobbyWidget.RejectChallenge(a, aa, aaa, aaaa);
incomingChallenges.Clear();
if (Utils.IsUnvisible(newChallengePopup.transform))
{
Utils.MakeVisible(newChallengePopup.transform);
}
else
{
Utils.MakeUnvisible(newChallengePopup.transform);
}
}
)));
};
lobbyWidget.Callbacks.expiredChallengeCallback = delegate (int chId)
{
Debug.Log("Expired " + chId);
if (incomingChallenges.Count > 0)
{
int last = incomingChallenges[incomingChallenges.Count - 1].id;
Debug.Log("Last " + last);
if (last == chId)
{
Debug.Log("Delete " + chId);
if (!Utils.IsUnvisible(newChallengePopup.transform))
{
Debug.Log("deleted");
Utils.MakeUnvisible(newChallengePopup.transform);
}
}
}
};
}
public List<int> prevPlayers = new List<int>();
public void UpdatePlayers(List<int> players)
{
if (compareLists(players, prevPlayers))
{
}
else
{
List<User> fuck = new List<User>();
for (int i = 0; i < players.Count; i++)
{
if (players[i] != tai.id)
{
fuck.Add(Server.GetUser(tai, players[i]));
}
}
playersList.Set(fuck, -30, -150, 82, OnChallenge, tai);
prevPlayers = new List<int>();
for (int i = 0; i < players.Count; i++)
{
prevPlayers.Add(players[i]);
}
}
}
public void UpdateGames(List<Game> games)
{
if (compareLists(games, prev))
{
}
else
{
gamesList.Set(games, 50, -150, 82, OnGame, tai);
}
prev = games;
}
public void setMock()
{
List<Game> list = new List<Game>();
Game game1 = new Game();
game1.settings = "board_size-19|komi-7.5|first_player-0|time-b10#15#3";
game1.status = "open";
game1.title = "one-color-go";
game1.users = new List<int>();
game1.users.Add(2501);
Game game2 = new Game();
game2.settings = "board_size-9|komi-0.5|first_player-1|time-b100#15#3";
game2.status = "open";
game2.title = "go";
game2.users = new List<int>();
game2.users.Add(2501);
Game game3 = new Game();
game3.settings = "board_size-13|komi-7.5|first_player-1|time-b10#45#3";
game3.status = "open";
game3.title = "blind-go";
game3.users = new List<int>();
game3.users.Add(2501);
Game game4 = new Game();
game4.settings = "board_size-19|komi-7.5|first_player-9|time-b1800#30#5";
game4.status = "open";
game4.title = "hidden-move-go";
game4.users = new List<int>();
game4.users.Add(2501);
for (int i = 0; i < 10; i++)
{
list.Add(game1);
list.Add(game2);
list.Add(game3);
list.Add(game4);
}
gamesList.Set(list, 0, -150, 66, OnGame, tai);
}
public bool compareLists<U>(List<U> a, List<U> b)
{
if (a.Count != b.Count)
{
return false;
}
for (int i = 0; i < a.Count; i++)
{
if (!a[i].Equals(b[i]))
{
return false;
}
}
return true;
}
public bool compareLists(List<Game> a, List<Game> b)
{
if (a.Count != b.Count)
{
return false;
}
for (int i = 0; i < a.Count; i++)
{
if (a[i].id != b[i].id)
{
return false;
}
else
{
if (a[i].status != b[i].status)
{
return false;
}
if (a[i].users.Count != b[i].users.Count)
{
return false;
}
else
{
for (int j = 0; j < a[i].users.Count; j++)
{
if (a[i].users[j] != b[i].users[j])
{
return false;
}
}
}
}
}
return true;
}
public void OnGame(Game g, int index)
{
if (index == 0)
{
lobbyWidget.Controls.backgroud.EnterGame(g.id);
}
if (index == 1)
{
lobbyWidget.Controls.backgroud.LeaveGame(g.id);
}
}
public void OnChallenge(User g, int index)
{
callCreateGamePopup(true, delegate
{
Settings settings = createGamePopup.GetSettings();
String title = createGamePopup.GetGame();
lobbyWidget.CreateNewChallenge(index, title, Settings.Save(settings));
createGamePopup.create.isEnabled = false;
createGamePopup.create.onClick.Clear();
Debug.Log("create");
this.createGamePopupCancelButton.onClick.Clear();
this.createGamePopupCancelButton.onClick.Add(new EventDelegate(new EventDelegate.Callback(
delegate
{
Debug.Log("discard");
lobbyWidget.Discard();
if (Utils.IsUnvisible(createGamePopup.transform))
{
Utils.MakeVisible(createGamePopup.transform);
}
else
{
Utils.MakeUnvisible(createGamePopup.transform);
}
}
)));
});
}
}
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("SilverBP.Extensions.Wcf")]
[assembly: AssemblyProduct("SilverBP.Extensions.Wcf")]
[assembly: AssemblyDescription("Extensions/Helper Methods for WCF")]
[assembly: ComVisible(false)]
[assembly: Guid("657dae9a-00ee-42ca-8440-0f82501fe6c1")] |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SEGU_ENTI.Entidades;
namespace SEGU_ENTI.Interfaz
{
public interface IEN_USUARIO
{
List<clsEN_USUARIO> fn_Login(string sCO_USUA, string sDE_PASS);
List<clsEN_USUARIO> fn_MOST_USUA(string sCO_USUA);
}
}
|
using NodeGraph.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace NodeGraph {
public class NodeGraphStyling : ViewModelSimpleBase {
protected CornerRadius _NodeCornerRadius = new CornerRadius(8,8,8,8);
public CornerRadius NodeCornerRadius {
get { return _NodeCornerRadius; }
set {
if (value != null || value != _NodeCornerRadius) _NodeCornerRadius = value;
OnPropertyChanged();
}
}
protected CornerRadius _NodeHeaderCornerRadius = new CornerRadius(8, 8, 0, 0);
public CornerRadius NodeHeaderCornerRadius {
get { return _NodeHeaderCornerRadius; }
set {
if (value != null || value != _NodeHeaderCornerRadius) _NodeHeaderCornerRadius = value;
OnPropertyChanged();
}
}
}
}
|
using System.Linq;
using NHibernate.Cfg.MappingSchema;
using NHibernate.Linq;
using NHibernate.Mapping.ByCode;
using NUnit.Framework;
namespace NHibernate.Test.NHSpecificTest.NH0000
{
/// <summary>
/// Fixture using 'by code' mappings
/// </summary>
/// <remarks>
/// This fixture is identical to <see cref="Fixture" /> except the <see cref="Entity" /> mapping is performed
/// by code in the GetMappings method, and does not require the <c>Mappings.hbm.xml</c> file. Use this approach
/// if you prefer.
/// </remarks>
public class FixtureByCode : TestCaseMappingByCode
{
protected override HbmMapping GetMappings()
{
var mapper = new ModelMapper();
mapper.Class<Entity>(rc =>
{
rc.Id(x => x.Id, m => m.Generator(Generators.GuidComb));
rc.Property(x => x.Name);
});
return mapper.CompileMappingForAllExplicitlyAddedEntities();
}
protected override void OnSetUp()
{
using (var session = OpenSession())
using (var transaction = session.BeginTransaction())
{
var e1 = new Entity { Name = "Bob" };
session.Save(e1);
var e2 = new Entity { Name = "Sally" };
session.Save(e2);
session.Flush();
transaction.Commit();
}
}
protected override void OnTearDown()
{
using (var session = OpenSession())
using (var transaction = session.BeginTransaction())
{
session.Delete("from System.Object");
session.Flush();
transaction.Commit();
}
}
[Test]
public void YourTestName()
{
using (var session = OpenSession())
using (session.BeginTransaction())
{
var entities = (from e in session.Query<Entity>()
where e.Name == "Bob"
select e).ToList();
Assert.AreEqual(1, entities.Count);
}
}
}
} |
using System.Collections.Generic;
namespace Tookan.NET.Core
{
public class Webhook
{
public string JobLatitude { get; set; }
public string FleetEmail { get; set; }
public string IsRouted { get; set; }
public string JobType { get; set; }
public string TeamId { get; set; }
public string AutoAssignment { get; set; }
public string JobDescription { get; set; }
public string Timezone { get; set; }
public string FleetRating { get; set; }
public string UserId { get; set; }
public string JobId { get; set; }
public string JobState { get; set; }
public string HasDelivery { get; set; }
public string PickupDeliveryRelationship { get; set; }
public string JobHash { get; set; }
public string JobAddress { get; set; }
public string JobPickupLatitude { get; set; }
public string JobPickupName { get; set; }
public string JobStatus { get; set; }
public string SignImage { get; set; }
public string CustomerUsername { get; set; }
public string CustomerEmail { get; set; }
public string OrderId { get; set; }
public string CustomerComment { get; set; }
public string CustomerPhone { get; set; }
public string IsActive { get; set; }
public string JobLongitude { get; set; }
public string DispatcherId { get; set; }
public string JobPickupLongitude { get; set; }
public string IsCustomerRated { get; set; }
public string CompletedByAdmin { get; set; }
public string CustomerId { get; set; }
public string TookanSharedSecret { get; set; }
public string TotalDistanceTravelled { get; set; }
public string TotalTimeSpentAtTaskTillCompletion { get; set; }
public string SessionId { get; set; }
public string HasPickup { get; set; }
public string JobToken { get; set; }
public string JobPickupAddress { get; set; }
public string JobPickupPhone { get; set; }
public string FleetId { get; set; }
public string FleetName { get; set; }
public string JobPickupEmail { get; set; }
public List<CustomField> CustomField { get; set; }
public List<TaskHistory> TaskHistory { get; set; }
}
} |
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PleaseThem.Controls
{
public class Button
{
private MouseState _currentMouse;
private SpriteFont _font;
private MouseState _previousMouse;
private Texture2D _texture;
public event EventHandler Click;
public Color Color { get; set; }
public bool IsClicked { get; private set; }
public bool IsHovering { get; private set; }
public Vector2 Position;
public Rectangle Rectangle { get; private set; }
public bool Selected { get; set; }
public string Text { get; set; }
public Button(Texture2D texture, SpriteFont font, Vector2 position, string text = "")
{
_texture = texture;
_font = font;
Position = position;
Rectangle = new Rectangle((int)Position.X, (int)Position.Y, _texture.Width, _texture.Height);
Color = Color.Black;
Text = text;
Selected = false;
}
public void Draw(SpriteBatch spriteBatch)
{
if (!Selected)
{
if (IsHovering)
{
spriteBatch.Draw(_texture, Rectangle, Color.Gray);
}
else
{
spriteBatch.Draw(_texture, Rectangle, Color.White);
}
}
else
{
spriteBatch.Draw(_texture, Rectangle, Color.Yellow);
}
if (!string.IsNullOrEmpty(Text))
{
float x = (Rectangle.X + (Rectangle.Width / 2)) - (_font.MeasureString(Text).X / 2);
float y = (Rectangle.Y + (Rectangle.Height / 2)) - (_font.MeasureString(Text).Y / 2);
spriteBatch.DrawString(_font, Text, new Vector2(x, y), Color);
}
}
public void Update()
{
Rectangle = new Rectangle((int)Position.X, (int)Position.Y, _texture.Width, _texture.Height);
_previousMouse = _currentMouse;
_currentMouse = Mouse.GetState();
var mouseRectangle = new Rectangle(_currentMouse.X, _currentMouse.Y, 1, 1);
IsClicked = false;
IsHovering = false;
if (mouseRectangle.Intersects(Rectangle))
{
IsHovering = true;
if (_currentMouse.LeftButton == ButtonState.Pressed && _previousMouse.LeftButton == ButtonState.Released)
{
IsClicked = true;
Click?.Invoke(this, new EventArgs());
}
}
}
}
}
|
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Core.Common {
public interface IOperation {
void ApplyParameters(IDictionary<string, string> parameters);
Task<string> ExecuteAsync();
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.