public List <OutApplication> GetConfirmHistroy(int accountID, DateTime fromTime, DateTime toTime) { List <OutApplication> iRet = new List <OutApplication>(); SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_OperatorID, SqlDbType.Int).Value = accountID; cmd.Parameters.Add(_From, SqlDbType.DateTime).Value = fromTime; cmd.Parameters.Add(_To, SqlDbType.DateTime).Value = toTime; using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetOutConfirmHistroy", cmd)) { while (sdr.Read()) { Account account = new Account(); account.Id = Convert.ToInt32(sdr[_DbAccountID]); OutApplication application = new OutApplication(Convert.ToInt32(sdr[_DbPKID]), account, Convert.ToDateTime(sdr[_DbSubmitDate]), sdr[_DbReason].ToString(), Convert.ToDateTime(sdr[_DbFrom]), Convert.ToDateTime(sdr[_DbTo]), Convert.ToDecimal(sdr[_DbCostTime]), GetOutApplicationItemByOutApplicationID(Convert.ToInt32(sdr[_DbPKID])), sdr[_DbOutLocation].ToString(), OutType.GetOutTypeByID(Convert.ToInt32(sdr[_DbOutType]))); iRet.Add(application); } return(iRet); } }
/// <summary> /// /// </summary> public OutApplication GetOutApplicationByOutApplicationID(int pKID) { OutApplication application = null; SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_PKID, SqlDbType.Int).Value = pKID; using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetOutApplicationByOutApplicationID", cmd)) { while (sdr.Read()) { List <OutApplicationItem> applicationItem = GetOutApplicationItemByOutApplicationID(Convert.ToInt32(sdr[_DbPKID])); Account account = new Account(); account.Id = Convert.ToInt32(sdr[_DbAccountID]); application = new OutApplication(pKID, account, Convert.ToDateTime(sdr[_DbSubmitDate]), sdr[_DbReason].ToString(), Convert.ToDateTime(sdr[_DbFrom]), Convert.ToDateTime(sdr[_DbTo]), Convert.ToDecimal(sdr[_DbCostTime]), applicationItem, sdr[_DbOutLocation].ToString(), OutType.GetOutTypeByID(Convert.ToInt32(sdr[_DbOutType]))); application.DiyProcess = RequestUtility.GetDiyProcess(sdr[_DbDiyProcess].ToString()); break; } } return(application); }
//查询 private void btnQuery_Click(object sender, EventArgs e) { //DateTime dtS = Convert.ToDateTime(dtOutStoreData.Text.Trim()); //DateTime dtE = Convert.ToDateTime(dtOutStoreEndData.Text.Trim() + " 23:59:59"); dsOutStore.SourceCondition = "to_char(LOGDATE,'yyyy-mm-dd') = '" + dtOutStoreData.Text + "' order by LOGDATE desc"; OutType.LoadData(); }
/// <summary> /// ShaX 加密 /// </summary> /// <typeparam name="T">哈希算法</typeparam> /// <param name="value">待加密的值</param> /// <param name="encoding">编码</param> /// <param name="outType">输出类型</param> /// <returns></returns> internal static string Encrypt <T>(string value, Encoding encoding, OutType outType) where T : HashAlgorithm, new() { value.CheckNotNullOrEmpty(nameof(value)); if (encoding == null) { encoding = Encoding.UTF8; } byte[] bytes = encoding.GetBytes(value); HashAlgorithm hash = new T(); try { bytes = hash.ComputeHash(bytes); } finally { hash.Clear(); } if (outType == OutType.Base64) { return(Convert.ToBase64String(bytes)); } StringBuilder sb = new StringBuilder(); foreach (var item in bytes) { sb.AppendFormat("{0:x2}", item); } return(sb.ToString()); }
private void DisplayOutingCost() { Console.WriteLine("Enter the number for the type of event:\n" + "1. Golf\n" + "2. Bowling\n" + "3. Amusement Park\n" + "4. Concert"); int outType = int.Parse(Console.ReadLine()); OutType type = OutType.Golf; switch (outType) { default: case 1: type = OutType.Golf; break; case 2: type = OutType.Bowling; break; case 3: type = OutType.APark; break; case 4: type = OutType.Concert; break; } decimal costByType = eventRepo.CalculateByType(type); Console.WriteLine($"Total Cost of the event: {costByType}"); }
private void btnShp2Dwg_Click(object sender, EventArgs e) { lstLyrFile.Enabled = true;//源是ESRI格式,则列出图层可用 FolderBrowserDialog folder = new FolderBrowserDialog(); folder.ShowNewFolderButton = false; folder.Description = "shp文件夹"; if (folder.ShowDialog() == DialogResult.OK) { string str = folder.SelectedPath; this.txtSource.Text = str; } else { return; } IWorkspace pWks = GetWorkspace(this.txtSource.Text, 3); if (pWks == null) { this.txtSource.Text = ""; this.lstLyrFile.Items.Clear(); MessageBox.Show("不是shp的工作空间。"); return; } m_OutType = OutType.shp2dwg; LstAllLyrFile(pWks); }
private void btnMdb2dwg_Click(object sender, EventArgs e) { lstLyrFile.Enabled = true;//源是ESRI格式,则列出图层可用 OpenFileDialog filedialog = new OpenFileDialog(); filedialog.Multiselect = false; filedialog.Title = "选择mdb文件"; filedialog.Filter = "*.mdb|*.mdb"; if (filedialog.ShowDialog() == DialogResult.OK) { string str = filedialog.FileName; this.txtSource.Text = str; } else { return; } IWorkspace pWks = GetWorkspace(this.txtSource.Text, 1); if (pWks == null) { this.txtSource.Text = ""; this.lstLyrFile.Items.Clear(); MessageBox.Show("不是mdb的工作空间。"); return; } m_OutType = OutType.mdb2dwg; LstAllLyrFile(pWks); }
private void btnGdb2dwg_Click(object sender, EventArgs e) { FolderBrowserDialog folder = new FolderBrowserDialog(); folder.ShowNewFolderButton = false; folder.Description = "选择FGDB文件"; if (folder.ShowDialog() == DialogResult.OK) { string str = folder.SelectedPath; this.txtSource.Text = str; } else { return; } IWorkspace pWks = GetWorkspace(this.txtSource.Text, 2); if (pWks == null) { this.txtSource.Text = ""; this.lstLyrFile.Items.Clear(); MessageBox.Show("不是FGDB的工作空间。"); return; } m_OutType = OutType.gdb2dwg; LstAllLyrFile(pWks); }
/// <summary> /// 解密 /// </summary> /// <param name="value">待解密的值</param> /// <param name="key">密钥</param> /// <param name="iv">加密偏移量</param> /// <param name="salt">加盐</param> /// <param name="outType">输出类型,默认为<see cref="OutType.Base64"/></param> /// <param name="encoding">编码类型,默认为<see cref="Encoding.UTF8"/></param> /// <param name="keySize">密钥长度类型,默认为<see cref="TripleDESKeySizeType.L192"/></param> /// <returns></returns> public static string Decrypt(string value, string key, string iv = null, string salt = null, OutType outType = OutType.Base64, Encoding encoding = null, TripleDESKeySizeType keySize = TripleDESKeySizeType.L192) { if (string.IsNullOrEmpty(value)) { throw new ArgumentNullException(nameof(value)); } if (string.IsNullOrEmpty(key)) { throw new ArgumentNullException(nameof(key)); } if (encoding == null) { encoding = Encoding.UTF8; } var result = DecryptCore <TripleDESCryptoServiceProvider>(value.GetEncryptBytes(outType), ComputeRealValueFunc()(key)(salt)(encoding)((int)keySize), ComputeRealValueFunc()(iv)(salt)(encoding)(64)); return(encoding.GetString(result)); }
//create CheckerBoard and return as bitmap object public static Bitmap CheckerBoardBitmap(int n, int rows, int cols, OutType type) { int[,] result = new int[n * rows, n *cols]; Bitmap image = new Bitmap(result.GetLength(1), result.GetLength(0), PixelFormat.Format24bppRgb); if (rows > 0 && cols > 0) { result = CheckerBoardHelper(n, rows, cols); image = Helpers.SetPixels(image, result, result, result); if (type == OutType.OneBpp) { image = PixelFormatWorks.ImageTo1BppBitmap(image); } else if (type == OutType.EightBpp) { image = PixelFormatWorks.Bpp24Gray2Gray8bppBitMap(image); } } else { Console.WriteLine("r and c must be positive values greater than 1. Method: CheckerBoard"); } return(image); }
public static void SetOut(OutType type) { outType = type; switch (outType) { case OutType.Console: IntPtr handle = Process.GetCurrentProcess().MainWindowHandle; SetConsoleMode(handle, ENABLE_EXTENDED_FLAGS); break; case OutType.Window: break; case OutType.Stream: file = new System.IO.StreamWriter(@"debugOut.txt", true); //@"C:\Users\Public\TestFolder\WriteLines2.txt" file.WriteLine(""); file.WriteLine("START OF LOG " + DateTime.Now.ToShortDateString() + " : " + DateTime.Now.ToShortTimeString()); break; default: IntPtr handle2 = Process.GetCurrentProcess().MainWindowHandle; SetConsoleMode(handle2, ENABLE_EXTENDED_FLAGS); break; } }
/// <summary> /// 加密 /// </summary> /// <param name="value">待加密的值</param> /// <param name="key">密钥</param> /// <param name="iv">加密偏移量</param> /// <param name="salt">加盐</param> /// <param name="outType">输出类型,默认为<see cref="OutType.Base64"/></param> /// <param name="encoding">编码类型,默认为<see cref="Encoding.UTF8"/></param> /// <returns></returns> public static string Encrypt(string value, string key, string iv = null, string salt = null, OutType outType = OutType.Base64, Encoding encoding = null) { if (string.IsNullOrEmpty(value)) { throw new ArgumentNullException(nameof(value)); } if (string.IsNullOrEmpty(key)) { throw new ArgumentNullException(nameof(key)); } if (encoding == null) { encoding = Encoding.UTF8; } var result = EncryptCore <AesCryptoServiceProvider>(encoding.GetBytes(value), ComputeRealValueFunc()(key)(salt)(encoding)(64), ComputeRealValueFunc()(iv)(salt)(encoding)(64)); if (outType == OutType.Base64) { return(Convert.ToBase64String(result)); } return(result.ToHexString()); }
/// <summary> /// 保存支出类型 /// </summary> /// <param name="model">支出类型</param> /// <returns>主键ID</returns> public async Task <int> SaveOutTypeAsync(OutType model) { using (IOSysContext db = new IOSysContext()) { //更新 if (model.ID > 0) { db.Entry(model).State = EntityState.Modified; } //新增 else { await db.OutTypes.AddAsync(model); } await db.SaveChangesAsync(); } //移除缓存 var key = string.Format(SysConst.Cache.OutTypeList_FamilyID, model.FamilyID); CacheHelper.Remove(key); return(model.ID); }
/// <summary> /// µÃµ½ËùÓдýÉóºËµÄÇë¼Ùµ¥ /// </summary> /// <returns></returns> public List <OutApplication> GetNeedConfirmOutApplication() { List <OutApplication> iRet = new List <OutApplication>(); SqlCommand cmd = new SqlCommand(); using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetNeedConfirmOutApplication", cmd)) { while (sdr.Read()) { Account account = new Account(); account.Id = Convert.ToInt32(sdr[_DbAccountID]); OutApplication application = new OutApplication(Convert.ToInt32(sdr[_DbPKID]), account, Convert.ToDateTime(sdr[_DbSubmitDate]), sdr[_DbReason].ToString(), Convert.ToDateTime(sdr[_DbFrom]), Convert.ToDateTime(sdr[_DbTo]), Convert.ToDecimal(sdr[_DbCostTime]), GetOutApplicationItemByOutApplicationID(Convert.ToInt32(sdr[_DbPKID])), sdr[_DbOutLocation].ToString(), OutType.GetOutTypeByID(Convert.ToInt32(sdr[_DbOutType]))); application.DiyProcess = RequestUtility.GetDiyProcess(sdr[_DbDiyProcess].ToString()); iRet.Add(application); } return(iRet); } }
/// <summary> /// </summary> public List <OutApplication> GetAllOutApplicationByAccountID(int accountID) { List <OutApplication> applicationList = new List <OutApplication>(); SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_AccountID, SqlDbType.Int).Value = accountID; using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetAllOutApplicationByAccountID", cmd)) { while (sdr.Read()) { Account account = new Account(); account.Id = Convert.ToInt32(sdr[_DbAccountID]); OutApplication application = new OutApplication(Convert.ToInt32(sdr[_DbPKID]), account, Convert.ToDateTime(sdr[_DbSubmitDate]), sdr[_DbReason].ToString(), Convert.ToDateTime(sdr[_DbFrom]), Convert.ToDateTime(sdr[_DbTo]), Convert.ToDecimal(sdr[_DbCostTime]), GetOutApplicationItemByOutApplicationID(Convert.ToInt32(sdr[_DbPKID])), sdr[_DbOutLocation].ToString(), OutType.GetOutTypeByID(Convert.ToInt32(sdr[_DbOutType]))); applicationList.Add(application); } } return(applicationList); }
/// <summary> /// /// </summary> public List <DayAttendance> GetAllCalendarByEmployee(int AccountID, DateTime fromDate, DateTime toDate) { List <DayAttendance> dayAttendance = new List <DayAttendance>(); List <OutApplicationItem> outApplicationItemList = new List <OutApplicationItem>(); List <OutApplicationItem> outApplicationItemFromDal = _OutApplicationDal.GetAllOutApplicationForCalendar(AccountID, fromDate, toDate); foreach (OutApplicationItem item in outApplicationItemFromDal) { OutApplicationItem outApplicationItem = _OutApplicationDal.GetOutApplicationItemByItemID(item.ItemID); item.OutApplicationID = outApplicationItem.OutApplicationID; outApplicationItemList.Add(item); //if (item.Status == RequestStatus.Cancelled || item.Status == RequestStatus.CancelApproving) //{ // OutApplicationItem outApplicationItem = // _OutApplicationDal.GetOutApplicationItemByItemID(item.ItemID); // if (OutApplicationUtility.IsAgreed(outApplicationItem)) // { // outApplicationItemList.Add(item); // } //} //else //{ // outApplicationItemList.Add(item); //} } foreach (OutApplicationItem item in outApplicationItemList) { OutType outType = _OutApplicationDal.GetOutApplicationByOutApplicationID(item.OutApplicationID).OutType; if (outType.ID == OutType.InCity.ID) { string typeName = "外出"; typeName = GetTypeName(item, typeName); CalculateOutHour cal = new CalculateOutHour(item.FromDate, item.ToDate, AccountID, typeName); cal.Excute(); dayAttendance.AddRange(cal.DayAttendanceList); } else if (outType.ID == OutType.OutCity.ID) { string typeName = OutType.OutCity.Name; typeName = GetTypeName(item, typeName); CalculateOutCityHour cal = new CalculateOutCityHour(item.FromDate, item.ToDate, typeName, AccountID); cal.Excute(); dayAttendance.AddRange(cal.DayAttendanceList); } else if (outType.ID == OutType.Train.ID) { string typeName = OutType.Train.Name; typeName = GetTypeName(item, typeName); CalculateOutHour cal = new CalculateOutHour(item.FromDate, item.ToDate, AccountID, typeName); cal.Excute(); dayAttendance.AddRange(cal.DayAttendanceList); } } return(dayAttendance); }
/// <summary> /// 初始化一个<see cref="AbsSymmetricProvider"/>类型的实例 /// </summary> public AbsSymmetricProvider(OutType outType = OutType.Hex, Encoding encoding = null) { OutType = outType; if (encoding == null) { encoding = Encoding.UTF8; } Encoding = encoding; }
public Event(OutType outType, string outEvent, int outAtte, DateTime outDate, decimal perIndCost, decimal perOutCost) { OutType = outType; OutEvent = outEvent; OutAtte = outAtte; OutDate = outDate; PerIndCost = perIndCost; PerOutCost = perOutCost; }
public static void SetOut(OutType type) { outType = type; if (type == OutType.Console) { IntPtr handle = Process.GetCurrentProcess().MainWindowHandle; SetConsoleMode(handle, ENABLE_EXTENDED_FLAGS); } }
/// <summary> /// 加密 /// </summary> /// <param name="value">待加密的值</param> /// <param name="key">DES 密钥对象</param> /// <param name="outType">输出类型,默认为<see cref="OutType.Base64"/></param> /// <param name="encoding">编码类型,默认为<see cref="Encoding.UTF8"/></param> /// <returns></returns> public static string Encrypt(string value, DESKey key, OutType outType = OutType.Base64, Encoding encoding = null) { if (key == null) { throw new ArgumentNullException(nameof(key)); } return(Encrypt(value, key.Key, key.IV, outType: outType, encoding: encoding)); }
// return bitmap public static Bitmap HitMissBitmap(Bitmap img, OutType type) { int[,] FirstStructureElement = new int[3, 3] { { 0, 1, 0 }, { 1, 1, 1 }, { 0, 1, 0 } }; int[,] SecondStructureElement = new int[3, 3] { { 1, 0, 1 }, { 0, 0, 0 }, { 1, 0, 1 } }; return(HitMissBitmapHelper(img, FirstStructureElement, SecondStructureElement)); }
/// <summary> /// 初始化一个<see cref="AbsAsymmetricProvider"/>类型的实例 /// </summary> public AbsAsymmetricProvider(OutType outType = OutType.Hex, RSAKeyType keyType = RSAKeyType.Xml, Encoding encoding = null) { OutType = outType; if (encoding == null) { encoding = Encoding.UTF8; } Encoding = encoding; KeyType = keyType; }
//create CheckerBoard //n - pixels per cell public static void CheckerBoard(int n, OutType type) { string defPath = GetImageInfo.MyPath("Rand"); int[,] result = new int[n * 8, n * 8]; //8 -default cells result = CheckerBoardHelper(n, 8, 8); string outName = defPath + "checkerboardClassik_" + "pixelsPerCell_" + n + ".png"; MoreHelpers.WriteImageToFile(result, result, result, outName, type); }
// default public static void HitMiss(Bitmap img, OutType type) { int[,] FirstStructureElement = new int[3, 3] { { 0, 1, 0 }, { 1, 1, 1 }, { 0, 1, 0 } }; int[,] SecondStructureElement = new int[3, 3] { { 1, 0, 1 }, { 0, 0, 0 }, { 1, 0, 1 } }; HitMissShapkaProcess(img, FirstStructureElement, SecondStructureElement, type); }
/// <summary> /// 使用指定私钥解密字符串 /// </summary> /// <param name="value">要解密的密文字符串</param> /// <param name="privateKey">私钥</param> /// <param name="encoding">编码类型</param> /// <param name="outType">输出类型</param> /// <param name="keyType">密钥类型</param> /// <returns></returns> public static string Decrypt(string value, string privateKey, Encoding encoding = null, OutType outType = OutType.Base64, RSAKeyType keyType = RSAKeyType.Xml) { if (encoding == null) { encoding = Encoding.UTF8; } var result = Decrypt(value.GetEncryptBytes(outType), privateKey, keyType); return(encoding.GetString(result)); }
public CalculateOutHourPresenter(string fromDate, string fromHour, string fromMinute, string toDate, string toHour, string toMinute, int accountID, OutType type) { _FromDate = fromDate; _FromHour = fromHour; _FromMinute = fromMinute; _ToDate = toDate; _ToHour = toHour; _ToMinute = toMinute; _AccountID = accountID; _OutType = type; }
/// <summary> /// 使用指定公钥验证解密得到的明文是否符合签名 /// </summary> /// <param name="source">解密得到的明文</param> /// <param name="signData">明文签名字符串</param> /// <param name="publicKey">公钥</param> /// <param name="encoding">编码类型</param> /// <param name="outType">输出类型</param> /// <param name="rsaType">算法类型</param> /// <param name="keyType">密钥类型</param> /// <returns></returns> public static bool VerifyData(string source, string signData, string publicKey, Encoding encoding = null, OutType outType = OutType.Base64, RSAType rsaType = RSAType.RSA, RSAKeyType keyType = RSAKeyType.Xml) { if (encoding == null) { encoding = Encoding.UTF8; } byte[] sourceBytes = encoding.GetBytes(source); byte[] signBytes = signData.GetEncryptBytes(outType); return(VerifyData(sourceBytes, signBytes, publicKey, rsaType, keyType)); }
/// <summary> /// 获取加密字符串的加密字节数组 /// </summary> /// <param name="data">加密字符串</param> /// <param name="outType">输出类型</param> /// <returns></returns> internal static byte[] GetEncryptBytes(this string data, OutType outType) { switch (outType) { case OutType.Base64: return(Convert.FromBase64String(data)); case OutType.Hex: return(ToBytes(data)); } throw new NotImplementedException(); }
/// <summary> /// 删除支出类型 /// </summary> /// <param name="model">支出类型</param> public async Task DeleteOutTypeAsync(OutType model) { using (IOSysContext db = new IOSysContext()) { db.OutTypes.Remove(model); await db.SaveChangesAsync(); } //移除缓存 var key = string.Format(SysConst.Cache.OutTypeList_FamilyID, model.FamilyID); CacheHelper.Remove(key); }
public decimal CalculateByType(OutType type) { decimal totalCostType = 0m; foreach (Event outingType in listOfEvents) { if (outingType.OutType == type) { totalCostType += outingType.PerOutCost; } } return(totalCostType); }