/// <summary>
        /// 查询
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnQuery_Click(object sender, EventArgs e)
        {
            if (!CheckData())
            {
                PageHelper.ShowExceptionMessage(hidInfo.Value);
                return;
            }
            viewpage1.CurrentPageIndex = 1;

            this.SurveyName = txtSurveyName.Text.Trim();
            this.State      = NDConvert.ToInt32(ddlState.SelectedValue);
            this.Active     = NDConvert.ToInt32(ddlActive.SelectedValue);
            this.ClassID    = NDConvert.ToInt32(ddlSurveyClass.SelectedValue);
            this.BeginDate  = NDConvert.ToDateTime(wdcBeginDate.Value);
            if (NDConvert.ToDateTime(wdcEndDate.Value) == NDConvert.ToDateTime("1900-1-1"))
            {
                this.EndDate = NDConvert.ToDateTime("2999-12-31");
            }
            else
            {
                this.EndDate = NDConvert.ToDateTime(wdcEndDate.Value);
            }

            BindGridView();
        }
Example #2
0
        /// <summary>
        /// 数据行操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int    rowIndex = NDConvert.ToInt32(e.CommandArgument);
            string GiftID   = grid.DataKeys[rowIndex]["ID"].ToString();

            switch (e.CommandName)
            {
            case "Status":
                GiftsEntity entity = new GiftsEntity(GiftID);
                if (entity.Status == (int)CommonEnum.GiftStatus.Close)
                {
                    entity.Status = (int)CommonEnum.GiftStatus.Online;
                }
                else
                {
                    entity.Status = (int)CommonEnum.GiftStatus.Close;
                }
                entity.UpdateTime = DateTime.Now;
                new GiftsRule().Update(entity);
                PageHelper.ShowMessage("状态更改成功!");
                BindGridView();
                break;

            case "View":
                PageHelper.WriteScript("window.open('../../Web/Gifts/ImagePhoto.aspx?ID=" + GiftID + "');");
                break;
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int RowIndex = NDConvert.ToInt32(e.CommandArgument.ToString());

            this.CodeDetailID = NDConvert.ToInt64(grid.DataKeys[RowIndex].Values["CodeDetailID"].ToString());
            CodeDetailEntity entity = new CodeDetailEntity(CodeDetailID);

            switch (e.CommandName)
            {
            case "Modify":
                txtCodeDetailName.Text  = entity.CodeDetailName;
                txtCodeDetailValue.Text = entity.CodeDetailValue;
                txtDetailMemo.Text      = entity.DetailMemo;
                this.CurOperation       = (int)OperationEnum.UPDATE;
                break;

            case "Del":
                entity.IsDeleted = true;
                new CodeDetailRule().Update(entity);
                txtCodeDetailName.Text  = "";
                txtCodeDetailValue.Text = "";
                txtDetailMemo.Text      = "";
                BindGridView();
                this.CurOperation = (int)OperationEnum.INSERT;
                this.CodeDetailID = 0;
                PageHelper.ShowMessage("删除成功!");
                break;
            }
        }
        /// <summary>
        /// 保存
        /// </summary>
        private void Save()
        {
            PartnerEntity entity     = new PartnerEntity();
            Stream        fileStream = fuPicture.PostedFile.InputStream;

            byte[] FileContent = new byte[fileStream.Length];
            fileStream.Read(FileContent, 0, FileContent.Length);
            fileStream.Close();

            byte[] LittlePicture = FileContent;

            entity.ID   = Guid.NewGuid().ToString();
            entity.Name = txtName.Text.Trim();
            entity.URL  = txtURL.Text.Trim();
            if (txtSort.Text.Trim() == "")
            {
                entity.sort = 0;
            }
            else
            {
                entity.sort = NDConvert.ToInt32(txtSort.Text.Trim());
            }

            entity.Status = (int)CommonEnum.PartnerStatus.Online;

            if (FileContent.Length > 0)
            {
                entity.Image = FileContent;
            }

            new PartnerRule().Add(entity);
        }
        /// <summary>
        /// 修改
        /// </summary>
        private void Update()
        {
            PartnerEntity entity = new PartnerEntity(this.PartnerID);

            if (fuPicture.PostedFile.ContentLength > 0)
            {
                Stream fileStream = fuPicture.PostedFile.InputStream;

                byte[] FileContent = new byte[fileStream.Length];
                fileStream.Read(FileContent, 0, FileContent.Length);
                fileStream.Close();

                byte[] LittlePicture = FileContent;

                entity.Image = LittlePicture;
            }
            entity.Name = txtName.Text.Trim();
            entity.URL  = txtURL.Text.Trim();
            if (txtSort.Text.Trim() == "")
            {
                entity.sort = 0;
            }
            else
            {
                entity.sort = NDConvert.ToInt32(txtSort.Text.Trim());
            }

            new PartnerRule().Update(entity);
        }
Example #6
0
        /// <summary>
        /// 邦定GridView
        /// </summary>
        private void BindGridView()
        {
            DataSet   ds = GetData();
            DataTable dt = ds.Tables[1];

            grid.DataSource = dt;
            grid.DataBind();

            BindviewPage(NDConvert.ToInt32(ds.Tables[0].Rows[0][0].ToString()));

            for (int i = 0; i < grid.Rows.Count; i++)
            {
                LinkButton obj = (LinkButton)grid.Rows[i].Cells[8].Controls[0];
                if (NDConvert.ToInt32(grid.DataKeys[i]["Status"].ToString()) == (int)CommonEnum.GiftExchangeStatus.ForExchange)
                {
                    obj.Text    = "同意兑换";
                    obj.Enabled = true;
                    //obj.Attributes.Add("onclick", "if(confirm('确认要进行此次礼品兑换么?')==true)return true; else return false;");
                    obj.Attributes.Add("onclick", "return ConfirmExchange();");
                }
                else if (NDConvert.ToInt32(grid.DataKeys[i]["Status"].ToString()) == (int)CommonEnum.GiftExchangeStatus.HasExchange)
                {
                    obj.Text    = "已兑换";
                    obj.Enabled = false;
                }
                else
                {
                    obj.Text    = "已放弃";
                    obj.Enabled = false;
                }
            }
        }
Example #7
0
        /// <summary>
        /// 数据行操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int            rowIndex = NDConvert.ToInt32(e.CommandArgument);
            long           ID       = NDConvert.ToInt64(grid.DataKeys[rowIndex]["ID"].ToString());
            ExchangeEntity entity   = new ExchangeEntity(ID);

            switch (e.CommandName)
            {
            case "Status":
                //GiftsEntity entity = new GiftsEntity(GiftID);
                if (entity.Status == (int)CommonEnum.GiftExchangeStatus.ForExchange)
                {
                    entity.Status = (int)CommonEnum.GiftExchangeStatus.HasExchange;

                    entity.ExchangeTime = DateTime.Now;
                    new ExchangeRule().Update(entity);
                    new HuiYuanRule().UpdateRemainPoint(entity.HuiYuanGuid, entity.UsedPoint);

                    PageHelper.ShowMessage("状态更改成功!");
                    BindGridView();
                }
                break;

            case "View":
                PageHelper.WriteScript("window.open('../../Web/Gifts/ImagePhoto.aspx?ID=" + entity.GiftGuid + "');");
                break;
            }
        }
Example #8
0
        /// <summary>
        /// 邦定GridView
        /// </summary>
        private void BindGridView()
        {
            long      UserID = NDConvert.ToInt64(Session["UserID"]); //当前管理操作的中
            DataSet   ds     = GetData(UserID.ToString());
            DataTable dt     = ds.Tables[1];

            grid.DataSource = dt;
            grid.DataBind();

            BindviewPage(NDConvert.ToInt32(ds.Tables[0].Rows[0][0].ToString()));

            for (int i = 0; i < grid.Rows.Count; i++)
            {
                long ID = NDConvert.ToInt64(grid.DataKeys[i]["SID"].ToString());

                DataTable GetSurveyInfo = new SurveyManage_Layer().GetSurveyTable(ID.ToString(), UserID.ToString());


                //编辑
                //LinkButton objEdit = (LinkButton)grid.Rows[i].Cells[10].Controls[0];

                //System.Web.UI.WebControls.Image image2 = new System.Web.UI.WebControls.Image();
                //image2.Style.Add("margin", "0");
                //image2.ImageUrl = "images/edit2.gif";
                //objEdit.Text = "编辑";
                //grid.Rows[i].Cells[10].Controls.AddAt(0, image2);
            }
        }
Example #9
0
        /// <summary>
        /// 数据行操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int    rowIndex  = NDConvert.ToInt32(e.CommandArgument);
            string partnerID = grid.DataKeys[rowIndex]["ID"].ToString();

            switch (e.CommandName)
            {
            case "Status":
                PartnerEntity entity = new PartnerEntity(partnerID);
                if (entity.Status == (int)CommonEnum.PartnerStatus.Offline)
                {
                    entity.Status = (int)CommonEnum.PartnerStatus.Online;
                }
                else
                {
                    entity.Status = (int)CommonEnum.PartnerStatus.Offline;
                }

                new PartnerRule().Update(entity);
                PageHelper.ShowMessage("状态更改成功!");
                BindGridView();
                break;

            case "View":
                PageHelper.WriteScript("window.open('ImagePhoto.aspx?ID=" + partnerID + "');");
                break;
            }
        }
        /// <summary>
        /// 获得部门最大排序号
        /// </summary>
        /// <returns></returns>
        public static int GetMaxSortIndex()
        {
            string    sql = "SELECT MAX(sortIndex) + 1 FROM UT_SYS_OU";
            DataTable dt  = NDDBAccess.Fill(sql);

            return(NDConvert.ToInt32(dt.Rows[0][0].ToString()));
        }
Example #11
0
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnQuery_Click(object sender, EventArgs e)
        {
            viewpage1.CurrentPageIndex = 1;

            this.TxtSurveyName = txtSurveyName.Text.Trim();
            if (!string.IsNullOrEmpty(getBackNum.Text.Trim()))
            {
                this.GetBackNum = NDConvert.ToInt32(getBackNum.Text.Trim());
            }
            else
            {
                this.GetBackNum = -1;
            }
            if (!string.IsNullOrEmpty(ddlSurveyClass.Text.Trim()))
            {
                this.DdlSurveyClass = NDConvert.ToInt32(ddlSurveyClass.Text.Trim());
            }
            else
            {
                this.DdlSurveyClass = -1;
            }
            this.WdcBeginDate = NDConvert.ToDateTime(wdcBeginDate.Value);
            if (NDConvert.ToDateTime(wdcEndDate.Value) == NDConvert.ToDateTime("1900-1-1"))
            {
                this.WdcEndDate = NDConvert.ToDateTime("2999-12-31");
            }
            else
            {
                this.WdcEndDate = NDConvert.ToDateTime(wdcEndDate.Value);
            }

            BindGridView();
        }
Example #12
0
        /// <summary>
        /// 保存
        /// </summary>
        private void Save()
        {
            GiftsEntity entity     = new GiftsEntity();
            Stream      fileStream = fuPicture.PostedFile.InputStream;

            byte[] FileContent = new byte[fileStream.Length];
            fileStream.Read(FileContent, 0, FileContent.Length);
            fileStream.Close();

            byte[] LittlePicture = FileContent;

            entity.ID           = Guid.NewGuid().ToString();
            entity.GiftName     = txtGiftName.Text.Trim();
            entity.NeedPoint    = NDConvert.ToInt32(txtNeedPoints.Text.Trim());
            entity.RemainAmount = NDConvert.ToInt32(txtRemainAmount.Text.Trim());
            entity.Description  = txtDescription.Text.Trim();
            entity.Status       = (int)CommonEnum.GiftStatus.Close;
            entity.CreateTime   = DateTime.Now;

            if (FileContent.Length > 0)
            {
                entity.Picture = FileContent;
            }

            new GiftsRule().Add(entity);
        }
        public static int GetMaxSortIndex(long OUParentID)
        {
            string    sql = string.Format("SELECT MAX(sortIndex) + 1 FROM UT_SYS_OU where OUParentID={0}", OUParentID);
            DataTable dt  = NDDBAccess.Fill(sql);

            return(NDConvert.ToInt32(dt.Rows[0][0].ToString()));
        }
        /// <summary>
        /// 获取最大排序号
        /// </summary>
        /// <returns></returns>
        public static int MaxSortIndex(long MenuID)
        {
            string    sql = "SELECT MAX(SortIndex) FROM UT_SYS_MenuFunction WHERE IsDeleted = 0 AND MenuID = " + MenuID;
            DataTable dt  = NDDBAccess.Fill(sql);

            return(NDConvert.ToInt32(dt.Rows[0][0].ToString()) + 1);
        }
Example #15
0
        /// <summary>
        /// 获取调查问卷的数量
        /// 作者:姚东
        /// 时间:20100925
        /// </summary>
        /// <returns></returns>
        public int GetSurveyAmount()
        {
            string sql = @"SELECT count(1) FROM UV_QS_SurveyTable WHERE State=1 and Active=1 and 
                datediff(day,getdate(),isnull(EndDate,'2199-12-31'))>=0  
                and (MaxAnswerAmount=0 or MaxAnswerAmount<>0 and AnswerAmount<MaxAnswerAmount) and ApprovalStaus=1";

            return(NDConvert.ToInt32(NDDBAccess.Fill(sql).Rows[0][0]));
        }
        /// <summary>
        /// 绑定
        /// </summary>
        private void BindGridView()
        {
            DataSet   ds = GetData();
            DataTable dt = ds.Tables[1];

            grid.DataSource = dt;
            grid.DataBind();
            BindviewPage(NDConvert.ToInt32(ds.Tables[0].Rows[0][0].ToString()));
        }
        /// <summary>
        /// 数据行操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int rowIndex = NDConvert.ToInt32(e.CommandArgument);

            switch (e.CommandName)
            {
            case "SurveyName":
                break;
            }
        }
        /// <summary>
        /// 获得列合计数据
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="ColumnName"></param>
        /// <returns></returns>
        public static int StatColumn(DataTable dt, string ColumnName)
        {
            int Sum = 0;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Sum += NDConvert.ToInt32(dt.Rows[i][ColumnName].ToString());
            }
            return(Sum);
        }
        /// <summary>
        /// 判断用户是否具有某项功能
        /// </summary>
        /// <returns></returns>
        public static bool CheckMenuFunctionRight(long UserID, long MenuID, long FID)
        {
            string    sql = "SELECT COUNT(*) FROM UT_SYS_MenuFunctionRight WHERE  UserID = " + UserID + " AND MenuID = " + MenuID + " AND FID = " + FID;
            DataTable dt  = NDDBAccess.Fill(sql);

            if (NDConvert.ToInt32(dt.Rows[0][0].ToString()) > 0)
            {
                return(true);
            }
            return(false);
        }
        /// <summary>
        /// 根据菜单类型获得用户操作菜单
        /// </summary>
        /// <param name="Account"></param>
        /// <returns></returns>
        public static bool IsHaveChileMenu(long parentMenuID)
        {
            string    sql = "SELECT COUNT(*) FROM UT_SYS_Menu WHERE IsDeleted = 0 AND ParentMenuID = " + parentMenuID;
            DataTable dt  = NDDBAccess.Fill(sql);

            if (NDConvert.ToInt32(dt.Rows[0][0].ToString()) > 0)
            {
                return(true);
            }
            return(false);
        }
Example #21
0
 /// <summary>
 /// 获得URL参数
 /// 作者:姚东
 /// 时间:20101027
 /// </summary>
 private void GetUrlParameter()
 {
     if (Request.QueryString["Operation"] != null && Request.QueryString["Operation"] != "")
     {
         this.CurOperation = NDConvert.ToInt32(Request.QueryString["Operation"].ToString());
     }
     if (Request.QueryString["ID"] != null && Request.QueryString["ID"] != "")
     {
         this.CID = NDConvert.ToInt64(Request.QueryString["ID"]);
     }
 }
        /// <summary>
        /// 判断部门是否有人员
        /// </summary>
        /// <param name="OUID"></param>
        /// <returns></returns>
        public static bool IsHavePerson(long OUID)
        {
            string    sql = "SELECT COUNT(*) FROM UT_SYS_User WHERE IsDeleted = 0 AND OUID = " + OUID;
            DataTable dt  = NDDBAccess.Fill(sql);

            if (NDConvert.ToInt32(dt.Rows[0][0].ToString()) > 0)
            {
                return(true);
            }
            return(false);
        }
Example #23
0
        /// <summary>
        /// 判断某代码组是否存在代码信息
        /// </summary>
        /// <param name="CodeGroupID"></param>
        /// <returns></returns>
        public static bool IsExistCode(long CodeGroupID)
        {
            string    sql = "SELECT count(*) FROM UT_SYS_Code WHERE IsDeleted = 0 AND CodeGroupID = " + CodeGroupID;
            DataTable dt  = NDDBAccess.Fill(sql);

            if (NDConvert.ToInt32(dt.Rows[0][0].ToString()) > 0)
            {
                return(true);
            }
            return(false);
        }
Example #24
0
 /// <summary>
 /// 查询
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnQuery_Click(object sender, EventArgs e)
 {
     if (!CheckData())
     {
         PageHelper.ShowExceptionMessage(hidInfo.Value);
         return;
     }
     viewpage1.CurrentPageIndex = 1;
     this.Name   = txtName.Text.Trim();
     this.Status = NDConvert.ToInt32(ddlStatus.SelectedValue);
     BindGridView();
 }
Example #25
0
        /// <summary>
        /// 更新
        /// </summary>
        private void Update()
        {
            UserEntity entity = new UserEntity(SessionState.UserID);

            entity.UserName    = txtUserName.Text.Trim();
            entity.Sex         = NDConvert.ToInt32(rdolstSex.SelectedValue);
            entity.Email       = txtEmail.Text.Trim();
            entity.OfficePhone = txtOfficePhone.Text.Trim();
            entity.MobilePhone = txtMobilePhone.Text.Trim();
            entity.UpdateDate  = DateTime.Now;
            new UserRule().Update(entity);
        }
Example #26
0
        /// <summary>
        /// 数据行操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int  rowIndex            = NDConvert.ToInt32(e.CommandArgument);
            long ID                  = NDConvert.ToInt64(grid.DataKeys[rowIndex]["SID"].ToString());
            SurveyTableEntity entity = new SurveyTableEntity(ID);
            int count                = 0;

            switch (e.CommandName)
            {
            case "SurveyName":
                string urlAnswer = string.Format("ClientPs.aspx?SID={0}&AnswerGUID={1}", ID, ConvertString(grid.DataKeys[rowIndex]["AnswerGUID"]));
                PageHelper.WriteScript(string.Format("window.open('{0}');", urlAnswer));
                if (count == this.grid.Rows.Count)
                {
                    viewpage1.CurrentPageIndex = viewpage1.CurrentPageIndex == 1 ? 1 : viewpage1.CurrentPageIndex - 1;
                }
                BindGridView();
                break;

            case "TempPage":

                BindGridView();
                break;

            case "Statistics":

                BindGridView();
                break;

            case "Options":

                BindGridView();
                break;

            case "Editer":

                BindGridView();
                break;

            case "DeleteAnswer":
                //int count = 0;
                string AnswerGuid = ConvertString(grid.DataKeys[rowIndex]["AnswerGUID"]);
                //new AnswerManager_Layer().DeleteAnswer(AnswerGuid); //彻底删除答卷
                int ReturnNum = new AnswerManager_Layer().SetApprovalStaus("3", AnswerGuid);
                new AnswerManager_Layer().UpdateAnswerNum(ReturnNum, ID.ToString());
                if (count == this.grid.Rows.Count)
                {
                    viewpage1.CurrentPageIndex = viewpage1.CurrentPageIndex == 1 ? 1 : viewpage1.CurrentPageIndex - 1;
                }
                BindGridView();
                break;
            }
        }
        /// <summary>
        /// 生成最新排序号
        /// </summary>
        /// <returns></returns>
        public static int GetMaxSortIndex()
        {
            int       MaxSortIndex = 1;
            string    sql          = "SELECT MAX(SortIndex) + 1 AS MaxSortIndex FROM UT_SYS_User";
            DataTable dt           = NDDBAccess.Fill(sql);

            if (dt.Rows.Count > 0)
            {
                MaxSortIndex = NDConvert.ToInt32(dt.Rows[0]["MaxSortIndex"].ToString());
            }
            return(MaxSortIndex);
        }
 /// <summary>
 /// 获得配置文件配置值(整型)
 /// </summary>
 /// <param name="Key"></param>
 /// <returns></returns>
 public static int GetConfigValueInt(string Key)
 {
     try
     {
         string Value = ConfigurationManager.AppSettings[Key];
         return(NDConvert.ToInt32(Value));
     }
     catch
     {
         throw new Exception("未找到" + Key + "配置信息,或配置值错误!");
     }
 }
        /// <summary>
        /// 判断用户是否具有某项功能
        /// </summary>
        /// <returns></returns>
        public static bool CheckRightFunction(long UserID, long MenuID, string toolbarItem)
        {
            string sql = "SELECT COUNT(*) " +
                         "FROM UT_SYS_MenuFunctionRight INNER JOIN " +
                         "UT_SYS_MenuFunction ON  " +
                         "UT_SYS_MenuFunctionRight.FID = UT_SYS_MenuFunction.FID WHERE FCode = '" + toolbarItem + "'  AND UserID = " + UserID + " AND UT_SYS_MenuFunctionRight.MenuID = " + MenuID;
            DataTable dt = NDDBAccess.Fill(sql);

            if (NDConvert.ToInt32(dt.Rows[0][0].ToString()) > 0)
            {
                return(true);
            }
            return(false);
        }
        /// <summary>
        /// 检测代码组代码是否存在相同代码
        /// </summary>
        /// <param name="Account"></param>
        /// <param name="userID"></param>
        /// <param name="Operation"></param>
        /// <returns></returns>
        public static bool CheckCodeGroupKey(string CodeGroupKey, long CodeGroupID, int Operation)
        {
            string sql = "SELECT COUNT(*) FROM UT_SYS_CodeGroup WHERE IsDeleted = 0 AND  CodeGroupKey = '" + CodeGroupKey + "'";

            if (Operation == 2)
            {
                sql += " AND CodeGroupID <> " + CodeGroupID;
            }

            DataTable dt = NDDBAccess.Fill(sql);

            if (NDConvert.ToInt32(dt.Rows[0][0].ToString()) > 0)
            {
                return(true);
            }
            return(false);
        }