Exemplo n.º 1
0
        public bool IsExistExpressBillCode(string strExpressBillCode, string strBillTypeCode)
        {
            DataOperate dataOper = new DataOperate();

            try
            {
                //创建泛型
                List <SqlParameter> parameters = new List <SqlParameter>();
                //创建SqlParameter对象,并赋值
                SqlParameter paramExpressBillCode = new SqlParameter("@ExpressBillCode", SqlDbType.VarChar);
                paramExpressBillCode.Value = strExpressBillCode;
                parameters.Add(paramExpressBillCode);
                //---
                SqlParameter paramBillTypeCode = new SqlParameter("@BillTypeCode", SqlDbType.VarChar);
                paramBillTypeCode.Value = strBillTypeCode;
                parameters.Add(paramBillTypeCode);
                //把泛型中的元素复制到数组中
                SqlParameter[] inputParameters = parameters.ToArray();
                DataTable      dt = dataOper.GetDataTable("IsExistExpressBillCode", inputParameters);
                if (Convert.ToInt32(dt.Rows[0][0]) > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "软件提示");
                throw ex;
            }
        }
Exemplo n.º 2
0
        public JsonResult Login(UserLoginForm loginForm)
        {
            var sql = "select * from user where email=@Email and pwd=@Pwd";

            var mySqlConnection = DataOperate.GetCon();
            var cmd             = new MySqlCommand(sql, mySqlConnection);

            cmd.Parameters.Add(new MySqlParameter("Email", MySqlDbType.VarChar, 16));
            cmd.Parameters["Email"].Value = loginForm.Email;
            cmd.Parameters.Add(new MySqlParameter("Pwd", MySqlDbType.VarChar, 32));
            cmd.Parameters["Pwd"].Value = loginForm.Pwd;

            var user = DataOperate.FindOne(cmd);

            if (user == null)
            {
                mySqlConnection.Close();
                return(Fail("用户或密码输入有误,登录失败..", 1006));
            }

            HttpContext.Session.SetString("userEmail", loginForm.Email);
            HttpContext.Session.SetString("userId", user["id"].ToString());

            mySqlConnection.Close();
            return(Success(user));
        }
Exemplo n.º 3
0
        public JsonResult SelfDescTags()
        {
            string sql = "select * from user inner join selfDesc on user.id = selfDesc.selfId where user.id = " +
                         GetUserId();

            return(Success(DataOperate.FindAll(sql)));
        }
Exemplo n.º 4
0
        public JsonResult CreateHouseCommission(CreateHouseCommission createHouseCommission)
        {
            string sql =
                "insert into house(atCity,community,address,area,floor,layout,orientation,buildAt,rentType,toilet,balcony,houseNum,roomNum,userId) " +
                "values(@AtCity,@Community,@Address,@Area,@Floor,@Layout,@Orientation,@BuildAt,@RentType,@Toilet,@Balcony,@HouseNum,@RoomNum,@UserId)";
            MySqlConnection con = DataOperate.GetCon();
            MySqlCommand    cmd = new MySqlCommand(sql, con);

            cmd.Parameters.Add(new MySqlParameter("@AtCity", MySqlDbType.VarChar, 10)).Value      = createHouseCommission.AtCity;
            cmd.Parameters.Add(new MySqlParameter("@Community", MySqlDbType.VarChar, 10)).Value   = createHouseCommission.Community;
            cmd.Parameters.Add(new MySqlParameter("@Address", MySqlDbType.VarChar, 50)).Value     = createHouseCommission.Address;
            cmd.Parameters.Add(new MySqlParameter("@Area", MySqlDbType.Float)).Value              = createHouseCommission.Area;
            cmd.Parameters.Add(new MySqlParameter("@Floor", MySqlDbType.VarChar, 10)).Value       = createHouseCommission.Floor;
            cmd.Parameters.Add(new MySqlParameter("@Layout", MySqlDbType.VarChar, 10)).Value      = createHouseCommission.Layout;
            cmd.Parameters.Add(new MySqlParameter("@Orientation", MySqlDbType.VarChar, 10)).Value = createHouseCommission.Orientation;
            cmd.Parameters.Add(new MySqlParameter("@BuildAt", MySqlDbType.Date)).Value            = createHouseCommission.BuildAt;
            cmd.Parameters.Add(new MySqlParameter("@RentType", MySqlDbType.Enum)).Value           = createHouseCommission.RentType;
            cmd.Parameters.Add(new MySqlParameter("@Toilet", MySqlDbType.Int32, 11)).Value        = createHouseCommission.Toilet;
            cmd.Parameters.Add(new MySqlParameter("@Balcony", MySqlDbType.Int32, 11)).Value       = createHouseCommission.Balcony;
            cmd.Parameters.Add(new MySqlParameter("@HouseNum", MySqlDbType.VarChar, 10)).Value    = createHouseCommission.HouseNum;
            cmd.Parameters.Add(new MySqlParameter("@RoomNum", MySqlDbType.VarChar, 10)).Value     = createHouseCommission.RoomNum;
            cmd.Parameters.Add(new MySqlParameter("@UserId", MySqlDbType.Int32, 11)).Value        = GetUserId();
            try
            {
                cmd.ExecuteNonQuery();
                con.Close();
            }
            catch (System.Exception e)
            {
                con.Close();
                return(Success(false));
            }

            return(Success(true));
        }
Exemplo n.º 5
0
        public JsonResult RemoveCollect(RemoveCollect removeCollect)
        {
            string sql = "delete from houseCollected where houseId=" + removeCollect.HouseId + " and userId=" +
                         GetUserId();

            return(Success(DataOperate.Update(sql)));
        }
Exemplo n.º 6
0
        public JsonResult HandleOrder(OrderInfo orderInfo)
        {
            string sql = "insert into houseOrdered(houseId,userId,orderTime,orderPhone) values (" + orderInfo.HouseId +
                         ", " + GetUserId() + ", '" + orderInfo.OrderTime + "', '" + orderInfo.OrderPhone + "')";

            return(Success(DataOperate.Create(sql)));
        }
Exemplo n.º 7
0
        public JsonResult GetHouseDetailInfo(int houseId)
        {
            bool liked;
            var  sqlExits = "select count(*) from houseCollected where houseId=" + houseId + " and userId=" +
                            GetUserId();
            var count = Convert.ToInt32(DataOperate.Sele(sqlExits));
            var sql   = "select * from house inner join contract on house.id = contract.houseId where house.id=" +
                        houseId;

            if (count == 0)
            {
                return(Success(new
                {
                    self = DataOperate.FindAll(sql),
                    liked = false
                }));
            }
            else
            {
                return(Success(new
                {
                    self = DataOperate.FindAll(sql),
                    liked = true
                }));
            }
        }
Exemplo n.º 8
0
        public JsonResult RejectOwnerRenewalApply(RejectOwnerRenewalApply rejectOwnerRenewalApply)
        {
            var sql = "update renewalContractApply set applyStatus='reject', adminId=" + GetAdminId() + " where id=" +
                      rejectOwnerRenewalApply.Id;

            return(Success(DataOperate.Update(sql)));
        }
Exemplo n.º 9
0
        private void tBtnStopTest_Click(object sender, EventArgs e)
        {
            // GlobalData.serialPort.TxdCommand(SerialPortControl.Command_Stop_Fire);
            tmrAutoStopFire.Enabled = false;
            GlobalData.serialPort.TxdCommand(0xF7);

            DataOperate.MyTable.Rows[GlobalData.DataRowIndex]["实验结果"] = GlobalData.TimerCount.ToString("f1");
            GlobalData.DataRowIndex++;
            GlobalCofigData.SystemConfig.SerialNo++;
            frmDebugInfo.StopTest();
            GlobalData.SystemStatus = SystemStatuses.SystemReady;

            //GlobalData.serialPort.TxdCommand(SerialPortControl.Command_Fall);
            if (GlobalData.DataRowIndex > 10)
            {
                try
                {
                    DataOperate.UpdateTestData();
                    menuOpenDatabase_Click(null, null);
                    NewTestData();
                    GlobalData.DataRowIndex = 0;
                }
                catch (Exception err)
                {
                    GlobalData.frmStatus.WriteLog("tBtnStopTest_Click: " + err.Message, false);
                }
            }
        }
Exemplo n.º 10
0
        public JsonResult RejectHouseOrder(RejectHouseOrder rejectHouseOrder)
        {
            var sql = "UPDATE houseOrdered SET orderStatus = 'reject', adminId = " + GetAdminId() +
                      " WHERE id = " + rejectHouseOrder.Id;

            return(Success(DataOperate.Update(sql)));
        }
Exemplo n.º 11
0
        /// <summary>
        /// 获取延期申请列表
        /// </summary>
        /// <param name="qc"></param>
        /// <returns></returns>
        public Result <List <Epm_PlanDelay> > GetPlanDelayList(QueryCondition qc)
        {
            Result <List <Epm_PlanDelay> > result = new Result <List <Epm_PlanDelay> >();

            try
            {
                AddDefaultWeb(qc);
                qc.PageInfo = new PageListInfo();

                if (!qc.SortList.Any())
                {
                    qc.SortList.Add(new SortExpression()
                    {
                        SortName = "ProjectId",
                        SortType = eSortType.Desc
                    });
                }

                result = DataOperate.QueryListSimple <Epm_PlanDelay>(context, qc);
            }
            catch (Exception ex)
            {
                result.Data         = null;
                result.Flag         = EResultFlag.Failure;
                result.Exception    = new ExceptionEx(ex, "");
                result.AllRowsCount = -1;
            }
            return(result);
        }
Exemplo n.º 12
0
        public bool DeleteOwnerToTenant(DeleteOwnerToTenant deleteOwnerToTenant)
        {
            var selSql = "select * from contract where userId=" + deleteOwnerToTenant.Id;

            string[] sqlT = new string[2];
            int      i    = 0;

            sqlT[i++] = "update house set houseStatus = 'unactivated' where userId=" + deleteOwnerToTenant.Id;
            sqlT[i]   = "update user SET type = 'tenant' where id= " + deleteOwnerToTenant.Id;
            DataSet allContract = DataOperate.FindAll(selSql);

            if (allContract.Tables.Count == 1 && allContract.Tables[0].Rows.Count == 0)
            {
                DataOperate.Update(sqlT[i]);
                return(true);
            }
            else if (GetContractBool(allContract))
            {
                return(DataOperate.ExecTransaction(sqlT));
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 13
0
        protected void xiugai_Click(object sender, EventArgs e)
        {
            if (txtPwd.Text.Length == 0)
            {
                Response.Write("<script lanuage=javascript>alert('密码不能为空!');</script>");
            }
            else
            {
                string      textpwd = CJ_DBOperater.CJ.PwdSecurity(txtPwd.Text.Trim());
                DataOperate dataopr = new DataOperate();
                //string sql="update tb_User set UserPwd=" + textpwd.ToString() + " where UserName="******"UserName"].ToString();

                string sql = string.Format("update tb_User set UserPwd='{0}' where UserName='******'", textpwd, Session["UserName"].ToString());
                if (dataopr.DataCom(sql))
                {
                    Session.Clear();
                    Response.Write("<script lanuage=javascript>alert('密码修改成功!'); location.href='../../../login.aspx' </script>");
                }
                else
                {
                    Session.Clear();
                    Response.Write("<script lanuage=javascript>alert('密码修改失败!');location.href='../../../login.aspx'</script>");
                }
            }
        }
Exemplo n.º 14
0
        public JsonResult SelfDescTags()
        {
            string sql = "select * from admin inner join selfDesc on admin.id = selfDesc.selfId where admin.id = " +
                         GetAdminId();

            return(Success(DataOperate.FindAll(sql)));
        }
Exemplo n.º 15
0
        private void 设置SToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            FormSet frmSet = new FormSet();

            frmSet.ShowDialog();
            DataOperate.UpdateConfigureData();   //在此更新考虑取消某些数据
        }
Exemplo n.º 16
0
        public JsonResult Register(AdminRegisterForm registerForm)
        {
            string MailCode   = registerForm.Code;
            string LicenseKey = registerForm.LicenseKey;
            string str        = HttpContext.Session.GetInt32("code").ToString();

            if (str == MailCode && LicenseKey == "fox072065yat")
            {
                string          sql = "insert into admin(email,pwd) values(@Email,@Pwd)";
                MySqlConnection con = DataOperate.GetCon();
                MySqlCommand    com = new MySqlCommand(sql, con);
                com = new MySqlCommand(sql, con);
                com.Parameters.Add(new MySqlParameter("@Email", MySqlDbType.VarChar, 16));
                com.Parameters["@Email"].Value = registerForm.Email;
                com.Parameters.Add(new MySqlParameter("@Pwd", MySqlDbType.VarChar, 32));
                com.Parameters["@Pwd"].Value = registerForm.Pwd;
                if (com.ExecuteNonQuery() > 0)
                {
                    con.Close();
                    return(Success("true"));
                }
                else
                {
                    con.Close();
                    return(Fail("注册失败,请重试..", 1004));
                }
            }
            else
            {
                return(Fail("验证码输入有误,请重试..", 1005));
            }
        }
Exemplo n.º 17
0
        protected void GridViewArticle_onRowCommand(object sender, GridViewCommandEventArgs e)
        {
            string      sql1     = "update tb_User set UserMark=UserMark-0 where UserName='******'";
            DataOperate dataoper = new DataOperate();

            if (dataoper.DataCom(sql1))
            {
                Response.Write("<script language=javascript>alert('下载成功!');</script>");
            }

            string   File         = Convert.ToString(e.CommandArgument);     //获取行号
            string   parentpath   = HttpContext.Current.Server.MapPath("/Attach/");
            string   FullFileName = parentpath + File;
            FileInfo DownloadFile = new FileInfo(FullFileName);

            Response.Clear();
            Response.ClearContent();
            Response.ClearHeaders();
            Response.Buffer      = false;
            Response.ContentType = "application/octet-stream";
            Response.AppendHeader("Content-Disposition", "attachment;filename=" + File);
            Response.AppendHeader("Content-Length", DownloadFile.Length.ToString());
            Response.AddHeader("Content-Transfer-Encoding", "binary");
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
            Response.WriteFile(DownloadFile.FullName);
            Response.Flush();
            Response.End();
        }
Exemplo n.º 18
0
        public void ProcessRequest(HttpContext context)
        {
            string file = context.Request.Params.Get("file");
            //string File = Convert.ToString(e.CommandArgument);   //获取行号

            //string sql1 = "update tb_User set UserMark=UserMark-10 where UserName='******'";
            DataOperate dataoper  = new DataOperate();
            string      sql2      = "update DownAttach set count=count+1 where filesavename='" + file + "'";
            DataOperate dataoper2 = new DataOperate();

            if (dataoper2.DataCom(sql2))
            {
                context.Session["Mark"] = (Convert.ToInt32(context.Session["Mark"]) - 0).ToString();
            }

            string   parentpath   = HttpContext.Current.Server.MapPath("/Attach/");
            string   FullFileName = parentpath + file;
            FileInfo DownloadFile = new FileInfo(FullFileName);

            FullFileName = file;
            context.Response.Clear();
            context.Response.ClearContent();
            context.Response.ClearHeaders();
            context.Response.Buffer      = false;
            context.Response.ContentType = "application/octet-stream";
            context.Response.AppendHeader("Content-Disposition", "attachment;filename=" + file);
            context.Response.AppendHeader("Content-Length", DownloadFile.Length.ToString());
            context.Response.AddHeader("Content-Transfer-Encoding", "binary");
            context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8");
            context.Response.WriteFile(DownloadFile.FullName);
            context.Response.Flush();
            context.Response.End();
        }
Exemplo n.º 19
0
 /// <summary>
 /// 记录日志
 /// </summary>
 /// <param name="operate"></param>
 /// <param name="result"></param>
 /// <param name="data"></param>
 private static void OperateLog(DataOperate operate, string data)
 {
     if (string.IsNullOrEmpty(data))
     {
         return;
     }
 }
Exemplo n.º 20
0
        public JsonResult PassHouseOrder(PassHouseOrder passHouseOrder)
        {
            var sql = "UPDATE houseOrdered SET orderStatus = 'done', adminId = " + GetAdminId() +
                      " WHERE id = " + passHouseOrder.Id;

            return(Success(DataOperate.Update(sql)));
        }
Exemplo n.º 21
0
        public JsonResult GetHouseListToTable(GetHouseListToTable getHouseListToTable)
        {
            var     selSql1  = "select * from house ";
            DataSet allHouse = DataOperate.FindAll(selSql1);


            string[] signed = { "activated", "empty" };
            // 检查房主合同状态 修改房源状态
            foreach (DataRow row in allHouse.Tables[0].Rows)
            {
                if (signed.Contains(row["rentStatus"].ToString()))
                {
                    var     selSql2          = "select * from contract where type='withOwner' and contractStatus = 'undue' and houseId=" + row["id"].ToString();
                    DataSet allHouseContract = DataOperate.FindAll(selSql2);
                    if (allHouseContract.Tables.Count == 1 && allHouseContract.Tables[0].Rows.Count == 0)
                    {
                        DataOperate.Update("update house set rentStatus='invalid' where id=" + row["id"]);
                    }
                }
            }

            var countSql = "select count(*) from house";
            var sql      = "select * from house";

            if (getHouseListToTable.Status.Length > 0)
            {
                countSql += " where rentStatus in ('" + string.Join("','", getHouseListToTable.Status) + "')";
                sql      += " where rentStatus in ('" + string.Join("','", getHouseListToTable.Status) + "')";
            }

            sql += " order by id desc limit " + (getHouseListToTable.PageNum - 1) * getHouseListToTable.PageSize + "," + getHouseListToTable.PageSize;

            return(Success(new { totalCount = DataOperate.Sele(countSql), data = DataOperate.FindAll(sql) }));
        }
 private void toolDeleteCTextBox_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("确定要删除吗?", "软件提示", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
     {
         if (ControlId != 0)  //旧的控件
         {
             CommClass   cc       = new CommClass();
             DataOperate dataOper = new DataOperate();
             try
             {
                 if (cc.IsExistConstraint("tb_BillTemplate", ControlId.ToString()))  //对应的子表tb_BillText已生成外键数据,先删除外键记录
                 {
                     if (MessageBox.Show("该输入框已生成快递单数据,若继续执行将删除与之相关的数据,是否继续执行?", "软件提示", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No)
                     {
                         return;  //停止执行
                     }
                 }
                 if (dataOper.ExecDataBySql("Delete From tb_BillTemplate Where ControlId = '" + ControlId + "'") == 0)  //从模板表中删除该控件对应的记录
                 {
                     MessageBox.Show("删除失败!", "软件提示");
                     return;
                 }
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message, "软件提示");
                 return;
             }
         }
         this.Dispose();
         MessageBox.Show("删除成功!", "软件提示");
     }
 }
Exemplo n.º 23
0
        public JsonResult RejectHouseCommission(RejectHouseCommission rejectHouseCommission)
        {
            var sql = "UPDATE house SET rentStatus = 'reject', adminId = " + GetAdminId() +
                      " WHERE id = " + rejectHouseCommission.Id;

            return(Success(DataOperate.Update(sql)));
        }
Exemplo n.º 24
0
        public JsonResult PassHouseCommission(PassHouseCommission passHouseCommission)
        {
            var sql = "UPDATE house SET rentStatus = 'unactivated', adminId = " + GetAdminId() +
                      " WHERE id = " + passHouseCommission.Id;

            return(Success(DataOperate.Update(sql)));
        }
Exemplo n.º 25
0
        public JsonResult GetContractListOfAdmin()
        {
            string sql = "select * from contract inner join house on house.id = contract.houseId inner join admin on admin.id = contract.adminId where admin.id=" +
                         GetAdminId() + " order by startAt desc";

            return(Success(DataOperate.FindAll(sql)));
        }
Exemplo n.º 26
0
        private void 当天记录CToolStripMenuItem_Click(object sender, EventArgs e)
        {
            fg.FinishEditing(true);
            string Database;

            Database = Application.StartupPath + @"\DataBase\" + "SDAF" + DateTime.Now.Year.ToString() + ".mdb";
            if (!File.Exists(Database))
            {
                return;
            }

            DataOperate.CurrentDataBase = DateTime.Now.Year;
            CurDb.Text = Properties.Resources.CurrentDatabase + DataOperate.CurrentDataBase.ToString() + Properties.Resources.Year;

            DataOperate.FindDayData();
            for (int i = 0; i < 数据库ToolStripMenuItem.DropDownItems.Count; i++)
            {
                ToolStripMenuItem Chk_Tp = (ToolStripMenuItem)数据库ToolStripMenuItem.DropDownItems[i];
                if ((int)Chk_Tp.Tag == DataOperate.CurrentDataBase)
                {
                    Chk_Tp.Checked = true;
                }
                else
                {
                    Chk_Tp.Checked = false;
                }
            }
        }
Exemplo n.º 27
0
        public void connetion()//综合交流
        {
            DataOperate dataoper = new DataOperate();
            string      sqlconn  = "select top 6 * from ModuleInfo_View where ModuleID=34 order by CardDate desc";

            dataoper.dataBind(DatalistConn, sqlconn);
        }
Exemplo n.º 28
0
 private void MyTable_RowChanged(object sender, DataRowChangeEventArgs e)
 {
     if (beModifed && e.Row.RowState == DataRowState.Modified)
     {
         beModifed = false;
         DataOperate.UpdateTestData();
     }
 }
Exemplo n.º 29
0
        public JsonResult ApplyHouseRenewal(ApplyRenewal applyRenewal)
        {
            var sql = "insert into renewalContractApply(contractId,type,houseId,userId) values(" +
                      applyRenewal.ContractId + ",'" + applyRenewal.Type + "'," + applyRenewal.HouseId + "," +
                      GetUserId() + ")";

            return(Success(DataOperate.Create(sql)));
        }
Exemplo n.º 30
0
        public JsonResult GetHouseListOfAdmin()
        {
            string sql =
                "select * from house inner join contract on house.id = contract.houseId where contract.type = 'withOwner' and contract.adminId=" +
                GetAdminId();

            return(Success(DataOperate.FindAll(sql)));
        }