Пример #1
0
        void UCSalePlanView_SaveEvent(object sender, EventArgs e)
        {
            try
            {
                gvPurchasePlanList.EndEdit();
                List<SysSQLString> listSql = new List<SysSQLString>();
                SysSQLString sysStringSql = new SysSQLString();
                sysStringSql.cmdType = CommandType.Text;
                Dictionary<string, string> dic = new Dictionary<string, string>();//参数

                string sql1 = string.Format(@" Update tb_parts_sale_plan Set is_suspend=@is_suspend,suspend_reason=@suspend_reason,update_by=@update_by,
                update_name=@update_name,update_time=@update_time,operators=@operators,operator_name=@operator_name where sale_plan_id=@sale_plan_id;");
                dic.Add("is_suspend", chkis_suspend.Checked ? "0" : "1");//选中(中止):0,未选中(不中止):1
                dic.Add("suspend_reason", txtsuspend_reason.Caption.Trim());
                dic.Add("update_by", GlobalStaticObj.UserID);
                dic.Add("update_name", GlobalStaticObj.UserName);
                dic.Add("update_time", Common.LocalDateTimeToUtcLong(DateTime.Now).ToString());
                dic.Add("operators", GlobalStaticObj.UserID);
                dic.Add("operator_name", GlobalStaticObj.UserName);
                dic.Add("sale_plan_id", planId);
                sysStringSql.sqlString = sql1;
                sysStringSql.Param = dic;
                listSql.Add(sysStringSql);
                foreach (DataGridViewRow dr in gvPurchasePlanList.Rows)
                {
                    string is_suspend = "1";
                    if (dr.Cells["is_suspend"].Value == null)
                    { is_suspend = "1"; }
                    if ((bool)dr.Cells["is_suspend"].EditedFormattedValue)
                    { is_suspend = "0"; }
                    else
                    { is_suspend = "1"; }

                    sysStringSql = new SysSQLString();
                    sysStringSql.cmdType = CommandType.Text;
                    dic = new Dictionary<string, string>();
                    dic.Add("is_suspend", is_suspend);
                    dic.Add("sale_plan_id", planId);
                    dic.Add("parts_code", dr.Cells["parts_code"].Value.ToString());
                    string sql2 = "Update tb_parts_sale_plan_p set is_suspend=@is_suspend where sale_plan_id=@sale_plan_id and parts_code=@parts_code;";
                    sysStringSql.sqlString = sql2;
                    sysStringSql.Param = dic;
                    listSql.Add(sysStringSql);
                }
                if (DBHelper.BatchExeSQLStringMultiByTrans("修改采购计划单", listSql))
                {
                    MessageBoxEx.Show("保存成功!");
                    uc.BindgvSalePlanList();
                    deleteMenuByTag(this.Tag.ToString(), uc.Name);
                }
                else
                {
                    MessageBoxEx.Show("保存失败!");
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show("操作失败!");
            }
        }
        /// <summary>
        /// 查询主表
        /// </summary> 
        public JsonResult QueryMain(string OrderNoOrGoodsCode, DateTime CheckTimeS, DateTime CheckTimeE)
        {
            int page = int.Parse(Request["page"].ToString());
            int rows = int.Parse(Request["rows"].ToString());
            int total = 0;
            VenderUser model = (VenderUser)Session["UserInfo"];
            string where = "  rt.flag in(20 ,40,90,100) ";//and rt.venderid=" + model.VENDERID;

            //管理员测试数据放开
            if (model.VUSERCODE != "system")
            {
                where += " and rt.venderid=" + model.VENDERID;
            }

            if (!string.IsNullOrEmpty(OrderNoOrGoodsCode))
            {
                where += " and rt.sheetid='" + OrderNoOrGoodsCode + "'";
            }
            if (CheckTimeS != null)
            {
                where += " and rt.EditDate> to_date('" + CheckTimeS + "','yyyy-mm-dd hh24:mi:ss')";
            }
            if (CheckTimeE != null)
            {
                where += " and rt.EditDate< to_date('" + CheckTimeE + "','yyyy-mm-dd hh24:mi:ss')";
            }
            BPurchaseOut ogc = new BPurchaseOut();
            var result = ogc.GetPurchaseInMain(page, rows, out total, where);

            Dictionary<string, object> json = new Dictionary<string, object>();
            json.Add("total", total);
            json.Add("rows", result);
            return Json(json, JsonRequestBehavior.AllowGet);
        }
Пример #3
0
 /// <summary> 激活/作废
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void UCPurchasePlanOrderView_InvalidOrActivationEvent(object sender, EventArgs e)
 {
     string strmsg = string.Empty;
     List<SysSQLString> listSql = new List<SysSQLString>();
     SysSQLString sysStringSql = new SysSQLString();
     sysStringSql.cmdType = CommandType.Text;
     Dictionary<string, string> dic = new Dictionary<string, string>();//参数
     dic.Add("purchase_order_yt_id", purchase_order_yt_id);//单据ID
     dic.Add("update_by", GlobalStaticObj.UserID);//修改人Id
     dic.Add("update_name", GlobalStaticObj.UserName);//修改人姓名
     dic.Add("update_time", Common.LocalDateTimeToUtcLong(DateTime.Now).ToString());//修改时间               
     if (orderstatus != Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString())
     {
         strmsg = "作废";
         dic.Add("order_status", Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString());//单据状态编号
         dic.Add("order_status_name", DataSources.GetDescription(DataSources.EnumAuditStatus.Invalid, true));//单据状态名称
     }
     else
     {
         strmsg = "激活";
         string order_status = string.Empty;
         string order_status_name = string.Empty;
         DataTable dvt = DBHelper.GetTable("获得宇通采购订单的前一个状态", "tb_parts_purchase_order_2_BackUp", "order_status,order_status_name", "purchase_order_yt_id='" + purchase_order_yt_id + "'", "", "order by update_time desc");
         if (dvt != null && dvt.Rows.Count > 0)
         {
             DataRow dr = dvt.Rows[0];
             order_status = CommonCtrl.IsNullToString(dr["order_status"]);
             if (order_status == Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString())
             {
                 DataRow dr1 = dvt.Rows[1];
                 order_status = CommonCtrl.IsNullToString(dr1["order_status"]);
                 order_status_name = CommonCtrl.IsNullToString(dr1["order_status_name"]);
             }
         }
         order_status = !string.IsNullOrEmpty(order_status) ? order_status : Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString();
         if (order_status == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString())
         { order_status_name = DataSources.GetDescription(DataSources.EnumAuditStatus.NOTAUDIT, true); }
         else if (order_status == Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString())
         { order_status_name = DataSources.GetDescription(DataSources.EnumAuditStatus.DRAFT, true); }
         dic.Add("order_status", order_status);//单据状态
         dic.Add("order_status_name", order_status_name);//单据状态名称
     }
     sysStringSql.sqlString = "update tb_parts_purchase_order_2 set order_status=@order_status,order_status_name=@order_status_name,update_by=@update_by,update_name=@update_name,update_time=@update_time where purchase_order_yt_id=@purchase_order_yt_id";
     sysStringSql.Param = dic;
     listSql.Add(sysStringSql);
     if (MessageBoxEx.Show("确认要" + strmsg + "吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK)
     {
         return;
     }
     if (DBHelper.BatchExeSQLStringMultiByTrans("更新单据状态为" + strmsg + "", listSql))
     {
         MessageBoxEx.Show("" + strmsg + "成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         uc.BindgvYTPurchaseOrderList();
         deleteMenuByTag(this.Tag.ToString(), uc.Name);
     }
     else
     {
         MessageBoxEx.Show("" + strmsg + "失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #4
0
 public Dictionary<string, string> ToDictionary()
 {
     Dictionary<string, string> dict = new Dictionary<string, string>();
     dict.Add("LayerThickness", layer_thickness.ToString());
     dict.Add("LayerMaterialName", layer_material_name);
     dict.Add("LayerMaterialType", layer_material_type);
     return dict;
 }
Пример #5
0
        public void Add(string remarks)
        {
            Dictionary<string, object> data = new Dictionary<string, object>();

            data.Add("@userid", _userid);
            data.Add("@action", "Created A New Record");
            data.Add("@entrydate", DateTime.Now);
            data.Add("@remarks", remarks);

            SpWithParam("add_audit_trail", data);
        }
		public void Get_ViewModelShouldCollaborate_WithGenresRetriever()
		{
			var testGenres = new Dictionary<string, string>();
			testGenres.Add("genres/123", "aaa");
			testGenres.Add("genres/234", "aaa");
			testGenres.Add("genres/345", "bbb");

			genreRetriever.Stub(r => r.GetAll()).Return(testGenres);

			var result = endpoint.Get(new UpdateBookLinkModel() {Id = "Irrelevant"});

			result.ShouldHaveGenres(testGenres);
		}
Пример #7
0
        public static Dictionary<int, List<Visit>> GetVisitData(string path)
        {
            Dictionary<int, List<Visit>> data = new Dictionary<int, List<Visit>>();
            Random r = new Random();

            foreach (string row in File.ReadLines(path))
            {
                string[] split = row.Split(',');

                if (split.Length > 0)
                {
                    int id = int.Parse(split[0]);
                    Visit visit = new Visit(id, r.Next(1, 10), int.Parse(split[2]), DateTime.Parse(split[1]));

                    if (data.ContainsKey(id))
                    {
                        data[id].Add(visit);
                    }
                    else
                    {
                        data.Add(id, new List<Visit>(){visit});
                    }
                }
            }

            return data;
        }
Пример #8
0
        public IAnswer AskAnswer(IQuestion question)
        {
            var j = 0;

            var choices = new Dictionary<char,IChoice>();
            question.Choices.ForEach(c => choices.Add((char)('a' + j++), c));

            var answerChar = '\0';

            do
            {
                Console.Clear();
                Console.WriteLine("Question: {0}", question.QuestionString);

                foreach (var choice in choices)
                {
                    Console.WriteLine("{0}. {1}", choice.Key, choice.Value.ChoiceText);
                }

                Console.Write("\nAnswer: ");
                var readLine = Console.ReadLine();
                if (readLine == null) continue;

                if (new[] { "back", "b", "oops", "p", "prev" }.Contains(readLine.ToLower()))
                {
                    return question.CreateAnswer(Choice.PREVIOUS_ANSWER);
                }

                answerChar = readLine[0];
            } while (!choices.ContainsKey(answerChar));

            return question.CreateAnswer(choices[answerChar]);
        }
        public async Task<PhotosResponse> GetPhotosAsync(Photoset photoset, User user, Preferences preferences, int page,
                                                         IProgress<ProgressUpdate> progress) {
            var progressUpdate = new ProgressUpdate {
                OperationText = "Getting list of photos...",
                ShowPercent = false
            };
            progress.Report(progressUpdate);

            var methodName = GetPhotosetMethodName(photoset.Type);

            var extraParams = new Dictionary<string, string> {
                {
                    ParameterNames.UserId, user.UserNsId
                }, {
                    ParameterNames.SafeSearch, preferences.SafetyLevel
                }, {
                    ParameterNames.PerPage,
                    preferences.PhotosPerPage.ToString(CultureInfo.InvariantCulture)
                }, {
                    ParameterNames.Page, page.ToString(CultureInfo.InvariantCulture)
                }
            };

            var isAlbum = photoset.Type == PhotosetType.Album;
            if (isAlbum) {
                extraParams.Add(ParameterNames.PhotosetId, photoset.Id);
            }

            var photosResponse = (Dictionary<string, object>)
                await this._oAuthManager.MakeAuthenticatedRequestAsync(methodName, extraParams);

            return photosResponse.GetPhotosResponseFromDictionary(isAlbum);
        }
Пример #10
0
        // sets parameters for insert/update
        private Dictionary<string, object> SetParams(Roles department)
        {
            Dictionary<string, object> result = new Dictionary<string, object>();

            result.Add("@departmentName", department.Name);

            return result;
        }
Пример #11
0
        protected override IReadOnlyDictionary<string, ScimSchema> CreateSchemas()
        {
            var schemas = new Dictionary<string, ScimSchema>();
            foreach (var std in ServerConfiguration.GetSchemaTypeDefinitions(ScimVersion.One))
            {
                var attributeDefinitions = new List<ScimAttributeSchema>();
                foreach (var ad in std.AttributeDefinitions.Values)
                {
                    attributeDefinitions.Add(ad.ToScimAttributeSchema());
                }

                schemas.Add(
                    std.Name,
                    SetResourceVersion(
                        new ScimSchema1(
                            std.Schema + ":" + std.Name, 
                            std.Name, 
                            std.Description, 
                            attributeDefinitions)));

                var rtd = std as IScimResourceTypeDefinition;
                if (rtd != null)
                {
                    foreach (var extension in rtd.SchemaExtensions)
                    {
                        attributeDefinitions = new List<ScimAttributeSchema>();
                        foreach (var ad in extension.ExtensionDefinition.AttributeDefinitions.Values)
                        {
                            attributeDefinitions.Add(ad.ToScimAttributeSchema());
                        }

                        schemas.Add(
                            extension.Schema,
                            SetResourceVersion(
                                new ScimSchema1(
                                    extension.Schema,
                                    extension.ExtensionDefinition.Name,
                                    extension.ExtensionDefinition.Description,
                                    attributeDefinitions)));
                    }
                }
            }

            return schemas;
        }
Пример #12
0
        public static void Initialize()
        {
            VideoMedias = new ObservableCollection<IMedia>();
            AudioMedias = new ObservableCollection<IMedia>();
            ImageMedias = new ObservableCollection<IMedia>();

            loadFolder(Environment.GetFolderPath(Environment.SpecialFolder.CommonPictures));
            loadFolder(Environment.GetFolderPath(Environment.SpecialFolder.CommonMusic));
            loadFolder(Environment.GetFolderPath(Environment.SpecialFolder.CommonVideos));
            loadFolder(Environment.GetFolderPath(Environment.SpecialFolder.MyMusic));
            loadFolder(Environment.GetFolderPath(Environment.SpecialFolder.MyVideos));
            loadFolder(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures));

            all = new Dictionary<Medias, ObservableCollection<IMedia>>();
            all.Add(Medias.VIDEO, VideoMedias);
            all.Add(Medias.AUDIO, AudioMedias);
            all.Add(Medias.IMAGE, ImageMedias);
        }
Пример #13
0
        public ActionResult Index()
        {
            ViewBag.Origem = new Origem().Lista(null);
            ViewBag.Origem.Insert(0, new OrigemModel() { Id = 0, Nome = "" });
            ViewBag.Profissao = new Profissao().Lista(null);
            ViewBag.Profissao.Insert(0, new ProfissaoModel() { Id = 0, Nome = "" });

            Dictionary<int, string> lista = new Dictionary<int, string>();
            lista.Add(0, "");
            lista.Add(1, "Sim");
            lista.Add(2, "Não");
            ViewBag.SimNaoTodos = lista;

            PF pfData = new PF();
            List<PFModel> model = pfData.Filtro50(null, null, null, null, null);

            return View(model);
        }
Пример #14
0
        public static string _host = ".kerlaii.com";//从数据库动态获取

        public void OnActionExecuting(ActionExecutingContext filterContext)
        {
            bool isajax = filterContext.HttpContext.Request.IsAjaxRequest();
            UserPC user = filterContext.HttpContext.Session["user"] as UserPC;

            string host = filterContext.HttpContext.Request.Url.Host;
            string key = host.Replace(_host, "");
            //本地调试,模拟e0001企业  opera
            if (host.ToLower() == "localhost") { key = "e0001"; }

            EnterpriseBll bll = new EnterpriseBll();
            string[] keys = bll.GetAllEnteriseKey();

            
            if (key !="opera" && !keys.Contains(key))
            {
                filterContext.Result = new HttpNotFoundResult();
                return;
                //没有该企业
            }
            filterContext.HttpContext.Session["enterpriseKey"] = key;
            if (check)
            {

                if (user == null)
                {
                    ReturnData<string> ret = new ReturnData<string>();
                    if (isajax)
                    {
                        ret.Status = false;
                        Dictionary<string, object> Identify = new Dictionary<string, object>();
                        Identify.Add("expired", true);
                        ret.Identify = Identify;
                        filterContext.Result = new ContentResult()
                        {
                            Content = ret.GetJson()
                        };
                        return;
                    }
                    //跳转页面
                    filterContext.Result = new ContentResult()
                    {
                        Content = "<script>window.top.location.href ='/';</script>"
                    };
                    return ;

                }
                LogAdapter.Write(user.UserBasic.EnterpriseID+"     "+key, LogAdapter.LogMode.ERROR);
                //当前用户不是当前企业
                if (user.UserBasic.EnterpriseID != key)
                {
                    filterContext.HttpContext.Response.Redirect("/Login");
                }

            }

        }
Пример #15
0
 public Dictionary<string, ChannelAliasModel> GetAliasList()
 {
     var res = new Dictionary<string, ChannelAliasModel>();
     foreach (var item in ItemList)
     {
         var temp = item.GetAlias();
         res.Add(temp.ChannelName, temp);
     }
     return res;
 }
Пример #16
0
        public ClearanceViewModel Fetch(string studentNumber)
        {
            ClearanceViewModel vm = new ClearanceViewModel();
            Dictionary<string, string> departmentList = new Dictionary<string, string>();
            List<Department> departments = dbDeparment.GetAllDepartment.ToList();
            List<Accountability> accountabilities =  dbAccountability.Fetch.Where(a => a.StudentNumber == studentNumber && a.Status == true).ToList();

            vm.Student = dbStudent.GetAllStudent.FirstOrDefault(s => s.StudentNumber == studentNumber);

            int count = accountabilities.Count;

            if (count <= 0)
            {

                foreach (Department item in departments)
                {
                    departmentList.Add(item.Name, "Cleared");
                }

                vm.Clearance = departmentList;
            }
            else
            {
                foreach (Department dept in departments)
                {
                    foreach (Accountability acct in accountabilities)
                    {
                        if (dept.ID == acct.DepartmentID)
                        {
                               departmentList.Add(dept.Name, acct.Description);
                        }
                        else
                        {
                            departmentList.Add(dept.Name, "Cleared");
                        }
                    }
                }
                vm.Clearance = departmentList;
            }

            return vm;
        }
Пример #17
0
        public void loadData(int[] runId, int displayFormat) {

            Dictionary<int, IXPathNavigable> data = new Dictionary<int, IXPathNavigable>();
            if (runId != null && runId.Length > 0) {

                for (int i = 0; i < runId.Length; i++) {
                    data.Add(runId[i], this.assessmentController.GetSimRunData(runId[i]));
                }
                this.loadTableData(data, displayFormat);
            }
        }
Пример #18
0
        public void Process(DirectoryInfo directory, ref Dictionary<string, package> packages)
        {
            foreach (var fileToProcess in directory.GetFiles("*.nuspec", SearchOption.AllDirectories))
            {
                var p = new package();
                new FileProcessor().Process(fileToProcess, ref p);
                packages.Add(fileToProcess.DirectoryName, p);
            }

            new PackageListProcessor().Process(packages);
        }
        public JsonResult QueryDetailData(string sheetid)
        {

            BPurchaseOut ogc = new BPurchaseOut();
            var result = ogc.GetPurchaseInDetail(sheetid);

            Dictionary<string, object> json = new Dictionary<string, object>();
            //json.Add("total", total);
            json.Add("rows", result);
            return Json(json, JsonRequestBehavior.AllowGet);
        }
Пример #20
0
        public static Dictionary<int, Dictionary<string, ClassLine>> GetBalanceSheet()
        {
            //OUTPUT
            Dictionary<int, Dictionary<string, ClassLine>> output = new Dictionary<int, Dictionary<string, ClassLine>>();

            //STABLISH PRIMAVERA COMMUNICATION
            if (!InitializeCompany())
                return output;
            StdBELista balanceSheetQuery = PriEngine.Engine.Consulta("SELECT * FROM AcumuladosContas ORDER BY Ano DESC");

            //COMPLETE OUTPUT
            Dictionary<string, ClassLine> year_balance = new Dictionary<string, ClassLine>();
            int past_year = 0;

            while (!balanceSheetQuery.NoFim())
            {
                ClassLine line = new ClassLine();
                line.ano = balanceSheetQuery.Valor("Ano");

                //CHECK IF IT IS A NEW YEAR TO CREATE A NEW BALANCE
                if (line.ano != past_year && past_year != 0) //in the first case the years are different but we want to continue
                {
                    output.Add(past_year, year_balance);
                    year_balance = new Dictionary<string, ClassLine>();
                }

                processLine(balanceSheetQuery, line);
                if (line.tipoLancamento == "000")
                    year_balance.Add(line.conta.ToString(), line);

                past_year = line.ano;
                balanceSheetQuery.Seguinte();
            }

            //if there are no more lines the cycle will end, so we have to add the data outside
            output.Add(past_year, year_balance);

            return output;
        }
Пример #21
0
			protected override SelectQuery ProcessQuery(SelectQuery selectQuery)
			{
				if (selectQuery.IsInsert && selectQuery.Insert.Into.Name == "Parent")
				{
					var expr =
						new QueryVisitor().Find(selectQuery.Insert, e =>
						{
							if (e.ElementType == QueryElementType.SetExpression)
							{
								var se = (SelectQuery.SetExpression)e;
								return ((SqlField)se.Column).Name == "ParentID";
							}

							return false;
						}) as SelectQuery.SetExpression;

					if (expr != null)
					{
						var value = ConvertTo<int>.From(((IValueContainer)expr.Expression).Value);

						if (value == 555)
						{
							var tableName = "Parent1";
							var dic       = new Dictionary<IQueryElement,IQueryElement>();

							selectQuery = new QueryVisitor().Convert(selectQuery, e =>
							{
								if (e.ElementType == QueryElementType.SqlTable)
								{
									var oldTable = (SqlTable)e;

									if (oldTable.Name == "Parent")
									{
										var newTable = new SqlTable(oldTable) { Name = tableName, PhysicalName = tableName };

										foreach (var field in oldTable.Fields.Values)
											dic.Add(field, newTable.Fields[field.Name]);

										return newTable;
									}
								}

								IQueryElement ex;
								return dic.TryGetValue(e, out ex) ? ex : null;
							});
						}
					}
				}

				return selectQuery;
			}
Пример #22
0
        public Dictionary<Helper.Point, Pokemon> getPokemons()
        {
            var _pokemonsperarea = new Dictionary<Helper.Point, Pokemon>();

            for (int x = _map.AshIndex.x - 4; x < _map.AshIndex.x + 4; x++)
                for (int y = _map.AshIndex.y - 4; y < _map.AshIndex.y + 4; y++)
                {
                    Tile pokemonTile = _map.GetTile(x, y) ;
                    if (pokemonTile != null && pokemonTile.Pokemon != null)
                        _pokemonsperarea.Add(new Helper.Point(x, y), pokemonTile.Pokemon );
                }

            return _pokemonsperarea;
        }
Пример #23
0
        public ActionResult Login(UserPC model, bool isAuto = false)
        {
            ReturnData<string> ret = new ReturnData<string>();
            //Bll实例化放action里面 为了不让每次都实例化 产生废代码
            UserPCBll bll = new UserPCBll();
            //只要找得到记住的密码就去匹配记住的密码
            if (Request.Cookies["remember"] != null)
            {
                if (Request.Cookies["remember"]["uname"] != "" && model.PassWord == "********")
                {
                    model.Status = 99;
                    model.PassWord = Request.Cookies["remember"]["pwd"];
                }
            }
            //ReturnData 是值类型 不需要ref来赋值传递 当传入方法里时返回时还是带有值的
            var user = bll.Login(ret, model, EnterpriseKey);
            if (user != null)
            {
                //登录成功了 才记住用户名和密码
                if (isAuto)
                {
                    Response.Cookies["remember"]["uname"] = user.UserName;
                    Response.Cookies["remember"]["pwd"] = Convert.ToBase64String(YYYCommon.Encryption.SymmetricEncryption.Encrypt(user.PassWord + "\r" + DateTime.Now.ToString()));
                    Response.Cookies["remember"].Expires = DateTime.Now.AddDays(7);

                }
                else
                {
                    Response.Cookies["remember"]["uname"] = "";
                }
                //保存登录信息
                Session["user"] = user;
                //设置跳转路径
                Dictionary<string, object> Identify = new Dictionary<string, object>();

                if (EnterpriseKey.ToLower() == "opera")
                {

                    Identify.Add("url", "/Operate/Areas/Index");
                }
                else
                {
                    //return RedirectToAction("WellCome");
                    Identify.Add("url", "/Login/Welcome");
                }
                ret.Identify = Identify;
            }
            return Content(ret.GetJson());
        }
Пример #24
0
        public string RetrieveConfirmationCode(string studentNumber)
        {
            Dictionary<string, object> result = new Dictionary<string, object>();

            result.Add("@studentNo", studentNumber);
            string code = StoredProc("get_code", result);
            if (code != "")
            {
                return code;
            }
            else
            {
                ExecuteNonQuery(QueryBuilder.Insert("tblconfirmation", TargetFields), SetParams(studentNumber));
                return StoredProc("get_code", result);
            }
        }
        public SuggestedMoves GetPath(Color[,] board)
        {
            //Get the farthest nodes
            TreeNode head = MapBuilder.BuildTree(board);
            ISet<TreeNode> farthestNodes = new HashSet<TreeNode>();
            int highestDepth = 0;
            foreach (TreeNode node in head.BFS()) //DFS would be better
            {
                int depth = GetDepth(node);
                if (depth > highestDepth)
                {
                    highestDepth = depth;
                    farthestNodes.Clear();
                    farthestNodes.Add(node);
                }
                else if (depth == highestDepth)
                {
                    farthestNodes.Add(node);
                }
            }

            Console.Write("Farthest nodes are ");
            farthestNodes.Select(n => n.Color).ToList().ForEach(c => Console.Write(c + ", "));
            Console.WriteLine("\r\nFarthest node is " + GetDepth(farthestNodes.First()) + " away from the current");

            //get the color that would step towards each color
            IDictionary<Color, int> tally = new Dictionary<Color, int>();
            foreach (TreeNode farthestNode in farthestNodes)
            {
                TreeNode currentNode = farthestNode;
                while (currentNode.Parent != head)
                {
                    currentNode = currentNode.Parent;
                }
                if (!tally.ContainsKey(currentNode.Color))
                {
                    tally.Add(currentNode.Color, 1);
                }
                else
                {
                    tally[currentNode.Color]++;
                }
            }
            SuggestedMoves suggestedMoves = new SuggestedMoves();
            suggestedMoves.AddFirst(new SuggestedMove(tally.OrderByDescending(kvp => kvp.Value).Select(n => n.Key)));
            return suggestedMoves;
        }
Пример #26
0
        public static void InsertRecEntity(string guid,IssueRecEntity entity)
        {
            if (recEntity.Count == 0)
            {
                Init(capacity);
            }
            Dictionary<string, IssueRecEntity> dict = new Dictionary<string, IssueRecEntity>();
            dict.Add(guid,entity);

            recEntity[looper] = dict;

            looper += 1;
            if (looper > capacity - 1)
            {
                looper = 0;
            }
        }
Пример #27
0
        public string SavePath(HttpPostedFileBase file)
        {
            Dictionary<string, string> dic = new Dictionary<string, string>();
            dic.Add("渠道ID", "Id");
            dic.Add("渠道类型(必填)", "Type");
            dic.Add("渠道或者门店名称(必填)", "Name");
            dic.Add("所属代理商(必填)", "AgentID");
            dic.Add("所属省(必填)", "ProvinceID");
            dic.Add("所属市(必填)", "CityID");
            dic.Add("所属区/县(必填)", "CountryID");
            dic.Add("联系人(必填)", "Contact");
            dic.Add("注册手机号码(必填)", "Tel");
            DataTable dt = file.GetDataTable(dic);
            DataTable newDt = new ShopInfoBll().InsertShopInfoFromExcel(LoginUser.UserBasic.EnterpriseID, dt);

            long timer = DateTime.Now.Ticks;
            if (dt.Rows.Count > 0)
            {
                Session["loadFile"] = newDt;
                return new { status = false }.GetJson();
            }
            return new { status = true }.GetJson();
        }
Пример #28
0
        public MainViewModel()
        {
            // please adjust this to meet your system layout ...
            // obviously this should be changed to load file dialog usage :)
            try
            {
                _movies = DataLoader.ReadItemLabels("u.item");
                _trainData = DataLoader.ReadTrainingData("u.data");
            }
            catch (Exception)
            {
                MessageBox.Show("Error loading data files! Please check ViewModel.cs for file location!", "Error loading files", MessageBoxButton.OK, MessageBoxImage.Error);
                Application.Current.Shutdown();
            }

            Movies = new ObservableCollection<Movie>(_movies.OrderBy(m=>m.Title));
            NewRank = 1;
            RaisePropertyChanged(() => NewRank);
            SelectedMovie = Movies.First();
            RaisePropertyChanged(() => SelectedMovie);

            Ranking = new Dictionary<int, int>();
            AddRankCommand = new RelayCommand(() => {
                if (!Ranking.ContainsKey(SelectedMovie.Id)) {
                    Log += string.Format("{0} - rank: {1}\n", SelectedMovie, NewRank);
                    RaisePropertyChanged(() => Log);
                    Ranking.Add(SelectedMovie.Id, NewRank);
                    Movies.Remove(SelectedMovie);
                    SelectedMovie = Movies.First();
                    RaisePropertyChanged(() => SelectedMovie);
                }
                var rec = Engine.GetRecommendations(_movies, Ranking, _trainData);
                var foo = rec.OrderByDescending(e => e.Rank);//.Where(e => !Ranking.ContainsKey(e.Id));
                Recomendations =new ObservableCollection<Movie>(foo);
                this.RaisePropertyChanged(() => Recomendations);
            });
        }
Пример #29
0
 /// <summary>
 /// 添加sql语句 -图片
 /// </summary>
 /// <param name="listSql">listSql</param>
 /// <param name="partID">用户id</param>
 /// <param name="path">图片id</param>
 /// <returns></returns>
 private List<SQLObj> AddPhoto(List<SQLObj> listSql, string partID, string path)
 {
     if (path != string.Empty)
     {
         SQLObj sqlObj = new SQLObj();
         sqlObj.cmdType = CommandType.Text;
         Dictionary<string, ParamObj> dic = new Dictionary<string, ParamObj>();
         dic.Add("att_path", new ParamObj("att_path", path, SysDbType.VarChar, 40));
         sqlObj.Param = dic;
         if (photoID.Length == 0)
         {
             dic.Add("att_name", new ParamObj("att_name", "用户图片", SysDbType.NVarChar, 15));
             dic.Add("att_type", new ParamObj("att_type", "图片", SysDbType.NVarChar, 15));
             photoID = Guid.NewGuid().ToString();
             dic.Add("is_main", new ParamObj("is_main", (int)DataSources.EnumYesNo.Yes, SysDbType.VarChar, 5));
             dic.Add("relation_object", new ParamObj("relation_object", "tb_parts", SysDbType.NVarChar, 30));
             dic.Add("relation_object_id", new ParamObj("relation_object_id", partID, SysDbType.VarChar, 40));
             dic.Add("enable_flag", new ParamObj("enable_flag", (int)DataSources.EnumEnableFlag.USING, SysDbType.VarChar, 5));
             dic.Add("create_by", new ParamObj("create_by", GlobalStaticObj.UserID, SysDbType.NVarChar, 40));
             dic.Add("create_time", new ParamObj("create_time", DateTime.UtcNow.Ticks, SysDbType.BigInt));
             sqlObj.sqlString = @"insert into [attachment_info] ([att_id],[att_name],[att_type],[att_path],[relation_object],[relation_object_id],[enable_flag],[create_by],[create_time],[is_main])
                     values (@att_id,@att_name,@att_type,@att_path,@relation_object,@relation_object_id,@enable_flag,@create_by,@create_time,@is_main);";
         }
         else
         {
             dic.Add("update_by", new ParamObj("update_by", GlobalStaticObj.UserID, SysDbType.NVarChar, 40));
             dic.Add("update_time", new ParamObj("update_time", DateTime.UtcNow.Ticks, SysDbType.BigInt));
             sqlObj.sqlString = "update [attachment_info] set [att_path]=@att_path,[update_by]=@update_by,[update_time]=@update_time where [att_id]=@att_id;";
         }
         dic.Add("att_id", new ParamObj("att_id", photoID, SysDbType.VarChar, 40));
         listSql.Add(sqlObj);
     }
     return listSql;
 }
Пример #30
0
        /// <summary>
        /// 保存
        /// </summary>
        void UCPersonnelAddOrEdit_SaveEvent(object sender, EventArgs e)
        {
            string msg = string.Empty;
            bool bln = Validator(ref msg);
            if (!bln)
            {
                return;
            }

            string newGuid = string.Empty;
            string currUser_id = "";

            string keyName = string.Empty;
            string keyValue = string.Empty;
            string opName = "新增人员信息";
            Dictionary<string, string> dicFileds = new Dictionary<string, string>();

            dicFileds.Add("user_name", txtuser_name.Caption.Trim());//人员姓名
            //账号
            if (cbois_operator.SelectedValue.ToString() == DataSources.EnumYesNo.Yes.ToString("d"))
            {
                dicFileds.Add("land_name", txtland_name.Caption.Trim());
            }
            else
            {
                dicFileds.Add("land_name", "");
            }

            dicFileds.Add("user_phone", txtuser_phone.Caption.Trim());//手机
            dicFileds.Add("user_telephone", txtuser_telephone.Caption.Trim());//固话    
            dicFileds.Add("org_id", txcorg_name.Tag.ToString().Trim());//组织id 
            dicFileds.Add("sex", cbosex.SelectedValue.ToString());//性别
            dicFileds.Add("user_fax", txtuser_fax.Caption.Trim());//传真 
            dicFileds.Add("is_operator", cbois_operator.SelectedValue.ToString());//是否操作员 
            dicFileds.Add("idcard_type", cboidcard_type.SelectedValue.ToString());//证件类型 
            dicFileds.Add("user_email", txtuser_email.Caption.Trim());//邮箱 
            dicFileds.Add("idcard_num", txtidcard_num.Caption.Trim());//证件号码 
            dicFileds.Add("user_address", txtuser_address.Caption.Trim());//联系地址
            dicFileds.Add("remark", txtremark.Caption.Trim());//备注 
            //密码
            if (cbois_operator.SelectedValue.ToString() == DataSources.EnumYesNo.Yes.ToString("d"))
            {
                dicFileds.Add("password", txtPassWord.Caption.Trim());
            }
            else
            {
                dicFileds.Add("password", "");//密码
            }

            dicFileds.Add("nation", cbonation.SelectedValue.ToString());//民族 
            dicFileds.Add("graduate_institutions", txtgraduate_institutions.Caption.Trim());//毕业学校 
            dicFileds.Add("technical_expertise", txttechnical_expertise.Caption.Trim());//技术特长 
            dicFileds.Add("user_height", txtuser_height.Caption.Trim());//身高 
            dicFileds.Add("native_place", txtnative_place.Caption.Trim());//籍贯 
            dicFileds.Add("specialty", txtspecialty.Caption.Trim());//专业
            dicFileds.Add("entry_date", Common.LocalDateTimeToUtcLong(dtpentry_date.Value).ToString());//  入职日期 
            dicFileds.Add("user_weight", txtuser_weight.Caption.Trim());//体重 
            dicFileds.Add("register_address", txtregister_address.Caption.Trim());//户籍所在地 
            dicFileds.Add("graduate_date", Common.LocalDateTimeToUtcLong(dtpgraduate_date.Value).ToString());// 毕业时间 
            dicFileds.Add("wage", txtwage.Caption.Trim());// 工资 
            dicFileds.Add("birthday", Common.LocalDateTimeToUtcLong(dtpbirthday.Value).ToString());// 出生日期  
            dicFileds.Add("education", cboeducation.SelectedValue.ToString());//学历
            dicFileds.Add("position", cboposition.SelectedValue.ToString());//岗位
            dicFileds.Add("political_status", txtpolitical_status.Caption.Trim());//政治面貌
            dicFileds.Add("level", cbolevel.SelectedValue.ToString());//级别



            dicFileds.Add("health", cbojkzk.SelectedValue.ToString());//健康状况

            string nowUtcTicks = Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString();
            dicFileds.Add("update_by", HXCPcClient.GlobalStaticObj.UserID);
            dicFileds.Add("update_time", nowUtcTicks);

            string crmId = string.Empty;

            if (wStatus == WindowStatus.Add || wStatus == WindowStatus.Copy)
            {
                dicFileds.Add("user_code", CommonUtility.GetNewNo(SYSModel.DataSources.EnumProjectType.User));//人员编码               

                newGuid = Guid.NewGuid().ToString();
                currUser_id = newGuid;
                dicFileds.Add("user_id", newGuid);//新ID                   
                dicFileds.Add("create_by", HXCPcClient.GlobalStaticObj.UserID);
                dicFileds.Add("create_time", nowUtcTicks);
                dicFileds.Add("enable_flag", SYSModel.DataSources.EnumEnableFlag.USING.ToString("d"));//1为未删除状态
                dicFileds.Add("status", SYSModel.DataSources.EnumStatus.Start.ToString("d"));//启用
                dicFileds.Add("data_sources", Convert.ToInt16(SYSModel.DataSources.EnumDataSources.SELFBUILD).ToString());//来源 自建
            }
            else if (wStatus == WindowStatus.Edit)
            {
                keyName = "user_id";
                keyValue = id;
                currUser_id = id;
                newGuid = id;
                crmId = dr["cont_crm_guid"].ToString();
                opName = "更新人员管理";
            }
            bln = DBHelper.Submit_AddOrEdit(opName, "sys_user", keyName, keyValue, dicFileds);

            string photo = string.Empty;
            if (picuser.Tag != null)
            {
                photo = Guid.NewGuid().ToString() + Path.GetExtension(picuser.Tag.ToString());
                if (!FileOperation.UploadFile(picuser.Tag.ToString(), photo))
                {
                    return;
                }
            }

            List<SQLObj> listSql = new List<SQLObj>();
            listSql = AddPhoto(listSql, currUser_id, photo);
            ucAttr.TableName = "sys_user";
            ucAttr.TableNameKeyValue = currUser_id;
            listSql.AddRange(ucAttr.AttachmentSql);
            DBHelper.BatchExeSQLMultiByTrans(opName, listSql);
            if (bln)
            {
                if (wStatus == WindowStatus.Add || wStatus == WindowStatus.Edit)
                {
                    var cont = new tb_contacts_ex
                           {
                               cont_id = CommonCtrl.IsNullToString(newGuid),//id
                               cont_name = CommonCtrl.IsNullToString(this.txtuser_name.Caption.Trim()),//name
                               cont_post = CommonCtrl.IsNullToString(""),//post
                               cont_phone = CommonCtrl.IsNullToString(this.txtuser_phone.Caption.Trim()),
                               nation = CommonCtrl.IsNullToString(this.cbonation.SelectedValue.ToString()),
                               parent_customer = CommonCtrl.IsNullToString(""),
                               sex = UpSex(),
                               status = CommonCtrl.IsNullToString(SYSModel.DataSources.EnumStatus.Start.ToString("d")),
                               cont_post_remark = CommonCtrl.IsNullToString(""),
                               cont_crm_guid = CommonCtrl.IsNullToString(crmId),
                               contact_type = "02"
                           };
                    Update.BeginInvoke("上传服务站工作人员", SYSModel.EnumWebServFunName.UpLoadCcontact, cont, null, null);

                    //DBHelper.WebServHandlerByFun("上传服务站工作人员", SYSModel.EnumWebServFunName.UpLoadCcontact, cont);
                }

                if (this.RefreshDataStart != null)
                {
                    this.RefreshDataStart();
                }

                LocalCache._Update(CacheList.User);

                MessageBoxEx.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);

                deleteMenuByTag(this.Tag.ToString(), this.parentName);
            }
            else
            {
                MessageBoxEx.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }