Esempio n. 1
0
 /// <summary>
 /// 查询考试综合统计结果
 /// </summary>
 /// <returns></returns>
 public Dictionary<string,string>GetScoreInfo(string classId)
 {
     string sql = "";
     if (classId == null || classId.Length == 0)//统计全校
     {
         sql = "select stuCount=count(*),avgCsharp=avg(Csharp),avgDB=avg(SQLServerDB) from ScoreList;";
         sql += "select absentCount=count(*) from Students where StudentId not in(select StudentId from ScoreList)";
     }
     else//按照班级统计
     {
         sql = "select stuCount=count(*),avgCsharp=avg(Csharp),avgDB=avg(SQLServerDB) from ScoreList";
         sql+= " inner join Students on Students.StudentId=ScoreList.StudentId where ClassId={0};";
         sql += "select absentCount=count(*) from Students where StudentId not in(select StudentId from ScoreList) and ClassId={1}";
         sql = string.Format(sql, classId, classId);
     }
     SqlDataReader objReader = SQLHelper.GetReader(sql);
     Dictionary<string, string> scoreInfo = null;
     if(objReader.Read())
     {
         scoreInfo = new Dictionary<string, string>();
         scoreInfo.Add("stuCount", objReader["stuCount"].ToString());
         scoreInfo.Add("avgCsharp", objReader["avgCsharp"].ToString());
         scoreInfo.Add("avgDB", objReader["avgDB"].ToString());
     }
     if(objReader.NextResult())
     {
         if (objReader.Read())
         {
             scoreInfo.Add("absentCount", objReader["absentCount"].ToString());
         }
     }
     objReader.Close();
     return scoreInfo;
 }
        protected void lbtn_ToExecl_Click(object sender, EventArgs e)
        {
            int company = logic.customer.companyId;
            string startDt = hid_startDt.Value;
            string endDt = hid_endDt.Value;
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("sellerId={0} ", company);
            sb.AppendFormat(" and datediff(day,[updateStatusdt],'{0}')<=0", startDt);
            sb.AppendFormat(" and datediff(day,[updateStatusdt],'{0}')>=0", endDt);

            DataSet ds = logic.orderItem.listwithPayables(sb.ToString());// logic.orderItem.listwithReceivables(sb.ToString());
            DataTable dt = ds.Tables[0];
            dt.Columns["proName"].ColumnName = "商品";
            dt.Columns["quantity"].ColumnName = "数量";
            dt.Columns["sellerprice"].ColumnName = "单价";
            dt.Columns["unit"].ColumnName = "单位";
            dt.Columns["sellerAmount"].ColumnName = "小计";
            dt.Columns["orderNo"].ColumnName = "订单号";
            dt.Columns["statusName"].ColumnName = "订单状态";
            dt.Columns["updateStatusdt"].ColumnName = "成功日期";
            dt.Columns["rbNo"].ColumnName = "供货单号";

            String xlsName = Convert.ToDateTime(startDt).ToShortDateString() + "至" + Convert.ToDateTime(endDt).ToShortDateString() + "的应收款";

            ExportFacade exportHelper = new ExportFacade();

            Dictionary<int, FormatStyle> formatOptions = new Dictionary<int, FormatStyle>();
            formatOptions.Add(1, FormatStyle.ToFix2);
            formatOptions.Add(2, FormatStyle.ToFix2);
            formatOptions.Add(4, FormatStyle.ToFix2);

            exportHelper.ExportByWeb(dt, xlsName, xlsName + ".xls", formatOptions, xlsName);
        }
        /// <summary>
        /// Creates generic local connection
        /// </summary>
        public ConnectionString()
        {
            _Name           = "SQLConnection";
                _Parameters     = new Dictionary<string, string>();

                _Parameters.Add("Data Source", "LocalHost");
                _Parameters.Add("Initial Catalog", "Master");
        }
 public static Dictionary<string, string> fillUserInfo(string _userName)
 {
     Dictionary<string, string> userInfo = new Dictionary<string, string>();
     SQLString = "select * from " + userInfoSafeView + " where " + userName + " = '" + _userName + "'";
     DataTable dt = DbHelperSQL.ExecQueryTable(SQLString);
     userInfo.Add(userName, dt.Rows[0][userName].ToString());
     userInfo.Add(level, dt.Rows[0][level].ToString());
     userInfo.Add(supermarketID, dt.Rows[0][supermarketID].ToString());
     return userInfo;
 }
Esempio n. 5
0
 /// <summary>
 /// 获取表的所有字段名及字段类型
 /// </summary>
 public List<Dictionary<string, string>> GetAllColumns(string tableName)
 {
     SQLiteHelper sqliteHelper = new SQLiteHelper();
     DataTable dt = sqliteHelper.Query("PRAGMA table_info('" + tableName + "')");
     List<Dictionary<string, string>> result = new List<Dictionary<string, string>>();
     foreach (DataRow dr in dt.Rows)
     {
         Dictionary<string, string> dic = new Dictionary<string, string>();
         dic.Add("name", dr["name"].ToString());
         dic.Add("notnull", dr["notnull"].ToString());
         result.Add(dic);
     }
     return result;
 }
Esempio n. 6
0
 //根据实例Id获取表单实例
 public FormViewModel GetFormInstanceById(int InstanceId)
 {
     FormViewModel formInstance = new FormViewModel();
     Dictionary<string, object> dsDic = new Dictionary<string, object>();
     dsDic.Add("i_InstanceId", InstanceId);
     using (BaseDB db = new RedasDBHelper())
     {
         try
         {
             IList<FormViewModel> InstanceList = db.ExecuteListProc<FormViewModel>("pkg_Test.sp_get_instanceform", dsDic);
             if (InstanceList != null && InstanceList.Count > 0)
             {
                 formInstance = InstanceList[0];
                formInstance.LABLELIST = JsonTools.JsonToObject2<DFormViewModel>(formInstance.CONTENTS).FormLabels
                     .Where(l => l.IsSelected == true)
                     .OrderBy(d => d.DEFAULT_ORDER).ThenBy(d => d.SORT).ToList();
             }
         }
         catch
         {
             formInstance = new FormViewModel();
         }
     }
     return formInstance;
 }
Esempio n. 7
0
        public List<Show> Load()
        {
            var showDictionary = new Dictionary<string, Show>();
            Dictionary<string, Show> pageShows;
            int pageNumber = 0;
            do
            {
                pageShows = LoadPage(GetPageUrlByNumber(pageNumber));
                foreach (var show in pageShows)
                {
                    if (showDictionary.ContainsKey(show.Key))
                    {
                        // Remove duplicates from series list
                        var episodes = show.Value.Episodes.Except(showDictionary[show.Key].Episodes);
                        foreach (var episode in episodes)
                        {
                            showDictionary[show.Key].Episodes.Add(episode);
                        }
                    }
                    else
                    {
                        showDictionary.Add(show.Key, show.Value);
                    }
                }

                pageNumber++;
            }
            while (pageShows.Count != 0);

            var result = showDictionary.Values.ToList();
            UpdateLastLoadedEpisodeId(result);
            return result;
        }
Esempio n. 8
0
        public BindingList<CourseList>ListAssignedCoursesByUser(int staff_id)
        {
            List<staff_assigned_course> list = new List<staff_assigned_course>();
            BindingList<CourseList> blist = new BindingList<CourseList>();
            list = ListOfAssignedCoursesByUser(staff_id);

            int i = 1;

            Dictionary<int, CourseList> map = new Dictionary<int, CourseList>();
            foreach (staff_assigned_course sac in list)
            {
                CourseList cl = new CourseList();
                int _trainer_id = 0;
                staff s = new staff();

                _trainer_id = int.Parse(sac.assigned_course.course.trainer_id.ToString());
                s = GetStaffById(_trainer_id);

                cl.TrainingModule = sac.assigned_course.course.name;
                cl.InternalTrainerName = string.Concat(s.first_name.ToString(), " ", s.last_name.ToString());
                cl.CourseType = sac.assigned_course.course.course_type.name;
                cl.CompletionStatus = sac.completion_status.name;
                cl.CompletionDate = DateTime.Parse(sac.assigned_course.end_date.ToString());

                map.Add(i, cl);
                i += 1;
            }

            foreach (KeyValuePair<int, CourseList> m in map)
            {
                blist.Add(m.Value);
            }

            return blist;
        }
Esempio n. 9
0
        public static bool AddProfile(String UserName, String FirstName, String LastName)
        {
            //adds a new user profile to the database
            if (GetUserNames().Contains(UserName))
                return false;

            SQLiteDatabase db = new SQLiteDatabase();
            Dictionary<String, String> data = new Dictionary<string, string>();

            data.Add("UserName", UserName);
            data.Add("FirstName", FirstName);
            data.Add("LastName", LastName);
            data.Add("TrainingProgress", "A");

            db.Insert("User", data);
            return true;
        }
        protected void lbn_Import_Click(object sender, EventArgs e)
        {
            DataSet ds = orderItemByWhere();
            DataTable dt=ds.Tables[0];
            dt.Columns["proName"].ColumnName = "商品";
            dt.Columns["quantity"].ColumnName = "数量";
            dt.Columns["price"].ColumnName = "单价";
            dt.Columns["unit"].ColumnName = "单位";
            dt.Columns["amount"].ColumnName = "小计";
            dt.Columns["orderNo"].ColumnName = "订单号";
            dt.Columns["statusName"].ColumnName = "订单状态";
            dt.Columns["updateStatusdt"].ColumnName = "成功日期";
            dt.Columns["receiveDt"].ColumnName = "收获日期";

            ExportFacade facade = new ExportFacade();
            Dictionary<int,FormatStyle> formatOptions=new Dictionary<int,FormatStyle>();
            formatOptions.Add(1, FormatStyle.ToFix2);
            formatOptions.Add(2, FormatStyle.ToFix2);
            formatOptions.Add(4, FormatStyle.ToFix2);
            facade.ExportByWeb(dt, "订单数据", "订单数据.xls", formatOptions, "订单数据");
        }
Esempio n. 11
0
 //根据登录帐号获取用户信息
 public UserDTO GetUserByLoginId(string loginId)
 {
     using (BaseDB db = new OmpdDBHelper())
        {
        UserDTO user=new UserDTO();
        Dictionary<string, object> dic = new Dictionary<string, object>();
        dic.Add("i_LOGIN_ID", loginId);
        var userDtos = db.ExecuteListProc<UserDTO>("pkg_user.sp_user_get", dic);
        if (userDtos != null && userDtos.Count > 0)
            user = userDtos[0];
        return user;
        }
 }
Esempio n. 12
0
        public List<SurveryDataModel> ExportSurveryData()
        {
            using (var db = new RedasDBHelper())
            {
                var dic = new Dictionary<string, object>();

                dic.Add("cur_result", null);

                var field = new RedasDbFieldDTO();
                IList<SurveryDataModel> fieldList = db.ExecuteListProc<SurveryDataModel>("pkg_Test.sp_SurveryData_get", dic);

                return fieldList.ToList();
            }
        }
Esempio n. 13
0
 public IList<RedasDbFieldDTO> GetDbField(int tableId)
 {
     using (EGJDBHelper db = new EGJDBHelper())
     {
         var dic = new Dictionary<string, object>();
         dic["i_table_id"] = tableId;
         dic.Add("cur_result", null);
         IList<RedasDbFieldDTO> fields = db.ExecuteListProc<RedasDbFieldDTO>("pkg_city_config.sp_get_db_field", dic);
         if (fields != null && fields.Count > 0)
         {
             return fields;
         }
         return null;
     }
 }
Esempio n. 14
0
        public static Dictionary<int, string> getCountries()
        {
            con.Open();
               Dictionary<int, string> countries = new Dictionary<int, string>();

               SqlCommand countryCommand = new SqlCommand("Select * from Ölkeler", con);

               SqlDataReader countryReader = null;
               countryReader = countryCommand.ExecuteReader();

               while (countryReader.Read())
               {
             countries.Add(Convert.ToInt32(countryReader["id"]), countryReader["name"].ToString());
               }
               con.Close();
               return countries;
        }
Esempio n. 15
0
        public static string getJSONData(DataTable dt)
        {

             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);

        }
Esempio n. 16
0
        public Dictionary<int, string> GetSysCodeValues(int CodeType)
        {
            Dictionary<int, string> items = new Dictionary<int, string>();
            using (dbhCodeManager = new DBHelper(ConnectionStrings.DefaultDBConnection))
            {
                dbhCodeManager.AddParameter("@CODE_TYPE_ID_REF", CodeType);
                dbhCodeManager.AddParameter("@CurrentUserID", mCurrentUserID);

                IDataReader reader = dbhCodeManager.ExecuteReader("GET_SYS_CODE_VALUES");
                while (reader.Read())
                {
                    items.Add(Int32.Parse(reader[0].ToString()), reader[1].ToString());
                }

                dbhCodeManager.Dispose();
            }
            return items;
        }
Esempio n. 17
0
        public static void AddSign(SignInfo sign)
        {
            //adds a users calibrated sign data to the database
            SQLiteDatabase db = new SQLiteDatabase();
            Dictionary<String,String> data = new Dictionary<string,string>();

            data.Add("Letter", sign.Letter.ToString());
            data.Add("UserName", sign.UserName);
            data.Add("Area", sign.Area.ToString());
            data.Add("AreaPercentage", sign.Percentage.ToString());
            data.Add("ClosestPoint", sign.ClosestPoint.ToString());
            data.Add("NumFingers", sign.NumFingers.ToString());

            db.Insert("Sign",data);
        }
Esempio n. 18
0
        public List<Show> Load()
        {
            bool stop;
            Dictionary<string, Show> showDictionary = new Dictionary<string, Show>();

            int pageNumber = 0;
            do
            {
                Dictionary<string, Show> shows;
                stop = LoadPage(GetPageUrlByNumber(pageNumber), out shows);

                foreach (var show in shows)
                {
                    if (showDictionary.ContainsKey(show.Key))
                    {
                        //Remove duplicates from series list
                        var seriesList = show.Value.Episodes.Except(showDictionary[show.Key].Episodes);
                        showDictionary[show.Key].Episodes.AddRange(seriesList);
                    }
                    else
                    {
                        showDictionary.Add(show.Key, show.Value);
                    }
                }
                pageNumber++;
            } while (!stop);

            List<Show> result = showDictionary.Select(s => s.Value).ToList();
            if (result.Count != 0)
            {
                LastId = result.Aggregate(
                    new List<Episode>(),
                    (list, show) =>
                    {
                        list.AddRange(show.Episodes);
                        return list;
                    }
                    ).OrderByDescending(s => s.SiteId).First().SiteId;
            }
            return result;
        }
Esempio n. 19
0
        /// <summary>
        /// WX_CommodityInfo表分页查询
        /// </summary>
        /// <param name="page"></param>
        /// <param name="size"></param>
        /// <param name="moduleID"></param>
        /// <returns></returns>
        public IEnumerable<dynamic> CommodityInfoQueryByPage(int page, int size, string moduleID)
        {
            //Order By
            Dictionary<string, string> dicOrder = new Dictionary<string, string>();
            dicOrder.Add("iOrder", "DESC");

            //param
            object par = null;

            //Where
            List<string> listWhere = new List<string>();
            listWhere.Add(" Flag=@Flag ");

            if (!string.IsNullOrEmpty(moduleID)) { listWhere.Add(" MID=@MID "); par = new { Flag = 1, MID = int.Parse(moduleID) }; }
            else { par = new { Flag = 1 }; }

            string strWhere = string.Join("AND", listWhere);

            //Result
            return shopCommodityDal.QueryByPage(page, size, strWhere, par, dicOrder);
        }
Esempio n. 20
0
        public static Dictionary<string, CityCountryId> getCities()
        {
            con.Open();

               Dictionary<string, CityCountryId> cities = new Dictionary<string, CityCountryId>();

               SqlCommand sc = new SqlCommand("Select * from Seherler", con);

               SqlDataReader cityReader = null;
               cityReader = sc.ExecuteReader();

               while (cityReader.Read())
               {
             CityCountryId cityCountry = new CityCountryId();
             cityCountry.CityId = Convert.ToInt32(cityReader["id"]);
             cityCountry.CountryId = Convert.ToInt32(cityReader["olkeId"]);

             cities.Add(cityReader["name"].ToString(), cityCountry);
               }
               con.Close();
               return cities;
        }
Esempio n. 21
0
    protected void btnsubmit_Click(object sender, EventArgs e)
    {

        using (OnlineExamDataContext obj1 = new OnlineExamDataContext())
        {
            var number = OnlineExamHelper.Context.OnlineRegistrations.Where(a => a.Name == Convert.ToString(txtname.Text) && a.Mobile == Convert.ToInt64(txtmobile.Text)).Select(a => a.UserId);
            if (number.Count() >= 1)
            {
                lbregister.Text = "Already exists";
            }
            else
            {
                RegistrationBL obj = new RegistrationBL(txtname.Text, Convert.ToInt64(txtmobile.Text), txtemail.Text, DateTime.Now);
                if (obj.Insert())
                {
                    Session["cadidatename"] = obj.Name;
                    Session["cadidate"] = obj.UserId;
                    Session["admin"] = null;
                    var dd = OnlineExamHelper.Context.OnlineAssignDetails.Select(a => a);
                    foreach (var item in dd)
                    {
                        Session["TimeLeft"] = item.TimeLeft;
                        Session["timeDuration"] = item.TimeDuration;
                        var ss = OnlineExamHelper.Context.OnlineCateCounts.Where(a => a.FK_AsDeID.Value == item.Id);
                        Dictionary<long, int> dic = new Dictionary<long, int>();
                        foreach (var item1 in ss)
                        {
                            dic.Add(item1.FK_CateId.Value, item1.Count.Value);
                        }
                        Session["cat"] = dic;
                    }

                    Response.Redirect("Instruction.aspx");
                }
            }
        }

    }
Esempio n. 22
0
        /// <summary>
        /// 查询可展示商品列表
        /// </summary>
        /// <returns></returns>
        public object Main_QueryCommodity(string moduleID)
        {
            string type = string.IsNullOrEmpty(moduleID) ? "All" : "List";

            //Result Data
            object list = null;

            switch (type)
            {
                case "All":
                    list = shopCommodityDal.Query(string.Format("Flag=@Flag Order by iOrder"), new { Flag = 1 });
                    break;

                case "List":
                    Dictionary<string, string> dicOrder = new Dictionary<string, string>();
                    dicOrder.Add("iOrder", "DESC");

                    list = shopCommodityDal.QueryByPage(1, 10, "Flag=@Flag AND MID=@MID", new { Flag = 1, MID = int.Parse(moduleID) }, dicOrder);
                    break;
            }

            return list;
        }
Esempio n. 23
0
        protected override Dictionary<string, Show> LoadPage(string url)
        {
            var doc = DownloadDocument(url).Result;
            string[] showTitles;
            string[] episodesTitles;
            string[] episodesIds;
            Tuple<int, int>[] episodesNumbers;
            bool success = GetEpiodesData(doc, out showTitles, out episodesTitles, out episodesIds, out episodesNumbers);
            if (!success)
            {
                throw new ArgumentException("Invalid web page", nameof(doc));
            }

            var dateList = doc.DocumentNode.SelectNodes(@"//div[@class='mid']//div[@class='content_body']").First()?.InnerHtml;
            var dates = dateList != null ? DateRegex.Matches(dateList).Cast<Match>().Select(m => m.Groups[1].Value).ToArray() : null;
            var showDictionary = new Dictionary<string, Show>();
            for (int i = 0; i < showTitles.Length; i++)
            {
                var episode = CreateEpisode(episodesIds[i], episodesTitles[i], dates?[i], episodesNumbers[i]);
                if (episode == null)
                {
                    break;
                }

                if (!showDictionary.ContainsKey(showTitles[i]))
                {
                    showDictionary.Add(showTitles[i], new Show { Title = showTitles[i], SiteTypeId = ShowsSiteType.Id });
                }

                showDictionary[showTitles[i]].Episodes.Add(episode);
            }

            return showDictionary;
        }
Esempio n. 24
0
        public List<Dictionary<string, object>> GetControllersWithPermInfo(int id)
        {
            var controllerDal = new ControllerDAL();
            var controllers = controllerDal.Query(o => !o.ForAll, new List<SortCol> {new SortCol {ColName = "Id", IsDescending = false}},
                                new List<string> {"Actions"});

            var role = RoleDal.GetById(id, new List<string> {"Previleges"});
            var perms = role.Previleges.Where(o => !o.IsDeleted).ToList();

            var result = new List<Dictionary<string, object>>();
            int i = 1;
            foreach (var cdto in controllers)
            {
                var cdtoDic = new Dictionary<string, object>
                                  {
                                      {"internalId", cdto.Id},
                                      {"id", i ++},
                                      {"name", cdto.ChineseName},
                                      {"internalName", cdto.Name},
                                      {"description", cdto.Description},
                                      {"isOpenForAll", cdto.ForAll ? "是" : "否"},
                                      {"type", "Controller"},
                                      {"ck", perms.Any(o => o.ControllerId == cdto.Id && o.PrevilegeLevel == (int)PrevilegeLevel.ControllerLevel)}
                                  };

                if (cdto.Actions != null && cdto.Actions.Count > 0)
                {
                    cdtoDic.Add("state", "closed");
                    var children = cdto.Actions.Where(o => !o.ForAll).Select(act => new Dictionary<string, object>
                                                                  {
                                                                      {"internalId", act.Id},
                                                                      {"id", i ++},
                                                                      {"name", act.ChineseName},
                                                                      {"internalName", act.Name},
                                                                      {"description", act.Description},
                                                                      {"isOpenForAll", act.ForAll ? "是" : "否"},
                                                                      {"type", "Action"},
                                                                      {"ck", perms.Any(o => o.ControllerId == cdto.Id && o.ActionId == act.Id && o.PrevilegeLevel == (int)PrevilegeLevel.ActionLevel)}
                                                                  }).ToList();

                    cdtoDic.Add("children", children);
                }

                result.Add(cdtoDic);
            }

            return result;
        }
Esempio n. 25
0
        public Dictionary<int, int> GetConsortiaByAlly(int consortiaID)
        {
            Dictionary<int, int> consortiaIDs = new Dictionary<int, int>();
            SqlDataReader reader = null;
            try
            {
                SqlParameter[] para = new SqlParameter[1];
                para[0] = new SqlParameter("@ConsortiaID", consortiaID);
                db.GetReader(ref reader, "SP_Consortia_Ally_Neutral", para);

                while (reader.Read())
                {
                    if ((int)reader["Consortia1ID"] != consortiaID)
                    {
                        consortiaIDs.Add((int)reader["Consortia1ID"], (int)reader["State"]);
                    }
                    else
                    {
                        consortiaIDs.Add((int)reader["Consortia2ID"], (int)reader["State"]);
                    }
                }
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                    log.Error("GetConsortiaByAlly", e);
            }
            finally
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();
            }
            return consortiaIDs;
        }
 private void frmClientes_Load(object sender, EventArgs e)
 {
     this.AutoValidate = System.Windows.Forms.AutoValidate.EnableAllowFocusChange;
     this.Location = new Point(50, 50);
     System.Drawing.Icon ico = Properties.Resources.icono_app;
     this.Icon = ico;
     this.ControlBox = true;
     this.MaximizeBox = false;
     FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
     try
     {
         dsClientes = BL.ClientesBLL.GetClientes(1);
     }
     catch (ServidorMysqlInaccesibleException ex)
     {
         MessageBox.Show(ex.Message, "Trend Gestión",
         MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     tblClientes = dsClientes.Tables[0];
     BL.Utilitarios.AddEventosABM(grpCampos, ref btnGrabar, ref tblClientes);
     DataView viewClientes = new DataView(tblClientes);
     bindingSource1.DataSource = tblClientes;
     bindingNavigator1.BindingSource = bindingSource1;
     BL.Utilitarios.DataBindingsAdd(bindingSource1, grpCampos);
     grpBotones.CausesValidation = false;
     btnCancelar.CausesValidation = false;
     btnSalir.CausesValidation = false;
     Dictionary<Int32, String> condiciones = new Dictionary<int, string>();
     condiciones.Add(1, "Consumidor Final");
     condiciones.Add(2, "Responsable Inscripto");
     condiciones.Add(3, "Responsable Monotributo");
     cmbCondicion.DataSource = new BindingSource(condiciones, null);
     cmbCondicion.DisplayMember = "Value";
     cmbCondicion.ValueMember = "Value";
     cmbCondicion.DataBindings.Add("SelectedValue", bindingSource1, "CondicionIvaCLI", false, DataSourceUpdateMode.OnPropertyChanged);
     gvwDatos.DataSource = bindingSource1;
     gvwDatos.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
     gvwDatos.Columns["IdClienteCLI"].DisplayIndex = 0;
     gvwDatos.Columns["ApellidoCLI"].DisplayIndex = 1;
     gvwDatos.Columns["NombreCLI"].DisplayIndex = 2;
     gvwDatos.Columns["CorreoCLI"].DisplayIndex = 3;
     gvwDatos.Columns["IdClienteCLI"].HeaderText = "Nº cliente";
     gvwDatos.Columns["NombreCLI"].HeaderText = "Nombre";
     gvwDatos.Columns["ApellidoCLI"].HeaderText = "Apellido";
     gvwDatos.Columns["CorreoCLI"].HeaderText = "Correo";
     gvwDatos.Columns["RazonSocialCLI"].Visible = false;
     gvwDatos.Columns["CUIT"].Visible = false;
     gvwDatos.Columns["DireccionCLI"].Visible = false;
     gvwDatos.Columns["LocalidadCLI"].Visible = false;
     gvwDatos.Columns["ProvinciaCLI"].Visible = false;
     gvwDatos.Columns["TransporteCLI"].Visible = false;
     gvwDatos.Columns["ContactoCLI"].Visible = false;
     gvwDatos.Columns["TelefonoCLI"].Visible = false;
     gvwDatos.Columns["MovilCLI"].Visible = false;
     gvwDatos.Columns["FechaNacCLI"].Visible = false;
     gvwDatos.Columns["CondicionIvaCLI"].Visible = false;
     gvwDatos.Columns["NombreCompletoCLI"].Visible = false;
     bindingSource1.Sort = "ApellidoCLI ASC, NombreCLI ASC";
     int itemFound = bindingSource1.Find("RazonSocialCLI", "PUBLICO");
     bindingSource1.Position = itemFound;
     SetStateForm(FormState.inicial);
 }
        public Dictionary<string, string> Evaluate(string value,string min, string max)
        {
            Dictionary<string, string> badValue = new Dictionary<string, string>();
            int dataPoint = Convert.ToInt16(value);
            int minValue = Convert.ToInt16(min);
            int maxValue = Convert.ToInt16(max);
            if (dataPoint<minValue)
            {

            badValue.Add("faulty", dataPoint.ToString());
            }
            else if (dataPoint>maxValue)
            {
            badValue.Add("faulty", dataPoint.ToString());

            }else
            {

            badValue.Add("faulty", string.Empty);
            }
            return badValue;
        }
        // 导出详细信息
        protected void link_Export_Detail_Click(object sender,EventArgs e)
        {
            DataTable dt = ViewState["CacheDetail"] as DataTable;
            if (dt.Rows.Count>0)
            {
                // 筛选表中部分列
                DataTable newTab=dt.DefaultView.ToTable(false, new string[] {"proName","sellerName","sellerPrice","price","inputDt","inputName"});
                newTab.Columns[0].ColumnName = "商品名称";
                newTab.Columns[1].ColumnName = "供应商名称";
                newTab.Columns[2].ColumnName = "供应价";
                newTab.Columns[3].ColumnName = "采购价";
                newTab.Columns[4].ColumnName = "创建日期";
                newTab.Columns[5].ColumnName = "创建人";
                string title = lbl_buyerName.Text;

                // 导出Excel
                ExportFacade exportInstance = new Facade.Excel.ExportFacade();
                Dictionary<int, FormatStyle> formatOptions = new Dictionary<int, FormatStyle>();
                formatOptions.Add(2, FormatStyle.ToFix2);
                formatOptions.Add(3, FormatStyle.ToFix2);

                exportInstance.ExportByWeb(newTab, title, title + ".xls", formatOptions, title);
            }
        }
        void FrmMain_Load(object sender, EventArgs e)
        {
            ImgSlide.Images.Add(GUI.Properties.Resources.slide2);
            //ImgSlide.Images.Add(GUI.Properties.Resources.slide3);
            //ImgSlide.Images.Add(GUI.Properties.Resources.slide4);
            //ImgSlide.Images.Add(GUI.Properties.Resources.slide5);
            //ImgSlide.Images.Add(GUI.Properties.Resources.slide6);
            //ImgSlide.Images.Add(GUI.Properties.Resources.slide7);
            //ImgSlide.Images.Add(GUI.Properties.Resources.slide8);
            //ImgSlide.Images.Add(GUI.Properties.Resources.slide9);
            //ImgSlide.Images.Add(GUI.Properties.Resources.slide10);
            NhanVien = phanquyen.GetUsername(this.Tag.ToString());

            if (NhanVien == null) return;
            barTxtNhanVien.Caption = NhanVien.name;
            barTxtDangNhap.Caption = "Đăng xuất";
            List<staff_permission> permissions = phanquyen.GetPermissions(NhanVien);

            Dictionary<string, bool> quyen = new Dictionary<string, bool>();
            foreach (staff_permission sp in permissions)
            {
                quyen.Add(sp.permission.id, sp.allow);
            }

            // dat quyen tuong ung voi rib
            ribHoaDon.Enabled = quyen["QLHD"];
            ribCauHinh.Enabled = quyen["QLHT"];
            ribHangHoa.Enabled = quyen["QLHH"];
            ribKhachHang.Enabled = quyen["QLKH"];
            ribNhaCungCap.Enabled = quyen["QLNCC"];
            ribNhanVien.Enabled = quyen["QLNV"];
            ribNhapHang.Enabled = quyen["QLNH"];
            ribPhanQuyen.Enabled = quyen["QLPQ"];
        }
Esempio n. 30
0
        private bool Parse(HtmlDocument document, out Dictionary<string, Show> result)
        {
            if (document == null)
            {
                throw new ArgumentNullException(nameof(document));
            }

            var showTitles = document.DocumentNode.SelectNodes(@"//div[@class='mid']//div[@class='content_body']//a//img")
                ?.Select(s => s?.Attributes["title"]?.Value?.Trim())
                .ToArray();

            var seriesTitles = document.DocumentNode.SelectNodes(@"//div[@class='mid']//div[@class='content_body']//span[@class='torrent_title']//b")
                ?.Select(s => s?.InnerText?.Trim())
                .ToArray();

            var episodesIds = document.DocumentNode.SelectNodes(@"//div[@class='mid']//div[@class='content_body']//a[@class='a_details']")
                ?.Select(
                    s => s?.Attributes["href"] != null ?
                    IdRegex.Match(s.Attributes["href"].Value).Groups[1].Value :
                    null)
                .ToArray();

            if (showTitles == null || seriesTitles == null || episodesIds == null)
            {
                throw new ArgumentException("Invalid web page", nameof(document));
            }

            var dateList = document.DocumentNode.SelectNodes(@"//div[@class='mid']//div[@class='content_body']")
                ?.First()?.InnerHtml;
            var dates = dateList != null ? DateRegex.Matches(dateList) : null;

            Dictionary<string, Show> showDictionary = new Dictionary<string, Show>();
            bool stop = false;
            for (int i = 0; i < showTitles.Length; i++)
            {
                int episodeId;
                try
                {
                    episodeId = int.Parse(episodesIds[i]);
                }
                catch (Exception e)
                {
                    Program.Logger.Error(e, $"An error occurred while converting EpisodeId: {episodesIds[i]}");
                    continue;
                }

                if (episodeId <= LastId)
                {
                    stop = true;
                    break;
                }

                DateTimeOffset? date = null;
                if (dates != null)
                {
                    DateTime tempDateTime;
                    if (DateTime.TryParse(dates[i].Groups[1].Value, out tempDateTime))
                    {
                        date = new DateTimeOffset(tempDateTime, SiteTimeZoneInfo.BaseUtcOffset);
                    }
                }

                if (!showDictionary.ContainsKey(showTitles[i]))
                {
                    showDictionary.Add(showTitles[i], new Show { Title = showTitles[i] });
                }

                showDictionary[showTitles[i]].Episodes.Add(
                    new Episode
                    {
                        SiteId = episodeId,
                        Title = seriesTitles[i],
                        Date = date
                    }
                );
            }

            result = showDictionary;
            return stop;
        }