/// <summary> 提交 /// </summary> private void btnSummit_Click(object sender, EventArgs e) { errProvider.Clear(); try { if (string.IsNullOrEmpty(txtusername.Caption)) { Validator.SetError(errProvider, txtusername, "请录入姓名"); return; } if (string.IsNullOrEmpty(txtoldpwd.Caption)) { Validator.SetError(errProvider, txtoldpwd, "请录入旧密码"); return; } //Utility.Security.Secret.MD5( if (txtoldpwd.Caption.Trim() != GlobalStaticObj_Server.Instance.PassWord) { Validator.SetError(errProvider, txtoldpwd, "旧密码验证错误,请录入正确的旧密码"); return; } if (string.IsNullOrEmpty(txtnewpwd.Caption)) { Validator.SetError(errProvider, txtnewpwd, "请录入新密码"); return; } if (string.IsNullOrEmpty(txtnewpwd_again.Caption)) { Validator.SetError(errProvider, txtnewpwd_again, "请再次录入新密码"); return; } if (txtnewpwd.Caption.Trim() != txtnewpwd_again.Caption.Trim()) { Validator.SetError(errProvider, txtnewpwd_again, "两次录入新密码不一致"); return; } //string md5Pwd = Utility.Security.Secret.MD5(txtnewpwd.Caption.Trim()); Dictionary<string, string> dicFileds = new Dictionary<string, string>(); dicFileds.Add("land_name", txtloginid.Caption.Trim()); dicFileds.Add("password", txtnewpwd.Caption.Trim()); bool flag = DBHelper.Submit_AddOrEdit("修改用户名和密码", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, "sys_user", "user_id", GlobalStaticObj_Server.Instance.UserID, dicFileds); if (flag) { GlobalStaticObj_Server.Instance.PassWord = txtnewpwd.Caption.Trim(); MessageBoxEx.ShowInformation("修改成功"); this.DialogResult = DialogResult.OK; } else { MessageBoxEx.ShowWarning("修改失败"); } } catch (Exception ex) { GlobalStaticObj_Server.GlobalLogService.WriteLog("个人设置", ex); MessageBoxEx.ShowWarning("程序异常"); } }
/// <summary> /// 删除缓存 /// </summary> /// <param name="billNumber">单据号</param> /// <param name="billType">单据类型</param> /// <param name="operate">操作类型</param> public static void DeleteFactory(string billNumber, DataSources.EnumBillType billType, DataSources.EnumOperateObj operate) { string sql = "delete tb_factory_temp where billNumber=@billNumber and billType=@billType and opType=@opType"; Dictionary<string, string> dic = new Dictionary<string, string>(); dic.Add("billNumber", billNumber); dic.Add("billType", billType.ToString()); dic.Add("opType", operate.ToString("d")); DBHelper.ExtNonQuery("删除云平台缓存", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, sql, System.Data.CommandType.Text, dic); }
/// <summary> 添加日志 /// </summary> /// <param name="item"></param> /// <param name="currAccDbName"></param> /// <returns></returns> public static bool Add(UserFunctionOPLog item, string currAccDbName) { Dictionary<string, string> DicParam = new Dictionary<string, string>(); DicParam.Add("user_id", item.userOP.UserID); DicParam.Add("u_f_log_id", System.Guid.NewGuid().ToString()); DicParam.Add("com_id", item.com_id); DicParam.Add("access_time", item.access_time.ToString()); DicParam.Add("fun_id", item.fun_id.ToString()); return DBHelper.Submit_AddLog("添加用户菜单日志", currAccDbName, "tl_user_function_log", "", "", DicParam); }
public void BindDropTypeList() { Dictionary<string, string> list = new Dictionary<string, string>(); list.Add("限时购", "1"); list.Add("正常商品", "2"); typeList.DataSource = list; typeList.DataValueField = "value"; typeList.DataTextField = "key"; typeList.DataBind(); }
// This method already feels like it needs to be broken up... // Also needs to have atomicity added. public void UpdateWith(IEnumerable<Transaction> transactions) { var transactionList = transactions.ToList(); if (transactionList.Any(t => !t.Valid())) throw new Exception("One or more transactions are invalid."); var updates = new Dictionary<Account, AccountUpdate>(); foreach (var transactionAccount in transactionList.Select(t => t.Account).Distinct()) { var account = _portfolio.Accounts.Single(a => a.Name.Equals(transactionAccount.Name, StringComparison.InvariantCultureIgnoreCase)); var transactionsForAccount = transactionList.Where(t => t.Account.Name.Equals(account.Name, StringComparison.InvariantCultureIgnoreCase)) .OrderBy(t => t.Date); var update = CalculateAccountUpdate(transactionsForAccount, account); updates.Add(transactionAccount, update); } foreach (var kvPair in updates) { kvPair.Key.Positions = kvPair.Value.Positions; kvPair.Key.Transactions = kvPair.Value.Transactions; } }
public string abc() { dt.Clear(); ProductAdminBLL bll = new ProductAdminBLL(); dt = bll.Categories(); System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); List<Dictionary<string, object>> rows = new List<Dictionary<string, object>>(); Dictionary<string, object> row; foreach (DataRow dr in dt.Rows) { row = new Dictionary<string, object>(); foreach (DataColumn col in dt.Columns) { row.Add(col.ColumnName, dr[col]); } rows.Add(row); } return serializer.Serialize(rows); }
public string GetReport(Portfolio portfolio, IEnumerable<Category> categories, IEnumerable<CategoryWeight> weights) { var reportBuilder = new StringBuilder(); var quotes = GetQuotes(portfolio); var valuesDict = CalculateValues(portfolio, quotes); var weightsList = weights.ToList(); //DebugPrint(reportBuilder, valuesDict); var total = valuesDict.Values.Where(v => v > 0M).Sum(); reportBuilder.AppendLine(string.Format("Portfolio: {0}", portfolio.Name)); foreach (var category in categories) { Dictionary<string, decimal> calculations = new Dictionary<string, decimal>(); foreach (var kvpair in valuesDict) { var weight = weightsList.Single(w => w.Security.Symbol.Equals(kvpair.Key) && w.Value.Category == category); if (calculations.ContainsKey(weight.Value.Name)) calculations[weight.Value.Name] += kvpair.Value; else calculations.Add(weight.Value.Name, kvpair.Value); } reportBuilder.AppendLine(string.Format("\r\n{0}", category.Name)); foreach (var kvpair in calculations.OrderByDescending(kv => kv.Value)) { reportBuilder.AppendLine(String.Format("{0}: {1:N1}%", kvpair.Key, kvpair.Value / total * 100M)); } } return reportBuilder.ToString(); }
/// <summary> /// 从XML文件中读取记录 /// </summary> public static Dictionary<int, string[]> ReadRecord(string filePath) { Dictionary<int, string[]> his = new Dictionary<int, string[]>(); if (File.Exists(PATH)) { XDocument xd = XDocument.Load(PATH); //Enumerable var query = xd.DescendantNodes().Where(e => { XElement xel = e as XElement; if (xel != null) { XElement word = xel.Element("word"); XElement meaning = xel.Element("meaning"); XAttribute id = xel.Attribute("id"); if (word != null && meaning != null && id != null) { return true; } } return false; }); foreach (XElement xe in query) { his.Add(Convert.ToInt32(xe.Attribute("id").Value), new string[] { xe.Element("word").Value, xe.Element("meaning").Value }); } } return his; }
public static Dictionary<string, string> getAuthorityRelation() { Dictionary<string, string> authorityRelation = new Dictionary<string, string>(); DataTable dt = DAL.Authority.getAuthorityTable(); foreach (DataRow dr in dt.Rows) { authorityRelation.Add(dr[0].ToString(), dr[1].ToString()); } return authorityRelation; }
public IList<DJ_ProductRoute> Save() { int dayNo = Convert.ToInt32(lblDayNo.Text); Dictionary<EnterpriseType, IList<string>> entDictionary = new Dictionary<EnterpriseType, IList<string>>(); List<string> entNames = new List<string>(); foreach (RepeaterItem item in rptEditScenics.Items) { if (!entDictionary.ContainsKey(EnterpriseType.景点)) { entDictionary.Add(EnterpriseType.景点, new List<string>()); } TextBox tbxScenic = item.FindControl("tbxEntEdit") as TextBox; string scenicName = CommonLibrary.StringHelper.TrimAll(tbxScenic.Text); entDictionary[EnterpriseType.景点].Add(scenicName); entNames.Add(scenicName); } foreach (RepeaterItem itemHotel in rptEditHotels.Items) { if (!entDictionary.ContainsKey(EnterpriseType.宾馆)) { entDictionary.Add(EnterpriseType.宾馆, new List<string>()); } TextBox tbxHotel = itemHotel.FindControl("tbxEntEdit") as TextBox; string hotelName = CommonLibrary.StringHelper.TrimAll(tbxHotel.Text); entDictionary[EnterpriseType.宾馆].Add(hotelName); entNames.Add(hotelName); } string errMsg; Routes.Clear(); IList<DJ_ProductRoute> routes = bllDJRoute.CreateRouteFromNameList(dayNo, entDictionary, out errMsg); foreach (DJ_ProductRoute pj in routes) { Routes.Add(pj); } RoutesChangedEventArgs args = new RoutesChangedEventArgs(); args.ProductRoutes = Routes; OnRoutesChanged(args); LoadData(); return Routes; }
protected void btnSaveRoute_Click(object sender, EventArgs e) { int dayNo =Convert.ToInt32( rblDayNo.Text); Dictionary<EnterpriseType, IList<string>> entDictionary = new Dictionary<EnterpriseType, IList<string>>(); List<string> entNames = new List<string>(); foreach (RepeaterItem item in rptEditScenics.Items) { if (!entDictionary.ContainsKey(EnterpriseType.景点)) { entDictionary.Add(EnterpriseType.景点, new List<string>()); } TextBox tbxScenic = item.FindControl("tbxEntEdit") as TextBox; string scenicName = CommonLibrary.StringHelper.TrimAll(tbxScenic.Text); entDictionary[EnterpriseType.景点].Add(scenicName); entNames.Add(scenicName); } foreach (RepeaterItem itemHotel in rptEditHotels.Items) { if (!entDictionary.ContainsKey(EnterpriseType.宾馆)) { entDictionary.Add(EnterpriseType.宾馆, new List<string>()); } TextBox tbxHotel = itemHotel.FindControl("tbxEntEdit") as TextBox; string hotelName = CommonLibrary.StringHelper.TrimAll(tbxHotel.Text); entDictionary[EnterpriseType.宾馆].Add(hotelName); entNames.Add(hotelName); } string errMsg; bllRoute.SaveFromNameList(CurrentGroup, dayNo, entDictionary, out errMsg); bllGroup.Save(CurrentGroup); LoadData(); pnlEditRoute.Visible = false; if (string.IsNullOrEmpty(errMsg)) { errMsg = "操作成功"; } ShowNotification(errMsg); //ScriptManager.RegisterStartupScript(this, this.GetType(), "s", "alert('" + lblMsg_SaveRoute.Text + "')", true); // btnAddRoute.Visible = true; }
/// <summary> 添加文件日志 /// </summary> /// <param name="item"></param> /// <param name="currAccDbName"></param> /// <returns></returns> public static bool Add(UserFileOPLog item, string currAccDbName) { Dictionary<string, string> DicParam = new Dictionary<string, string>(); DicParam.Add("ClientUserID", item.userOP.UserID); DicParam.Add("OPName", item.userOP.OPName); DicParam.Add("LogID", System.Guid.NewGuid().ToString()); DicParam.Add("FileName", item.FileName.Replace('\'', '"')); DicParam.Add("FilePath", item.FilePath.Replace('\'', '"')); DicParam.Add("sTimeTicks", item.sTimeTicks.ToString()); DicParam.Add("eTimeTicks", item.eTimeTicks.ToString()); DicParam.Add("exeResult", item.exeResult ? "1" : "0"); return DBHelper.Submit_AddLog("添加文件日志", currAccDbName, "tl_ClientUserFile", "", "", DicParam); }
/// <summary> 添加日志 /// </summary> /// <param name="item"></param> /// <param name="currAccDbName"></param> /// <returns></returns> public static bool Add(UserOPLog item, string currAccDbName) { Dictionary<string, string> DicParam = new Dictionary<string, string>(); DicParam.Add("ClientUserID", item.userOP.UserID); DicParam.Add("OPName", item.userOP.OPName); DicParam.Add("LogID", System.Guid.NewGuid().ToString()); DicParam.Add("SQLStr", item.sqlStr.Replace('\'','"')); DicParam.Add("paramsStr", item.sqlParams.Replace('\'', '"')); DicParam.Add("OPTime", item.timeTicks.ToString()); DicParam.Add("exeResult", item.exeResult ? "1" : "0"); return DBHelper.Submit_AddLog("添加日志", currAccDbName, "tl_ClientUser", "", "", DicParam); }
/// <summary> 添加日志 /// </summary> /// <param name="item"></param> /// <param name="currAccDbName"></param> /// <returns></returns> public static bool Add(UserFunctionOPLog item, string currAccDbName) { Dictionary<string, string> DicParam = new Dictionary<string, string>(); DicParam.Add("user_id", item.userOP.UserID); DicParam.Add("u_f_log_id", System.Guid.NewGuid().ToString()); DicParam.Add("com_id", item.com_id); DicParam.Add("setbook_id", item.acc_code); DicParam.Add("access_time", Common.LocalDateTimeToUtcLong(GlobalStaticObj_Server.Instance.CurrentDateTime).ToString()); DicParam.Add("create_time", Common.LocalDateTimeToUtcLong(GlobalStaticObj_Server.Instance.CurrentDateTime).ToString()); DicParam.Add("fun_id", item.fun_id.ToString()); return DBHelper.Submit_AddLog("添加用户菜单日志", GlobalStaticObj_Server.DbPrefix+GlobalStaticObj_Server.CommAccCode, "tl_user_function_log", "", "", DicParam); }
private static IDictionary<IDomainEntity, decimal> CalculateValues(Portfolio portfolio, IDictionary<string, decimal> quotes) { var results = new Dictionary<IDomainEntity, decimal>(); foreach (var account in portfolio.Accounts) { foreach (var position in account.Positions) { try { var price = quotes[position.Security.Symbol]; var value = price * position.Shares; results.Add(position, value); } catch (KeyNotFoundException) { results.Add(position, -1M); } } } return results; }
public static DataSet UserLogin(LoginInput loginO, string currAccDbName, string IPStr) { Dictionary<string, ParamObj> dic = new Dictionary<string, ParamObj>(); ParamObj paraO1 = new ParamObj(); paraO1.name = "land_name"; paraO1.size = 40; paraO1.type = SysDbType.VarChar; paraO1.value = loginO.username; ParamObj paraO2 = new ParamObj(); paraO2.name = "password"; paraO2.size = 40; paraO2.type = SysDbType.VarChar; paraO2.value = loginO.pwd; ParamObj paraO3 = new ParamObj(); paraO3.name = "login_time"; paraO3.type = SysDbType.BigInt; paraO3.value = System.DateTime.Now.ToUniversalTime().Ticks; ParamObj paraO4 = new ParamObj(); paraO4.name = "computer_ip"; paraO4.size = 40; paraO4.type = SysDbType.VarChar; paraO4.value = IPStr; ParamObj paraO5 = new ParamObj(); paraO5.name = "computer_name"; paraO5.size = 40; paraO5.type = SysDbType.NVarChar; paraO5.value = loginO.ComputerName; ParamObj paraO6 = new ParamObj(); paraO6.name = "computer_mac"; paraO6.size = 40; paraO6.type = SysDbType.VarChar; paraO6.value = loginO.MAC; ParamObj paraO7 = new ParamObj(); paraO7.name = "login_Id"; paraO7.size = 40; paraO7.type = SysDbType.VarChar; paraO7.value = loginO.Login_Id; dic.Add("land_name", paraO1); dic.Add("password", paraO2); dic.Add("login_time", paraO3); dic.Add("computer_ip", paraO4); dic.Add("computer_name", paraO5); dic.Add("computer_mac", paraO6); dic.Add("login_Id", paraO7); SQLObj sqlObj = new SQLObj(); sqlObj.cmdType = System.Data.CommandType.StoredProcedure; sqlObj.sqlString = "ServerUserLogin"; sqlObj.Param = dic; DataSet ds = DBHelper.GetDataSet("服务器端用户登录", currAccDbName, sqlObj); return ds; }
public static string GetAllHints(string etid) { List<DJ_Workers> ListGw= new BLLDJTourGroup().GetTourGroupByTeId(int.Parse(etid)).ToList(); Dictionary<string, string> data = new Dictionary<string, string>(); foreach (DJ_Workers item in ListGw) { data.Add(Guid.NewGuid().ToString(), item.Name + "/" + item.IDCard.Substring(0, 6) + "********" + item.IDCard.Substring(14)); } DataContractJsonSerializer serializer = new DataContractJsonSerializer(data.GetType()); using (MemoryStream ms = new MemoryStream()) { serializer.WriteObject(ms, data); return System.Text.Encoding.UTF8.GetString(ms.ToArray()); } }
public static Dictionary<string, string> GetGroupsDict() { Dictionary<string, string> groups = new Dictionary<string, string>(); DataTable gDt = DAL.Groups.ListGroups(); foreach (DataRow gRow in gDt.Rows) { if (!groups.ContainsKey(gRow["groupName"].ToString())) { groups.Add(gRow["groupName"].ToString(), gRow["groupId"].ToString()); } } return groups; }
public static Dictionary<string, string> ToKeyValue(this string source, string[] exterDelimiter = null, string inerDelimiter = null) { if (exterDelimiter == null) exterDelimiter = new string[] { ";" }; if (string.IsNullOrEmpty(inerDelimiter)) inerDelimiter = "="; Dictionary<string, string> values = new Dictionary<string, string>(); string[] keyValueList = source.Split(exterDelimiter, StringSplitOptions.RemoveEmptyEntries); foreach (string keyValue in keyValueList) { string[] kv = keyValue.Split(new string[] { inerDelimiter }, StringSplitOptions.RemoveEmptyEntries); values.Add(kv[0].Trim(), kv[1].Trim()); } return values; }
/// <summary> 获取新项目编码 /// </summary> /// <param name="opName">操作名称</param> /// <param name="startStr">单据前缀</param> /// <param name="tableName">表名</param> /// <param name="field">字段</param> /// <returns></returns> public static string GetNewNo(SYSModel.DataSources.EnumProjectType enumProjectType) { string opName = "获取" + SYSModel.DataSources.GetDescription(enumProjectType) + "的编码生成规则"; string ruleID = Convert.ToInt16(enumProjectType).ToString(); string where = string.Format("bill_code_rule_id='{0}'", ruleID); DataTable dt = DBHelper.GetTable("", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, "sys_bill_code_rule", "*", where, "", ""); string billCode = dt.Rows[0]["bill_code"].ToString(); string codeMethod = dt.Rows[0]["code_method"].ToString(); string delimiter = dt.Rows[0]["delimiter"].ToString(); string startNum = dt.Rows[0]["start_num"].ToString(); string lastBillNo = dt.Rows[0]["last_bill_no"].ToString(); string newBillNo = string.Empty; string newPrefix = GetPrefix(billCode, codeMethod, delimiter); if (string.IsNullOrEmpty(lastBillNo)) { newBillNo = newPrefix + startNum; } else { string oldPrefix = lastBillNo.Substring(0, newPrefix.Length); if (newPrefix != oldPrefix) { newBillNo = newPrefix + startNum; } else { string newNum = (Convert.ToInt32(lastBillNo.Replace(oldPrefix, "")) + 1).ToString().PadLeft(startNum.Length, '0'); newBillNo = newPrefix + newNum; } } Dictionary<string, string> dicValue = new Dictionary<string, string>(); dicValue.Add("last_bill_no", newBillNo); bool flag = DBHelper.Submit_AddOrEdit("", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, "sys_bill_code_rule", "bill_code_rule_id", ruleID, dicValue); if (!flag) { throw new Exception("获取新项目编码失败"); } return newBillNo; }
/// <summary> 验证软件是否过期 /// </summary> /// <returns></returns> public static long GetSoftValidate() { Hashtable ht = new Hashtable(); ht.Add("signId", Secret.StringToBase64String(GlobalStaticObj_Server.Instance.StationID)); //GlobalStaticObj_Server.Instance.SoftRegUrl = "http://192.168.35.108:8080/sspapp/operation/auth/"; string resultStr = HttpRequest.DoGet(GlobalStaticObj_Server.Instance.SoftRegUrl + "getValidate.do", ht); if (!string.IsNullOrEmpty(resultStr)) { string jsonStr = Secret.Base64StringToString(resultStr); ResultInfo resultInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<ResultInfo>(jsonStr); if (resultInfo.isSuccess != 1) { GlobalStaticObj_Server.GlobalLogService.WriteLog("软件有效期", resultInfo.errMsg); return 0; } Dictionary<string, string> dic = new Dictionary<string, string>(); dic.Add("protocol_expires_time", resultInfo.validate); DBHelper.Submit_AddOrEdit("更新软件有效期", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, "tb_signing_info", "sign_id", GlobalStaticObj_Server.Instance.StationID, dic); return Convert.ToInt64(resultInfo.validate); } return 0; }
/// <summary> 获取财务参数集合 /// </summary> public Dictionary<string, string> GetFinancParas() { Dictionary<string, string> dicFields = new Dictionary<string, string>(); dicFields.Add("tax_rate", (numtax_rate.Value / 100).ToString()); dicFields.Add("currency", cmbcurrency.SelectedValue.ToString()); dicFields.Add("counts", numcounts6.Value.ToString()); dicFields.Add("counts_zero", cbcounts_zero6.Checked ? "1" : "0"); dicFields.Add("price", numprice6.Value.ToString()); dicFields.Add("price_zero", cbprice_zero6.Checked ? "1" : "0"); if (OpType == 0) { dicFields.Add("financial_ser_param_id", Guid.NewGuid().ToString()); dicFields.Add("book_id", id); dicFields.Add("create_by", GlobalStaticObj_Server.Instance.UserID); dicFields.Add("create_time", Common.LocalDateTimeToUtcLong(GlobalStaticObj_Server.Instance.CurrentDateTime).ToString()); } else { dicFields.Add("update_by", GlobalStaticObj_Server.Instance.UserID); dicFields.Add("update_time", Common.LocalDateTimeToUtcLong(GlobalStaticObj_Server.Instance.CurrentDateTime).ToString()); } return dicFields; }
/// <summary> 获取库存参数集合 /// </summary> public Dictionary<string, string> GetStockParas() { Dictionary<string, string> dicFields = new Dictionary<string, string>(); dicFields.Add("monthly_average_method", rbmonthly_average_method.Checked ? "1" : "0"); dicFields.Add("moving_average_method", rbmoving_average_method.Checked ? "1" : "0"); dicFields.Add("fifo_method", rbfifo_method.Checked ? "1" : "0"); dicFields.Add("counts", numcounts5.Value.ToString()); dicFields.Add("counts_zero", cbcounts_zero5.Checked ? "1" : "0"); dicFields.Add("price", numprice5.Value.ToString()); dicFields.Add("price_zero", cbprice_zero5.Checked ? "1" : "0"); dicFields.Add("warehous_single_reference", cbwarehous_single_reference.Checked ? "1" : "0"); dicFields.Add("storage_manage", cbstorage_manage.Checked ? "1" : "0"); dicFields.Add("batch_manage", cbbatch_manage.Checked ? "1" : "0"); dicFields.Add("making_audit_one_person", cbmaking_audit_one_person.Checked ? "1" : "0"); dicFields.Add("allow_zero_lib_stock", cballow_zero_lib_stock.Checked ? "1" : "0"); dicFields.Add("allow_zero_lib_junction", cballow_zero_lib_junction.Checked ? "1" : "0"); dicFields.Add("single_editors_one_person", cbsingle_editors_one_person5.Checked ? "1" : "0"); dicFields.Add("single_audit_one_person", cbsingle_audit_one_person5.Checked ? "1" : "0"); dicFields.Add("single_disabled_one_person", cbsingle_disabled_one_person5.Checked ? "1" : "0"); dicFields.Add("single_delete_one_person", cbsingle_delete_one_person5.Checked ? "1" : "0"); if (OpType == 0) { dicFields.Add("stock_param_id", Guid.NewGuid().ToString()); dicFields.Add("book_id", id); dicFields.Add("create_by", GlobalStaticObj_Server.Instance.UserID); dicFields.Add("create_time", Common.LocalDateTimeToUtcLong(GlobalStaticObj_Server.Instance.CurrentDateTime).ToString()); } else { dicFields.Add("update_by", GlobalStaticObj_Server.Instance.UserID); dicFields.Add("update_time", Common.LocalDateTimeToUtcLong(GlobalStaticObj_Server.Instance.CurrentDateTime).ToString()); } return dicFields; }
/// <summary> 获取销售参数集合 /// </summary> public Dictionary<string, string> GetSaleParas() { Dictionary<string, string> dicFields = new Dictionary<string, string>(); dicFields.Add("single_disabled_same_person", cbsingle_disabled_same_person4.Checked ? "1" : "0"); dicFields.Add("single_delete_same_person", cbsingle_delete_same_person4.Checked ? "1" : "0"); dicFields.Add("sales_plan_audit", cbsales_plan_audit.Checked ? "1" : "0"); dicFields.Add("sales_order_audit", cbsales_order_audit.Checked ? "1" : "0"); dicFields.Add("sales_open_audit", cbsales_open_audit.Checked ? "1" : "0"); dicFields.Add("sales_open_outin", cbsales_open_outin.Checked ? "1" : "0"); dicFields.Add("sales_order_line_credit", cbsales_order_line_credit.Checked ? "1" : "0"); dicFields.Add("sales_open_line_credit", cbsales_open_line_credit.Checked ? "1" : "0"); dicFields.Add("single_editors_same_person", cbsingle_editors_same_person4.Checked ? "1" : "0"); dicFields.Add("single_audit_same_person", cbsingle_audit_same_person4.Checked ? "1" : "0"); if (OpType == 0) { dicFields.Add("sale_param_id", Guid.NewGuid().ToString()); dicFields.Add("book_id", id); dicFields.Add("create_by", GlobalStaticObj_Server.Instance.UserID); dicFields.Add("create_time", Common.LocalDateTimeToUtcLong(GlobalStaticObj_Server.Instance.CurrentDateTime).ToString()); } else { dicFields.Add("update_by", GlobalStaticObj_Server.Instance.UserID); dicFields.Add("update_time", Common.LocalDateTimeToUtcLong(GlobalStaticObj_Server.Instance.CurrentDateTime).ToString()); } return dicFields; }
/// <summary> 获取维修参数集合 /// </summary> public Dictionary<string, string> GetRepairParas() { Dictionary<string, string> dicFields = new Dictionary<string, string>(); dicFields.Add("repail_flow1", rbrepail_flow1.Checked ? "1" : "0"); dicFields.Add("single_editors_same_person", cbsingle_editors_same_person2.Checked ? "1" : "0"); dicFields.Add("single_audit_same_person", cbsingle_audit_same_person2.Checked ? "1" : "0"); dicFields.Add("single_disabled_same_person", cbsingle_disabled_same_person2.Checked ? "1" : "0"); dicFields.Add("single_delete_same_person", cbsingle_delete_same_person2.Checked ? "1" : "0"); dicFields.Add("repair_reception_import_pre", cbrepair_reception_import_pre.Checked ? "1" : "0"); dicFields.Add("repair_return_import_pre", cbrepair_return_import_pre.Checked ? "1" : "0"); dicFields.Add("requisition_import_pre", cbrequisition_import_pre.Checked ? "1" : "0"); dicFields.Add("material_return_import_pre", cbmaterial_return_import_pre.Checked ? "1" : "0"); dicFields.Add("three_service_import_pre_yt", cbthree_service_import_pre_yt.Checked ? "1" : "0"); dicFields.Add("appointment_audit", cbappointment_audit.Checked ? "1" : "0"); dicFields.Add("old_pieces_storage_import_pre", cbold_pieces_storage_import_pre.Checked ? "1" : "0"); dicFields.Add("allow_material_larger_parts_r", cballow_material_larger_parts_r.Checked ? "1" : "0"); dicFields.Add("requisition_auto_outbound", cbrequisition_auto_outbound.Checked ? "1" : "0"); dicFields.Add("repail_flow2", rbrepail_flow2.Checked ? "1" : "0"); dicFields.Add("r_reception_audit", cbr_reception_audit.Checked ? "1" : "0"); dicFields.Add("repail_flow3", rbrepail_flow3.Checked ? "1" : "0"); dicFields.Add("r_schedul_quality_ins", cbr_schedul_quality_ins.Checked ? "1" : "0"); dicFields.Add("r_settlement_audit", cbr_settlement_audit.Checked ? "1" : "0"); dicFields.Add("rescue_audit", cbrescue_audit.Checked ? "1" : "0"); dicFields.Add("r_return_audit", cbr_return_audit.Checked ? "1" : "0"); dicFields.Add("requisition_audit", cbrequisition_audit.Checked ? "1" : "0"); dicFields.Add("material_return_audit", cbmaterial_return_audit.Checked ? "1" : "0"); dicFields.Add("time_standards", txtTimeStandtards.Value.ToString()); if (OpType == 0) { dicFields.Add("r_param_id", Guid.NewGuid().ToString()); dicFields.Add("book_id", id); dicFields.Add("create_by", GlobalStaticObj_Server.Instance.UserID); dicFields.Add("create_time", Common.LocalDateTimeToUtcLong(GlobalStaticObj_Server.Instance.CurrentDateTime).ToString()); } else { dicFields.Add("update_by", GlobalStaticObj_Server.Instance.UserID); dicFields.Add("update_time", Common.LocalDateTimeToUtcLong(GlobalStaticObj_Server.Instance.CurrentDateTime).ToString()); } return dicFields; }
/// <summary> 获取帐套信息参数集合 /// </summary> public Dictionary<string, string> GetAccParas() { Dictionary<string, string> dicFields = new Dictionary<string, string>(); dicFields.Add("setbook_name", txtsetbook_name.Caption.Trim()); dicFields.Add("com_name", txtcom_name.Caption.Trim()); dicFields.Add("organization_code", txtorganization_code.Caption.Trim()); dicFields.Add("contact", txtcontact.Caption.Trim()); dicFields.Add("contact_telephone", txtcontact_telephone.Caption.Trim()); dicFields.Add("legal_person", txtlegal_person.Caption.Trim()); dicFields.Add("email", txtemail.Caption.Trim()); dicFields.Add("opening_bank", txtopening_bank.Caption.Trim()); dicFields.Add("bank_account", txtbank_account.Caption.Trim()); dicFields.Add("province", ddlprovince.SelectedValue.ToString()); dicFields.Add("city", ddlcity.SelectedValue.ToString()); dicFields.Add("county", ddlcounty.SelectedValue.ToString()); dicFields.Add("postal_address", txtpostal_address.Caption.Trim()); dicFields.Add("zip_code", txtzip_code.Caption.Trim()); dicFields.Add("company_web_site", txtcompany_web_site.Caption.Trim()); if (OpType == 0) { id = Guid.NewGuid().ToString(); dicFields.Add("id", id); dicFields.Add("setbook_code", txtsetbook_code.Caption.Trim()); dicFields.Add("is_main_set_book", ((int)DataSources.EnumYesNo.NO).ToString()); dicFields.Add("create_by", GlobalStaticObj_Server.Instance.UserID); dicFields.Add("create_time", Common.LocalDateTimeToUtcLong(GlobalStaticObj_Server.Instance.CurrentDateTime).ToString()); dicFields.Add("status", ((int)DataSources.EnumStatus.Start).ToString()); dicFields.Add("enable_flag", ((int)DataSources.EnumEnableFlag.USING).ToString()); } else { dicFields.Add("update_by", GlobalStaticObj_Server.Instance.UserID); dicFields.Add("update_time", Common.LocalDateTimeToUtcLong(GlobalStaticObj_Server.Instance.CurrentDateTime).ToString()); } return dicFields; }
/// <summary> 创建帐套 /// </summary> private void btnCreateAcc_Click(object sender, EventArgs e) { try { List<SysSQLString> list = new List<SysSQLString>(); SysSQLString sysSQLString; StringBuilder strSql; #region 帐套信息 sysSQLString = new SysSQLString(); sysSQLString.cmdType = CommandType.Text; strSql = new StringBuilder(); strSql.Append("insert into sys_setbook("); strSql.Append("id,setbook_name,is_main_set_book,setbook_code,com_name,organization_code,legal_person,opening_bank,bank_account,province,city,county,postal_address,zip_code,company_web_site,email,contact,contact_telephone,status,create_by,create_time,enable_flag"); strSql.Append(") values ("); strSql.Append("@id,@setbook_name,@is_main_set_book,@setbook_code,@com_name,@organization_code,@legal_person,@opening_bank,@bank_account,@province,@city,@county,@postal_address,@zip_code,@company_web_site,@email,@contact,@contact_telephone,@status,@create_by,@create_time,@enable_flag) "); sysSQLString.sqlString = strSql.ToString(); sysSQLString.Param = GetAccParas(); list.Add(sysSQLString); #endregion #region 维修参数 sysSQLString = new SysSQLString(); sysSQLString.cmdType = CommandType.Text; strSql = new StringBuilder(); strSql.Append("insert into sys_repair_param("); strSql.Append("r_param_id,appointment_audit,r_reception_audit,r_schedul_quality_ins,r_settlement_audit,rescue_audit,r_return_audit,requisition_audit,material_return_audit,repail_flow1,single_editors_same_person,single_audit_same_person,single_disabled_same_person,single_delete_same_person,repair_reception_import_pre,repair_return_import_pre,requisition_import_pre,material_return_import_pre,three_service_import_pre_yt,old_pieces_storage_import_pre,allow_material_larger_parts_r,requisition_auto_outbound,create_by,create_time,book_id,repail_flow2,repail_flow3,time_standards"); strSql.Append(") values ("); strSql.Append("@r_param_id,@appointment_audit,@r_reception_audit,@r_schedul_quality_ins,@r_settlement_audit,@rescue_audit,@r_return_audit,@requisition_audit,@material_return_audit,@repail_flow1,@single_editors_same_person,@single_audit_same_person,@single_disabled_same_person,@single_delete_same_person,@repair_reception_import_pre,@repair_return_import_pre,@requisition_import_pre,@material_return_import_pre,@three_service_import_pre_yt,@old_pieces_storage_import_pre,@allow_material_larger_parts_r,@requisition_auto_outbound,@create_by,@create_time,@book_id,@repail_flow2,@repail_flow3,@time_standards) "); sysSQLString.sqlString = strSql.ToString(); sysSQLString.Param = GetRepairParas(); list.Add(sysSQLString); #endregion #region 采购参数 sysSQLString = new SysSQLString(); sysSQLString.cmdType = CommandType.Text; strSql = new StringBuilder(); strSql.Append("insert into sys_purchase_param("); strSql.Append("purchase_param_id,purchase_plan_audit,purchase_order_audit,purchase_open_audit,purchase_order_audit_yt,purchase_open_outin,single_editors_same_person,single_audit_same_person,single_disabled_same_person,single_delete_same_person,purchase_order_import_pre,purchase_open_import_pre,create_by,create_time,book_id"); strSql.Append(") values ("); strSql.Append("@purchase_param_id,@purchase_plan_audit,@purchase_order_audit,@purchase_open_audit,@purchase_order_audit_yt,@purchase_open_outin,@single_editors_same_person,@single_audit_same_person,@single_disabled_same_person,@single_delete_same_person,@purchase_order_import_pre,@purchase_open_import_pre,@create_by,@create_time,@book_id) "); sysSQLString.sqlString = strSql.ToString(); sysSQLString.Param = GetPurchaseParas(); list.Add(sysSQLString); #endregion #region 销售参数 sysSQLString = new SysSQLString(); sysSQLString.cmdType = CommandType.Text; strSql = new StringBuilder(); strSql.Append("insert into sys_sale_param("); strSql.Append("sale_param_id,sales_plan_audit,sales_order_audit,sales_open_audit,sales_open_outin,sales_order_line_credit,sales_open_line_credit,single_editors_same_person,single_audit_same_person,single_disabled_same_person,single_delete_same_person,create_by,create_time,book_id"); strSql.Append(") values ("); strSql.Append("@sale_param_id,@sales_plan_audit,@sales_order_audit,@sales_open_audit,@sales_open_outin,@sales_order_line_credit,@sales_open_line_credit,@single_editors_same_person,@single_audit_same_person,@single_disabled_same_person,@single_delete_same_person,@create_by,@create_time,@book_id) "); sysSQLString.sqlString = strSql.ToString(); sysSQLString.Param = GetSaleParas(); list.Add(sysSQLString); #endregion #region 库存参数 sysSQLString = new SysSQLString(); sysSQLString.cmdType = CommandType.Text; strSql = new StringBuilder(); strSql.Append("insert into sys_stock_param("); strSql.Append("stock_param_id,storage_manage,making_audit_one_person,allow_zero_lib_stock,allow_zero_lib_junction,single_editors_one_person,single_audit_one_person,single_disabled_one_person,single_delete_one_person,monthly_average_method,moving_average_method,fifo_method,counts,counts_zero,price,price_zero,warehous_single_reference,create_by,create_time,book_id,batch_manage"); strSql.Append(") values ("); strSql.Append("@stock_param_id,@storage_manage,@making_audit_one_person,@allow_zero_lib_stock,@allow_zero_lib_junction,@single_editors_one_person,@single_audit_one_person,@single_disabled_one_person,@single_delete_one_person,@monthly_average_method,@moving_average_method,@fifo_method,@counts,@counts_zero,@price,@price_zero,@warehous_single_reference,@create_by,@create_time,@book_id,@batch_manage) "); sysSQLString.sqlString = strSql.ToString(); sysSQLString.Param = GetStockParas(); list.Add(sysSQLString); #endregion #region 财务参数 sysSQLString = new SysSQLString(); sysSQLString.cmdType = CommandType.Text; strSql = new StringBuilder(); strSql.Append("insert into sys_financial_ser_param("); strSql.Append("financial_ser_param_id,tax_rate,currency,counts,counts_zero,price,price_zero,create_by,create_time,book_id"); strSql.Append(") values ("); strSql.Append("@financial_ser_param_id,@tax_rate,@currency,@counts,@counts_zero,@price,@price_zero,@create_by,@create_time,@book_id) "); sysSQLString.sqlString = strSql.ToString(); sysSQLString.Param = GetFinancParas(); list.Add(sysSQLString); #endregion #region 创建帐套 try { string newDbName = GlobalStaticObj_Server.DbPrefix + txtsetbook_code.Caption.Trim(); Dictionary<string, string> dicParam = new Dictionary<string, string>(); dicParam.Add("newDbName", newDbName);//新建数据库名(不带扩展名) dicParam.Add("dbDataDirPath", GlobalStaticObj_Server.Instance.DbServerInstallDir);//服务端数据库安装路径(带\) dicParam.Add("soureDbName", GlobalStaticObj_Server.Instance.DbTemplateBakFileName);//原数据库名(不带扩展名) dicParam.Add("soureBackupFilePATH", GlobalStaticObj_Server.Instance.DbServerBackDir + GlobalStaticObj_Server.Instance.DbTemplateBakFileName + ".bak");//服务端备份文件路径(带文件名扩展名) DBHelper.ExtNonQuery("创建帐套", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, "sp_createdbbybak", CommandType.StoredProcedure, dicParam); } catch (Exception ex) { MessageBoxEx.Show("帐套创建失败" + ex.Message, "系统提示"); OpType = 0; return; } #endregion bool flag = DBHelper.BatchExeSQLStringMultiByTrans("创建帐套", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, list); if (!flag) { MessageBoxEx.Show("帐套创建失败", "系统提示"); return; } MessageBoxEx.Show("帐套创建成功", "系统提示"); this.DialogResult = DialogResult.OK; } catch (Exception ex) { GlobalStaticObj_Server.GlobalLogService.WriteLog("帐套设置", ex); MessageBoxEx.ShowWarning("程序异常"); } }
//服务站库存 private void btnStock_Click(object sender, EventArgs e) { try { Dictionary<string, int> dicStock = new Dictionary<string, int>(); DataTable StockTable = GetActualStock();//获取当前实际库存统计 for (int i = 0; i < StockTable.Rows.Count; i++) { int PartsCount = StockTable.Rows[i]["statis_count"].ToString() == string.Empty ? 0 : Convert.ToInt32(StockTable.Rows[i]["statis_count"].ToString()); dicStock.Add(StockTable.Rows[i]["car_parts_code"].ToString(), PartsCount); } bool flag = yuTongWebService.WebServ_YT_BasicData.UpLoadSercicePartStock(dicStock); if (!flag) { MessageBoxEx.Show("上传库存失败!", "系统提示"); return; } else { MessageBoxEx.Show("上传库存成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { GlobalStaticObj_Server.GlobalLogService.WriteLog("UCHomePage", ex); MessageBoxEx.ShowWarning("程序异常"); } }
/// <summary> 定时器(5分钟) /// </summary> private void timerBackupPlan_Tick(object sender, EventArgs e) { if (!cbAutoBackup.Checked) { return; } //if (GlobalStaticObj_Server.Instance.CurrentDateTime.Hour > 2 && GlobalStaticObj_Server.Instance.CurrentDateTime.Hour < 4) //{ try { bool isAllBackUp = false; List<string> list = new List<string>(); #region 记录需要备份的账套 foreach (string str in GlobalStaticObj_Server.Instance.DicBackupPlan.Keys) { string[] intArr = GlobalStaticObj_Server.Instance.DicBackupPlan[str]; DateTime dtStart = Common.UtcLongToLocalDateTime(Convert.ToInt64(intArr[2])); bool isBackup = false; if (intArr[3] == "") { isBackup = true; } else { DateTime dtLastBackupTime = Common.UtcLongToLocalDateTime(Convert.ToInt64(intArr[3])); if (Convert.ToInt32(intArr[0]) == (int)DataSources.EnumAutoBackupType.EveryDay) { if ((GlobalStaticObj_Server.Instance.CurrentDateTime - dtLastBackupTime).Days > Convert.ToInt32(intArr[1])) { isBackup = true; } } else if (Convert.ToInt32(intArr[0]) == (int)DataSources.EnumAutoBackupType.EveryWeek) { int weekEnum = (int)GlobalStaticObj_Server.Instance.CurrentDateTime.DayOfWeek; if (weekEnum == 0) { weekEnum = 7; } if (Convert.ToInt32(intArr[1]) == weekEnum) { if (Common.GetWeekOfYear(dtLastBackupTime) != Common.GetWeekOfYear(GlobalStaticObj_Server.Instance.CurrentDateTime)) { isBackup = true; } } } else if (Convert.ToInt32(intArr[0]) == (int)DataSources.EnumAutoBackupType.EveryMonth && GlobalStaticObj_Server.Instance.CurrentDateTime.Day == Convert.ToInt32(intArr[1])) { if (dtLastBackupTime.Date != GlobalStaticObj_Server.Instance.CurrentDateTime.Date) { isBackup = true; } } } if (isBackup) { if (str == "") { DataTable dt = DBHelper.GetTable("获取账套信息", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, "sys_setbook", "*", "enable_flag=1", "", "order by setbook_code"); foreach (DataRow drAcc in dt.Rows) { string accCode = drAcc["setbook_code"].ToString(); if (!list.Contains(accCode)) { list.Add(accCode); } } isAllBackUp = true; break; } else { if (!list.Contains(str)) { list.Add(str); } } } } #endregion #region 开始备份 DateTime dtBakTime = GlobalStaticObj_Server.Instance.CurrentDateTime; bool isSuccess = true; foreach (string accCode in list) { string bak_filename = accCode + dtBakTime.ToString("yyMMdd") + ".bak"; string errMsg = CommonUtility.BackupDb(accCode, bak_filename); if (!string.IsNullOrEmpty(errMsg)) { isSuccess = false; } } #endregion #region 如果是备份 所有账套,记录备份记录 if (isAllBackUp) { Dictionary<string, string> dicFields = new Dictionary<string, string>(); dicFields.Add("bak_id", Guid.NewGuid().ToString()); dicFields.Add("bak_acccode", "---"); dicFields.Add("bak_filename", "所有账套"); dicFields.Add("is_success", Convert.ToInt32(isSuccess).ToString()); dicFields.Add("bak_method", Convert.ToInt32(DataSources.EnumBackupMethod.ManualBackup).ToString()); dicFields.Add("bak_time", Common.LocalDateTimeToUtcLong(dtBakTime).ToString()); dicFields.Add("bak_by", GlobalStaticObj_Server.Instance.UserID); DBHelper.Submit_AddOrEdit("新建备份记录", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, "sys_backup_record", "", "", dicFields); } #endregion } catch (Exception ex) { GlobalStaticObj_Server.GlobalLogService.WriteLog("UCHomePage", ex); } //} }
/// <summary> 获取注册公司参数集合 /// </summary> public Dictionary<string, string> GetCorpParas() { Dictionary<string, string> dicFields = new Dictionary<string, string>(); dicFields.Add("com_name", txtcom_name.Caption);//服务站全称 dicFields.Add("province", ddlprovince.SelectedValue.ToString());//省份 dicFields.Add("city", ddlcity.SelectedValue.ToString());//城市 dicFields.Add("county", ddlcounty.SelectedValue.ToString());//县市区 dicFields.Add("zip_code", txtzip_code.Caption);//邮编 dicFields.Add("email", txtcom_email.Caption);//email dicFields.Add("contact_address", txtcom_address.Caption);//联系地址 dicFields.Add("contact", txtcom_contact.Caption);//联系人 dicFields.Add("contact_tel", txtcom_tel.Caption);//联系电话 dicFields.Add("legal_person", txtlegal_person.Caption);//法人 dicFields.Add("repair_qualification", txtrepair_qualification.Caption);//维修资质 dicFields.Add("nature_unit", txtunit_properties.Caption);//单位性质 dicFields.Add("hotline", txthotline.Caption);//热线电话 dicFields.Add("fax", txtcom_fax.Caption);//传真 dicFields.Add("service_station_sap", txtservice_station_sap.Caption.Trim()); dicFields.Add("access_code", txtaccess_code.Caption.Trim()); if (isAdd) { if (txtgrant_authorization.Tag != null) { dicFields.Add("protocol_expires_time", txtgrant_authorization.Tag.ToString()); } dicFields.Add("machine_code_sequence", txtmachine_code_sequence.Caption.Trim());//机器码 dicFields.Add("grant_authorization", txtgrant_authorization.Caption.Trim());//授权码 dicFields.Add("authentication_status", ((int)DataSources.EnumYesNo.Yes).ToString());//授权状态 dicFields.Add("authentication", txtauthentication.Caption.Trim());//鉴权码 dicFields.Add("s_user", txts_user.Caption.Trim()); dicFields.Add("s_pwd", txts_pwd.Caption.Trim()); dicFields.Add("sign_id", txtsign_id.Caption.Trim()); dicFields.Add("apply_time", Common.LocalDateTimeToUtcLong(GlobalStaticObj_Server.Instance.CurrentDateTime).ToString()); dicFields.Add("create_time", Common.LocalDateTimeToUtcLong(GlobalStaticObj_Server.Instance.CurrentDateTime).ToString()); } else { dicFields.Add("update_time", Common.LocalDateTimeToUtcLong(GlobalStaticObj_Server.Instance.CurrentDateTime).ToString()); } return dicFields; }