Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["UserName"] == null)
                {
                    //Response.Write("<script LANGUAGE='JavaScript' >alert('You are not logged in, Please login to see your side!);href='~/'</script>",true );
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('You are not logged in, Please login to see your side.');window.location ='Login.aspx'", true);
                    return;
                }

                DataTable dt = new DataTable();
                dt.Columns.Add("File", typeof(string));
                dt.Columns.Add("Size", typeof(string));
                dt.Columns.Add("Type", typeof(string));

                foreach (string strFile in Directory.GetFiles(Server.MapPath("~/Document/")))
                {
                    FileInfo fi = new FileInfo(strFile);
                    dt.Rows.Add(fi.Name, fi.Length, GetFileTypeByExtenstion(fi.Extension));

                    GridView_Info.DataSource = dt;
                    GridView_Info.DataBind();
                }
            }
        }
        private void showData()
        {
            TBInfoService infoService = new TBInfoService();
            int           typeId      = Convert.ToInt32(DropDownList_Type.SelectedValue);
            string        key         = TextBox_Keys.Text.Trim();
            ArrayList     list        = infoService.GetInfoList(typeId, key, 0, -1, searchtype);

            GridView_Info.DataSource = list;
            GridView_Info.DataBind();
        }
Esempio n. 3
0
        //GridControl的双击事件
        private void GridControl_Info_DoubleClick(object sender, EventArgs e)
        {
            if (GridControl_Info.DataSource != null)
            { //获取FID或者第一个ID字段名称(索引字段)
                string StrClmIndex = GridView_Info.Columns[0].FieldName;
                //获取FID或者第一个ID字段值
                int IntQueryIndex = Convert.ToInt32(GridView_Info.GetSelectedRows()[0]);

                //查询定位的要素对象
                IFeatureClass pFC     = pFeaLyr.FeatureClass;
                IQueryFilter  qFilter = new QueryFilter();
                qFilter.WhereClause = StrClmIndex + "=" + IntQueryIndex.ToString();
                IFeatureCursor fCursor = pFC.Search(qFilter, false);
                IFeature       feature = fCursor.NextFeature();

                //获取查询要素中心点
                IPoint point = new ESRI.ArcGIS.Geometry.Point();
                //如果是面
                if (feature.Shape.GeometryType == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon)
                {
                    IArea area = feature.Shape as IArea;
                    point = area.Centroid;
                }
                //如果是点
                else if (feature.Shape.GeometryType == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint)
                {
                    point = feature.Shape as IPoint;
                }
                //如果是线
                else if (feature.Shape.GeometryType == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline)
                {
                    IArea area = feature.Extent as IArea;
                    point = area.Centroid;
                }

                //根据要素中心点进行空间定位
                axMapControl_1.CenterAt(point);
                axMapControl_1.Update();
                FlashFeature(feature);
            }
            else
            {
                MessageBox.Show("请先执行查询功能,再进行双击确定定位操作!");
            }
        }
Esempio n. 4
0
        protected void Button_Upload_Click(object sender, EventArgs e)
        {
            if (Fileupload.HasFile)
            {
                string fileExtenstion = System.IO.Path.GetExtension(Fileupload.FileName);

                if (fileExtenstion.ToLower() != ".doc" && fileExtenstion.ToLower() != ".docx" && fileExtenstion.ToLower() != ".xlsx" && fileExtenstion.ToLower() != ".xls" && fileExtenstion.ToLower() != ".jpg" && fileExtenstion.ToLower() != ".png" && fileExtenstion.ToLower() != ".txt" && fileExtenstion.ToLower() != ".pdf")
                {
                    Response.Write("<script LANGUAGE='JavaScript' >alert('File extension are not matched!')</script>");
                }
                else
                {
                    int uplodedfileSize = Fileupload.PostedFile.ContentLength;
                    if (uplodedfileSize > 2097152)
                    {
                        Response.Write("<script LANGUAGE='JavaScript' >alert('Maximum File size (2MB) exceeded!')</script>");
                    }
                    else
                    {
                        Fileupload.PostedFile.SaveAs(Server.MapPath("~/Document/") + Fileupload.FileName);
                    }
                }
            }

            DataTable dt = new DataTable();

            dt.Columns.Add("File", typeof(string));
            dt.Columns.Add("Size", typeof(string));
            dt.Columns.Add("Type", typeof(string));

            foreach (string strFile in Directory.GetFiles(Server.MapPath("~/Document/")))
            {
                FileInfo fi = new FileInfo(strFile);
                dt.Rows.Add(fi.Name, fi.Length, GetFileTypeByExtenstion(fi.Extension));

                GridView_Info.DataSource = dt;
                GridView_Info.DataBind();
            }
        }
Esempio n. 5
0
 protected void GridView_Info_RowEditing(object sender, GridViewEditEventArgs e)
 {
     GridView_Info.EditIndex = e.NewEditIndex;
     GridView_Info.DataBind();// your gridview binding function
     //Response.Redirect("~/Account/MemberEdit.aspx");
 }
Esempio n. 6
0
 protected void GridView_Info_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     GridView_Info.PageIndex = e.NewPageIndex;
     GridView_Info.DataBind();
 }
Esempio n. 7
0
        protected bool Search_RedovisningBySearchItem(string Searchdate1, string Searchdate2)
        //protected void TextBox_MemberID_TextChanged(object sender, EventArgs e)
        {
            try
            {
                System.Configuration.Configuration            rootWebConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/MyWebSiteRoot");
                System.Configuration.ConnectionStringSettings connStringSQL;
                connStringSQL = rootWebConfig.ConnectionStrings.ConnectionStrings["DefaultConnection"];
                string MyconnStr = null;

                if (rootWebConfig.ConnectionStrings.ConnectionStrings.Count > 0)
                {
                    if (connStringSQL != null)
                    {
                        if (connStringSQL.ProviderName == "System.Data.SqlClient")
                        {
                            MyconnStr = connStringSQL.ConnectionString;
                            SqlConnection conn = new SqlConnection(@"" + MyconnStr + "");
                            conn.Open();

                            //Image_MemberPicture.ImageUrl = ImageConverter(strBase64);

                            //PreviousBalnace
                            SqlCommand    MyCommand_PreVal;
                            string        MySqlString_PreVal = null;
                            SqlDataReader dataReader_PreVal;

                            MySqlString_PreVal = "select KONTO,SHORT_DESC,'" + "2018-01-01" + "'+' till '+'" + Searchdate1 + "'  as TRANSDATE," +
                                                 "RED_TYP_DESC,t1.ACC_ID,t1.RED_TYP,isnull((CASE WHEN t1.TRANTYPE='D' THEN REDOVISNING_AMT END),0.00) as 'Debit'," +
                                                 " isnull((CASE WHEN t1.TRANTYPE='C' THEN REDOVISNING_AMT END),0.00) as 'Kredit'" +
                                                 " from " +
                                                 " ((select ACC_ID,RED_TYP,TRANTYPE,SUM(TR_AMOUNT) as REDOVISNING_AMT from [NRB_MMS].[dbo].[Redovisning] where datum <'" + Searchdate1 + "'" +
                                                 " group by ACC_ID,RED_TYP,TRANTYPE) as t1" +
                                                 " inner join" +
                                                 " (select * from [NRB_MMS].[dbo].[Red_typ]) as t2 " +
                                                 " on t1.ACC_ID=t2.ACC_ID and t1.RED_TYP=t2.RED_TYP) order by ACC_ID,RED_TYP,TRANTYPE desc ";


                            MyCommand_PreVal  = new SqlCommand(MySqlString_PreVal, conn);
                            dataReader_PreVal = MyCommand_PreVal.ExecuteReader();


                            GridView_PreviousBalance.DataSource = null;
                            GridView_PreviousBalance.DataBind();

                            if (dataReader_PreVal.HasRows)
                            {
                                GridView_PreviousBalance.Visible    = true;
                                GridView_PreviousBalance.DataSource = dataReader_PreVal;
                                GridView_PreviousBalance.DataBind();
                            }
                            else
                            {
                                GridView_PreviousBalance.DataSource = null;
                                GridView_PreviousBalance.DataBind();
                                GridView_PreviousBalance.Visible = false;
                            }

                            dataReader_PreVal.Close();
                            MyCommand_PreVal.Dispose();

                            //Present Balance according to date

                            SqlCommand    MyCommand;
                            string        MySqlString = null;
                            SqlDataReader dataReader;
                            //MySqlString = "Select * FROM [NRB_MMS].[dbo].[Member] where MemberID=  " + MemberID + "";

                            MySqlString = "select KONTO,SHORT_DESC,'" + Searchdate1 + "'+' till '+'" + Searchdate2 + "'  as TRANSDATE,RED_TYP_DESC,t1.ACC_ID,t1.RED_TYP,isnull((CASE WHEN t1.TRANTYPE='D' THEN REDOVISNING_AMT END),0.00) as 'Debit'," +
                                          " isnull((CASE WHEN t1.TRANTYPE='C' THEN REDOVISNING_AMT END),0.00) as 'Kredit'" +
                                          " from " +
                                          " ((select ACC_ID,RED_TYP,TRANTYPE,SUM(TR_AMOUNT) as REDOVISNING_AMT from [NRB_MMS].[dbo].[Redovisning] where datum>='" + Searchdate1 + "'" +
                                          " and datum<='" + Searchdate2 + "' group by ACC_ID,RED_TYP,TRANTYPE) as t1" +
                                          " inner join" +
                                          " (select * from [NRB_MMS].[dbo].[Red_typ]) as t2 " +
                                          " on t1.ACC_ID=t2.ACC_ID and t1.RED_TYP=t2.RED_TYP) order by ACC_ID,RED_TYP,TRANTYPE desc ";


                            //MySqlString = "Select * FROM [NRB_MMS].[dbo].[Member] where MemberID like '%" + SearchItem + "%'" +
                            //        " or FAMILYID  like '%" + SearchItem + "%' or pers_nr like '%" + SearchItem + "%' or FAMILYNAME like '%" + SearchItem + "%'" +
                            //        " or MemberFNAME like '%" + SearchItem + "%' or MemberLNAME like '%" + SearchItem + "%' or EMAIL_USERNAME like '%" + SearchItem + "%'" +
                            //        " or phone_nr like '%" + SearchItem + "%'";


                            MyCommand  = new SqlCommand(MySqlString, conn);
                            dataReader = MyCommand.ExecuteReader();


                            GridView_Info.DataSource = null;
                            GridView_Info.DataBind();

                            if (dataReader.HasRows)
                            {
                                GridView_Info.Visible    = true;
                                GridView_Info.DataSource = dataReader;
                                GridView_Info.DataBind();
                            }



                            else
                            {
                                GridView_Info.DataSource = null;
                                GridView_Info.DataBind();
                                GridView_Info.Visible = false;

                                dataReader.Close();
                                MyCommand.Dispose();
                                return(false);
                            }
                        }
                    }
                }
            }


            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message.ToString());
            }

            return(false);
            //IsSearch_MemberID = 1;
        }
Esempio n. 8
0
        private void BindGridViewData_forallMember()
        {
            try
            {
                System.Configuration.Configuration            rootWebConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/MyWebSiteRoot");
                System.Configuration.ConnectionStringSettings connStringSQL;
                connStringSQL = rootWebConfig.ConnectionStrings.ConnectionStrings["DefaultConnection"];
                string MyconnStr = null;

                if (rootWebConfig.ConnectionStrings.ConnectionStrings.Count > 0)
                {
                    if (connStringSQL != null)
                    {
                        if (connStringSQL.ProviderName == "System.Data.SqlClient")
                        {
                            MyconnStr = connStringSQL.ConnectionString;
                            SqlConnection conn = new SqlConnection(@"" + MyconnStr + "");
                            conn.Open();

                            //Image_MemberPicture.ImageUrl = ImageConverter(strBase64);



                            SqlCommand    MyCommand;
                            string        MySqlString = null;
                            SqlDataReader dataReader;
                            //MySqlString = "Select * FROM [NRB_MMS].[dbo].[Member] order by FAMILYID,MemberID  ASC";
                            MySqlString = "SELECT ROW_NUMBER() OVER(ORDER BY MemberID ASC) AS ROWNR, * FROM [NRB_MMS].[dbo].[Member] order by FAMILYID,MemberID  ASC";


                            MyCommand = new SqlCommand(MySqlString, conn);


                            //MyCommand.Parameters.AddWithValue("@user", TextBox_UserName.Text);
                            dataReader = MyCommand.ExecuteReader();

                            GridView_Info.DataSource = null;
                            GridView_Info.DataBind();


                            if (dataReader.HasRows)

                            {
                                GridView_Info.Visible    = true;
                                GridView_Info.DataSource = dataReader;
                                GridView_Info.DataBind();
                            }

                            dataReader.Close();
                            dataReader.Dispose();
                        }
                        else
                        {
                            Response.Write("<script LANGUAGE='JavaScript' >alert('Ingen information hittades!')</script>");
                            //dataReader.Close();
                            //MyCommand.Dispose();
                        }
                    }
                }
            }


            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message.ToString());
            }


            //IsSearch_MemberID = 1;
        }