Пример #1
0
 /// <summary>
 /// 使用条码获取数据,可能返回OPListForSpecimen单个字符串、正常数据、“”;
 /// </summary>
 /// <param name="barcode">条码</param>
 /// <returns>Json格式的字符串(包含有隐藏域文件)</returns>
 public string GetDataByBarcode(string barcode)
 {
     //01.创建字典
     Dictionary<string, string> oPListForSpecimen = new Dictionary<string, string>();
     //02.调用方法获取数据并将数据转换成字典
     oPListForSpecimen = GetOPListForSpecimenByBarcodeAndToDic(barcode);
     string result = "";
     if (oPListForSpecimen != null)//链接无错误
     {
         if (oPListForSpecimen.Count > 0)//有获取到数据
         {
             //03.调用方法将字典转换成JSON数据
             if (oPListForSpecimen["KeepSpecimenSign"]=="N")
             {
                 oPListForSpecimen["KeepSpecimenSign"] = "";
             }
             if (oPListForSpecimen.Keys.Contains("OPListForSpecimen"))
             {
                 string value = "";
                 if (oPListForSpecimen.TryGetValue("OPListForSpecimen", out value))
                 {
                     result = "{\"OPListForSpecimen:\":\"" + value + "\"}";
                 }
             }
             else if (oPListForSpecimen.Count > 1)
             {
                 // result = ConvertDicToJsonStr(oPListForSpecimen);
                 result = FpJsonHelper.DictionaryToJsonString(oPListForSpecimen);
             }
         }
     }
     return result;
 }
Пример #2
0
        public AddTopic()
        {
            InitializeComponent();

            button1.BackColor = Color.FromArgb(255, 80, 151, 228);
            button2.BackColor = Color.FromArgb(255, 80, 151, 228);
            addDetail.BackColor = Color.FromArgb(255, 80, 151, 228);
            delDetail.BackColor = Color.FromArgb(255, 80, 151, 228);

            button1.ForeColor = Color.White;
            button2.ForeColor = Color.White;
            addDetail.ForeColor = Color.White;
            delDetail.ForeColor = Color.White;

            if (agreementService == null)
            {
                agreementService = AgreementService.getInstance();
            }
            if (strWheres == null)
            {
                strWheres = new Dictionary<string, string>();
            }

            topicCategory.Items.Clear();
            topicCategory.DataSource = Bll.getAllCourses().Tables[0];
            topicCategory.DisplayMember = "TCZ_NAME";
            topicCategory.ValueMember = "TCZ_ID";

            topicType.Items.Clear();
            topicType.DataSource = Constant.getTopicType();
            topicType.DisplayMember = "name";
            topicType.ValueMember = "id";
        }
Пример #3
0
        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);
        }
Пример #4
0
 /// <summary>
 /// 提交数据到FP并返回FP处理的结果
 /// </summary>
 /// <param name="sampleSourceTypeName">样本源类型名称</param>
 /// <param name="sampleSourceName">样本源名称</param>
 /// <param name="patientId">样本源唯一标识</param>
 /// <param name="sampleSourceDescription">样本源描述</param>
 /// <param name="hiddenEncodeStr">隐藏域中的加密字段</param>
 /// <returns></returns>
 public string ImportDataToFpAndRetunFpResult(string sampleSourceTypeName, string sampleSourceName, string patientId, string sampleSourceDescription, string hiddenEncodeStr)
 {
     Dictionary<string, string> sampleSourceNameAndDesDic = sampleSouce.GetSampleSourceTypeNameAndDecToDic();
     if (sampleSourceNameAndDesDic.Keys.Contains(sampleSourceTypeName))//系统中有此样本源
     {
         //01.接受前台页面发送回来的数据,并将数据转换成字典
         Dictionary<string, string> oPListForSpecimenDic = new Dictionary<string, string>();
         oPListForSpecimenDic = DecodeHiddenEncodeStr(hiddenEncodeStr);
         if (oPListForSpecimenDic.Count > 0)//解码成功()
         {
             //02.获取用户自定义字段集合(根据指定的样本源类型名称)
             //03.获取配置文件中的字段匹配字典
             //04.根据用户自定义字段字典和字段匹配字典生成需要导入到Fp中的字段字典
             Dictionary<string, string> sampleSourceFieldsDic = new Dictionary<string, string>();
             sampleSourceFieldsDic = MathcSampleSourceFieldsWithConfigFile(sampleSourceTypeName, sampleSourceName, sampleSourceDescription, oPListForSpecimenDic);
             //06.调用API提交数据到Fp
             string result = sampleSouce.ImportSampleSourceDataToFp(sampleSourceTypeName, sampleSourceFieldsDic);
             return result;
         }
         else
         {
             //解析前台页面中的隐藏数据失败(隐藏域数据解析错误?-->加密出错??-->数据来源错误?)
             return "DecodError";
         }
     }
     else
     {
         //样本源类型不存在
         return "sampleSourceNameNotExist";
     }
 }
Пример #5
0
 /// <summary> 查询单个字段的值(一般求最大,最小值)
 /// <param name="opName">操作名</param>
 /// <param name="tableName">表名</param>
 /// <param name="field">单个查询字段</param>
 /// <param name="orderBy">排序字段,多个以“,”分割</param>
 /// </summary>
 /// <returns>返回Value</returns>
 public static string GetSingleValue(string opName, string currAccDbName, string tableName, string field, string where, string orderBy)
 {
     StringBuilder strBuilder = new StringBuilder();
     strBuilder.Append("select " + field);
     if (!string.IsNullOrEmpty(tableName))
     {
         strBuilder.Append(" from  " + tableName);
         if (!string.IsNullOrEmpty(where))
         {
             strBuilder.Append(" where  " + where);
         }
         if (!string.IsNullOrEmpty(orderBy))
         {
             strBuilder.Append(" order by  " + orderBy);
         }
     }
     Dictionary<string, ParamObj> dic = new Dictionary<string, ParamObj>();
     UserIDOP userOp = new UserIDOP() { UserID = GlobalStaticObj_Server.Instance.UserID, OPName = opName };
     string connString = LocalVariable.GetConnString(currAccDbName, ConfigConst.ConnectionStringReadonly);
     object obj = DbCommon.Instance.ExecuteNonQueryReturnObjectNoTrans(connString, CommandType.Text, strBuilder.ToString(), dic, userOp);
     if (obj == null)
     {
         return "";
     }
     return obj.ToString();
 }
Пример #6
0
 public void loadData(Dictionary<string, string> strWheres)
 {
     int startIndex = pageCtrl.StartIndex;
     int pageSize = pageCtrl.PageSize;
     DataSet ds = implCourses.getSounds(strWheres, startIndex, pageSize);
     pageCtrl.bs.DataSource = ds.Tables[0];
 }
        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();
        }
        private static IDictionary<string, decimal> CalculateValues(Portfolio portfolio, IDictionary<string, decimal> quotes)
        {
            var results = new Dictionary<string, 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;
                        if (results.ContainsKey(position.Security.Symbol))
                            results[position.Security.Symbol] += value;
                        else
                            results.Add(position.Security.Symbol, value);
                    }
                    catch (KeyNotFoundException)
                    {
                        results.Add(position.Security.Symbol, -1M);
                    }
                }
            }

            return results;
        }
        // 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;
            }
        }
        private static IDictionary<DateTime, IDictionary<IDomainEntity, decimal>> GetValues(Portfolio portfolio, IDictionary<DateTime, IDictionary<string, decimal>> priceDates)
        {
            var results = new Dictionary<DateTime, IDictionary<IDomainEntity, decimal>>();

            foreach (var date in priceDates.Keys)
            {
                var values = new Dictionary<IDomainEntity, decimal>();
                results[date] = values;
                var prices = priceDates[date];

                foreach (var account in portfolio.Accounts)
                {
                    foreach (var position in account.Positions)
                    {
                        try
                        {
                            var price = prices[position.Security.Symbol];
                            var value = price*position.Shares;
                            values.Add(position, value);
                        }
                        catch (KeyNotFoundException)
                        {
                            values.Add(position, -1M);
                        }
                    }
                }
            }

            return results;
        }
Пример #11
0
 /// <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("程序异常");
     }
 }
Пример #12
0
 /// <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);
 }
Пример #13
0
        /// <summary> 保存
        /// </summary>
        void UCOrganizeAddOrEdit_SaveEvent(object sender, EventArgs e)
        {
            if (this.cmbCompany.SelectedIndex == 0)
            {
                Validator.SetError(errProvider, cmbCompany, "请选择所属公司");
                return;
            }
            if (tbCode.Caption.Length == 0)
            {
                Validator.SetError(errProvider, tbCode, "请填写组织编码");
                return;
            }
            if (tbName.Caption.Length == 0)
            {
                Validator.SetError(errProvider, tbName, "请填写组织名称");
                return;
            }

            Dictionary<string, string> dicFileds = new Dictionary<string, string>();
            dicFileds.Add("com_id", this.cmbCompany.SelectedValue.ToString());
            dicFileds.Add("parent_id", this.cmbOrganize.SelectedValue.ToString());
            dicFileds.Add("org_code", this.tbCode.Caption.Trim());
            dicFileds.Add("org_name", this.tbName.Caption.Trim());//公司全名
            dicFileds.Add("contact_name", this.tbContract.Caption.Trim());//联系人
            dicFileds.Add("contact_telephone", this.tbTelephone.Caption.Trim());
            dicFileds.Add("remark", this.tbRemark.Caption.Trim());
            dicFileds.Add("update_by", GlobalStaticObj_Server.Instance.UserID);
            dicFileds.Add("update_time", Common.LocalDateTimeToUtcLong(DateTime.Now).ToString());
            string pkName = "";
            string pkValue = "";
            if (windowStatus == WindowStatus.Add)
            {
                dicFileds.Add("org_id", Guid.NewGuid().ToString());
                dicFileds.Add("enable_flag", "1");//1为未删除状态
                dicFileds.Add("status", DataSources.EnumStatus.Start.ToString("d"));//启用
                dicFileds.Add("create_by", GlobalStaticObj_Server.Instance.UserID);
                dicFileds.Add("create_time", Common.LocalDateTimeToUtcLong(DateTime.Now).ToString());               
            }
            else
            {
                pkName = "org_id";
                pkValue = drRecord["org_id"].ToString();
            }

            bool bln = DBHelper.Submit_AddOrEdit("添加组织档案", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, "tb_organization", pkName, pkValue, dicFileds);
            if (bln)
            {
                MessageBoxEx.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                uc.BindData();
                deleteMenuByTag(this.Tag.ToString(), uc.Name);
            }
            else
            {
                MessageBoxEx.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #14
0
 //已经关注的用户扫描二维码参数
 public void DoSubCode(Dictionary<string, string> model)
 {
     SText mT = new SText();
     mT.Content = ReadXml.Menu();
     mT.FromUserName = ReadXml.ReadModel("ToUserName", model);
     mT.ToUserName = ReadXml.ReadModel("FromUserName", model);
     mT.MsgType = "text";
     mT.CreateTime = long.Parse(ReadXml.ReadModel("CreateTime", model));
     ReadXml.ResponseToEnd(DALWei.SendText(mT));
 }
Пример #15
0
 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;
 }
Пример #16
0
        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();
        }
Пример #17
0
 /// <summary> 查询单个字段的值(一般求最大,最小值)
 /// <param name="strSql">sql语句</param>
 /// </summary>
 /// <returns>返回Value</returns>
 public static string GetSingleValue(string opName, string currAccDbName, string strSql)
 {
     Dictionary<string, ParamObj> dic = new Dictionary<string, ParamObj>();
     UserIDOP userOp = new UserIDOP() { UserID = GlobalStaticObj_Server.Instance.UserID, OPName = opName };
     string connString = LocalVariable.GetConnString(currAccDbName, ConfigConst.ConnectionStringReadonly);
     object obj = DbCommon.Instance.ExecuteNonQueryReturnObjectNoTrans(connString, CommandType.Text, strSql, dic, userOp);
     if (obj == null)
     {
         return "";
     }
     return obj.ToString();
 }
Пример #18
0
        //保存
        void UCCompanyViewOrAdd_SaveEvent(object sender, EventArgs e)
        {
            errProvider.Clear();
            if (this.tbCode.Caption.Trim().Length == 0)
            {
                Validator.SetError(errProvider, tbCode, "请录入公司编码");
                return;
            }
            if (this.tbName.Caption.Trim().Length == 0)
            {
                Validator.SetError(errProvider, tbName, "请录入公司名称");
                return;
            }

            //父公司
            if (cmbFather.SelectedIndex == 0)
            {
                Validator.SetError(errProvider, cmbFather, "请选择上级公司");
                return;
            }

            Dictionary<string, string> dicFileds = new Dictionary<string, string>();
            dicFileds.Add("com_code", this.tbCode.Caption.Trim());
            dicFileds.Add("com_name", this.tbName.Caption.Trim());//公司全名
            dicFileds.Add("com_address", this.tbAddress.Caption.Trim());//详细地址
            dicFileds.Add("zip_code", this.tbPostCode.Caption.Trim());//邮编
            dicFileds.Add("legal_person", this.tbLegal_Person.Caption.Trim());//法人负责人
            dicFileds.Add("com_contact", this.tbContract.Caption.Trim());//联系人
            dicFileds.Add("com_tel", this.tbTelephone.Caption.Trim());
            dicFileds.Add("com_email", this.tbEmail.Caption.Trim());//电子邮件
            dicFileds.Add("com_fax", this.tbFax.Caption.Trim());//传真
            dicFileds.Add("com_website", this.tbWeb.Caption.Trim());
            dicFileds.Add("remark", this.tbRemark.Caption.Trim());
            dicFileds.Add("com_id", Guid.NewGuid().ToString());
            dicFileds.Add("parent_id", cmbFather.SelectedValue.ToString());
            dicFileds.Add("create_by", GlobalStaticObj_Server.Instance.UserID);
            dicFileds.Add("create_time", Common.LocalDateTimeToUtcLong(DateTime.Now).ToString());
            dicFileds.Add("enable_flag", DataSources.EnumEnableFlag.USING.ToString("d"));
            dicFileds.Add("status", DataSources.EnumStatus.Start.ToString("d"));        

            bool bln = DBHelper.Submit_AddOrEdit("添加公司档案", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, "tb_company", "", "", dicFileds);
            if (bln)
            {
                MessageBoxEx.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                deleteMenuByTag(this.Tag.ToString(), this.parentName);
                uc.BindData();
            }
            else
            {
                MessageBoxEx.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #19
0
 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;
 }
Пример #20
0
        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;
        }
Пример #21
0
        public static BodyStu createForm()
        {
            if (instance == null || instance.IsDisposed)
            {
                instance = new BodyStu();
                if (userService == null)
                    userService = UserService.getInstance();

                if (classService == null)
                    classService = ClassService.getInstance();

                if (strWheres == null)
                    strWheres = new Dictionary<string, string>();
            }
            return instance;
        }
Пример #22
0
 public static BodyTopic createForm()
 {
     if (instance == null)
     {
         instance = new BodyTopic();
     }
     if (topicService == null)
     {
         topicService = TopicService.getInstance();
     }
     if (strWheres == null)
     {
         strWheres = new Dictionary<string, string>();
     }
     return instance;
 }
Пример #23
0
        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;
        }
Пример #24
0
        public static searchSound createForm(TextBox tBox)
        {
            //if (instance == null || instance.IsDisposed)
            //{
                instance = new searchSound();
            //}
            if (implCourses == null)
            {
                implCourses = ImplCourses.getInstance();
            }
            if (strWheres == null)
            {
                strWheres = new Dictionary<string, string>();
            }
            textBox = tBox;

            return instance;
        }
Пример #25
0
        /// <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;
        }
        public IDictionary<DateTime, IDictionary<string, decimal>> GetHistoricalPrices(IEnumerable<Security> securities, DateTime start, DateTime end, Contracts.Period period)
        {
            var symbols = securities.Select(s => s.Symbol).Distinct().ToList();
            var results = new Dictionary<DateTime, IDictionary<string, decimal>>();

            foreach (var s in symbols)
            {
                var prices = _priceFinder.Get(s, start, end, TranslatePeriod(period));
                foreach (var p in prices)
                {
                    IDictionary<string, decimal> datePrices;
                    if (!results.TryGetValue(p.Date, out datePrices))
                    {
                        datePrices = new Dictionary<string, decimal>();
                        results[p.Date] = datePrices;
                    }

                    datePrices[s] = p.Price;
                }
            }

            return results;
        }
Пример #27
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;
        }
Пример #28
0
 /// <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;
 }
Пример #29
0
 /// <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;
 }
Пример #30
0
 /// <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;
 }