protected void Page_Show(object sender, EventArgs e)
        {
            Utility.buildListBox(ddl_Type.Items, "select typeID,Name from bm_PlaceType order by 1", "typeID", "Name", null, "");

            if (p_theID.Value.Length > 0)
            {
                string sWhere = "";

                sWhere += "ID=" + CCUtility.ToSQL(p_theID.Value, FieldTypes.Number);

                string         sSQL      = "select * from AreaKK where " + sWhere;
                SqlDataAdapter dsCommand = new SqlDataAdapter(sSQL, Utility.Connection);
                DataSet        ds        = new DataSet();
                DataRow        row;

                if (dsCommand.Fill(ds, 0, 1, "Table") > 0)
                {
                    row         = ds.Tables[0].Rows[0];
                    theID.Value = CCUtility.GetValue(row, "ID");
                    System.Web.UI.WebControls.TextBox[] tempBox = { btName, btAllName, btNote, btP1, btP2, btPhone, btMemo };
                    for (int i = 0; i < 7; i++)
                    {
                        tempBox[i].Text = row[i + 1].ToString();
                    }
                    //类型
                    string s = CCUtility.GetValue(row, "typeID");
                    try
                    {
                        ddl_Type.SelectedIndex = ddl_Type.Items.IndexOf(ddl_Type.Items.FindByValue(s));
                    }
                    catch { }
                }
            }
        }
        private void Back()
        {
            string sURL = sFormAction +
                          "paID=" + CCUtility.ToSQL(paID.Value, FieldTypes.Number);

            Response.Redirect(sURL);
        }
Пример #3
0
        protected void Page_Show(object sender, EventArgs e)
        {
            if (p_theID.Value.Length > 0)
            {
                string sWhere = "";

                sWhere += "ID=" + CCUtility.ToSQL(p_theID.Value, FieldTypes.Number);

                string         sSQL      = "select * from Area where " + sWhere;
                SqlDataAdapter dsCommand = new SqlDataAdapter(sSQL, Utility.Connection);
                DataSet        ds        = new DataSet();
                DataRow        row;

                if (dsCommand.Fill(ds, 0, 1, "Table") > 0)
                {
                    row         = ds.Tables[0].Rows[0];
                    theID.Value = CCUtility.GetValue(row, "ID");
                    System.Web.UI.WebControls.TextBox[] tempBox = { TextBox1,  TextBox2,  TextBox3,  TextBox4,  TextBox5,  TextBox6,
                                                                    TextBox7,  TextBox8,  TextBox9,  TextBox10, TextBox11, TextBox12,
                                                                    TextBox13, TextBox14, TextBox15, TextBox16, TextBox17, TextBox18 };
                    for (int i = 0; i < 18; i++)
                    {
                        tempBox[i].Text = row[i + 1].ToString();
                    }
                }
            }
        }
Пример #4
0
        protected void Page_Show(object sender, EventArgs e)
        {
            if (p_theID.Value.Length > 0)
            {
                string sWhere = "";

                sWhere += "ID=" + CCUtility.ToSQL(p_theID.Value, FieldTypes.Number);

                string         sSQL      = "select * from Carbarn where " + sWhere;
                SqlDataAdapter dsCommand = new SqlDataAdapter(sSQL, Utility.Connection);
                DataSet        ds        = new DataSet();
                DataRow        row;

                if (dsCommand.Fill(ds, 0, 1, "Table") > 0)
                {
                    row           = ds.Tables[0].Rows[0];
                    theID.Value   = CCUtility.GetValue(row, "ID");
                    tbNO.Text     = CCUtility.GetValue(row, "theNO");
                    tbCarNO.Text  = CCUtility.GetValue(row, "carNO");
                    tbType.Text   = CCUtility.GetValue(row, "carType");
                    tbArea.Text   = CCUtility.GetValue(row, "area");
                    tbPlace.Text  = CCUtility.GetValue(row, "Place");
                    tbMaster.Text = CCUtility.GetValue(row, "Master");
                    tbMemo.Text   = CCUtility.GetValue(row, "Memo");
                }
            }
        }
Пример #5
0
        protected void Page_Show(object sender, EventArgs e)
        {
            Utility.buildListBox(ddl_Level.Items, "select ID,Name from bm_sLevel", "ID", "Name", null, "");
            if (p_theID.Value.Length > 0)
            {
                string sWhere = "";

                sWhere += "member_id=" + CCUtility.ToSQL(p_theID.Value, FieldTypes.Number);

                string         sSQL      = "select * from Members where " + sWhere;
                SqlDataAdapter dsCommand = new SqlDataAdapter(sSQL, Utility.Connection);
                DataSet        ds        = new DataSet();
                DataRow        row;

                if (dsCommand.Fill(ds, 0, 1, "Table") > 0)
                {
                    row             = ds.Tables[0].Rows[0];
                    tbLogin.Text    = CCUtility.GetValue(row, "member_login");
                    tbPassWord.Text = CCUtility.GetValue(row, "member_password");
                    tbName.Text     = CCUtility.GetValue(row, "name");
                    tbMemo.Text     = CCUtility.GetValue(row, "Memo");
                    string s = CCUtility.GetValue(row, "security_level_id");
                    try
                    {
                        ddl_Level.SelectedIndex = ddl_Level.Items.IndexOf(ddl_Level.Items.FindByValue(s));
                    }
                    catch {}
                }
            }
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            // 在此处放置用户代码以初始化页面
            Utility = new CCUtility(this);
            //===============================
            // Login Open Event begin
            // Login Open Event end
            //===============================

            //===============================
            // Login OpenAnyPage Event begin
            // Login OpenAnyPage Event end
            //===============================
            //
            //===============================
            // Login PageSecurity begin
            // Login PageSecurity end
            //===============================
            if (Session["UserID"] != null && Int16.Parse(Session["UserID"].ToString()) > 0)
            {
                Login_logged = true;
            }

            if (!IsPostBack)
            {
                Page_Show(sender, e);
            }
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            // 在此处放置用户代码以初始化页面
            Utility = new CCUtility(this);

            if (!IsPostBack)
            {
                BindDataGrid();
            }
        }
Пример #8
0
 private void Page_Load(object sender, System.EventArgs e)
 {
     // 在此处放置用户代码以初始化页面
     Utility = new CCUtility(this);
     Utility.CheckSecurity(2);
     if (!IsPostBack)
     {
         p_theID.Value = Utility.GetParam("ID");
         Page_Show(sender, e);
     }
 }
        void Page_Show(object sender, System.EventArgs e)
        {
            // EditMeter Show begin
            Utility.buildListBox(ddl_Pavilion.Items, "select paID,Name from pavilion order by 1", "paID", "Name", null, "");
            //string cSQL="select hoID,hoRoom from House where paID="+CCUtility.ToSQL(Utility.GetParam("ddl_Pavilion"), FieldTypes.Number) ;

            if (p_theID.Value.Length == 0)
            {
                string ssSQL = "select hoID,hoRoom from House where paID=" + Utility.GetParam("paID");
                Utility.buildListBox(ddl_House.Items, ssSQL, "hoID", "hoRoom", null, "");
            }

            if (p_theID.Value.Length > 0)
            {
                string sWhere = "";

                sWhere += "ID=" + CCUtility.ToSQL(p_theID.Value, FieldTypes.Number);

                // EditMeter Open Event begin
                // EditMeter Open Event end
                string         sSQL      = "select * from Phone where " + sWhere;
                SqlDataAdapter dsCommand = new SqlDataAdapter(sSQL, Utility.Connection);
                DataSet        ds        = new DataSet();
                DataRow        row;

                if (dsCommand.Fill(ds, 0, 1, "EditMeter") > 0)
                {
                    row = ds.Tables[0].Rows[0];

                    theID.Value  = CCUtility.GetValue(row, "ID");
                    paID.Value   = CCUtility.GetValue(row, "paID");
                    tbPhone.Text = CCUtility.GetValue(row, "phone");                    //电话
                    tb_Memo.Text = CCUtility.GetValue(row, "memo");                     //注解

                    string s;
                    s = CCUtility.GetValue(row, "paID");                  //楼宇
                    try
                    {
                        ddl_Pavilion.SelectedIndex = ddl_Pavilion.Items.IndexOf(ddl_Pavilion.Items.FindByValue(s));
                    }
                    catch {}

                    sSQL = "select hoID,hoRoom from House where paID=" + s;
                    Utility.buildListBox(ddl_House.Items, sSQL, "hoID", "hoRoom", null, "");
                    s = CCUtility.GetValue(row, "hoID");                  //房间号
                    try
                    {
                        ddl_House.SelectedIndex = ddl_House.Items.IndexOf(ddl_House.Items.FindByValue(s));
                    }
                    catch {}
                }
            }
            ddl_Pavilion.Enabled = false;
        }
        protected void Page_Show(object sender, EventArgs e)
        {
            if (p_theID.Value.Length > 0)
            {
                string sWhere = "";

                sWhere += "bianhao='" + CCUtility.ToSQL(p_theID.Value, FieldTypes.Number) + "'";

                string        sSQL = "select * from zhuhu where " + sWhere;
                SqlCommand    cmd  = new SqlCommand(sSQL, Utility.Connection);
                SqlDataReader rdr  = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    TextBox1.Text = rdr["bianhao"].ToString().Trim();
                    TextBox2.Text = rdr["xingming"].ToString().Trim();
                    if (rdr["xingbie"].ToString().Trim() == "男")
                    {
                        DropDownList1.SelectedIndex = 0;
                    }
                    else
                    {
                        DropDownList1.SelectedIndex = 1;
                    }
                    TextBox4.Text = rdr["shenfenzhenghao"].ToString().Trim();
                    TextBox5.Text = rdr["danwei"].ToString().Trim();
                    TextBox6.Text = rdr["dianhua"].ToString().Trim();
                    TextBox7.Text = rdr["shouji"].ToString().Trim();
                    TextBox8.Text = rdr["youjian"].ToString().Trim();
                    TextBox9.Text = rdr["jianlizhe"].ToString().Trim();
                    string   strURL    = rdr["zhaopian"].ToString().Trim();
                    char[]   separator = { '\\' };
                    string[] arrayYMD  = strURL.Split(separator, 3);
                    TextBox10.Text = arrayYMD[1];
                    TextBox11.Text = rdr["leixing"].ToString().Trim();
                    if (rdr["shifouruzhu"].ToString().Trim() == "是")
                    {
                        DropDownList2.SelectedIndex = 1;
                    }
                    else
                    {
                        DropDownList2.SelectedIndex = 0;
                    }
                }
            }
        }
        protected void Page_Show(object sender, EventArgs e)
        {
            Utility.buildListBox(ddlType.Items, "select typeID,Name from bm_PavilionType", "typeID", "Name", null, "");
            Utility.buildListBox(ddlSunny.Items, "select ID,Name from bm_Sunny", "ID", "Name", null, "");

            if (p_theID.Value.Length > 0)
            {
                string sWhere = "";

                sWhere += "paID=" + CCUtility.ToSQL(p_theID.Value, FieldTypes.Number);

                string         sSQL      = "select * from Pavilion where " + sWhere;
                SqlDataAdapter dsCommand = new SqlDataAdapter(sSQL, Utility.Connection);
                DataSet        ds        = new DataSet();
                DataRow        row;

                if (dsCommand.Fill(ds, 0, 1, "Table") > 0)
                {
                    row         = ds.Tables[0].Rows[0];
                    theID.Value = CCUtility.GetValue(row, "paID");
                    //System.Web.UI.WebControls.TextBox[] tempBox={tbName,tb,btNote,btP1,btP2,btPhone,btMemo};
                    tbName.Text      = CCUtility.GetValue(row, "Name");
                    tbHigh.Text      = CCUtility.GetValue(row, "High");
                    tbArea.Text      = CCUtility.GetValue(row, "Area");
                    tbLayer.Text     = CCUtility.GetValue(row, "Layer");
                    tbBuildDate.Text = CCUtility.GetValue(row, "BuildDate");
                    tbMemo.Text      = CCUtility.GetValue(row, "Memo");
                    //类型
                    string s = CCUtility.GetValue(row, "typeID");
                    try
                    {
                        ddlType.SelectedIndex = ddlType.Items.IndexOf(ddlType.Items.FindByValue(s));
                    }
                    catch {}
                    //朝向
                    s = CCUtility.GetValue(row, "sunnyID");
                    try
                    {
                        ddlSunny.SelectedIndex = ddlSunny.Items.IndexOf(ddlSunny.Items.FindByValue(s));
                    }
                    catch {}
                }
            }
        }
Пример #12
0
        private void bt_Add_Click(object sender, System.EventArgs e)
        {
            getData();
            string sSQL = "insert  into " + sTable + " (" + f2 + ")" +
                          " values(" + CCUtility.ToSQL(Utility.GetParam("tbName"), FieldTypes.Text) + ")";

            SqlCommand cmd = new SqlCommand(sSQL, Utility.Connection);

            try
            {
                cmd.ExecuteNonQuery();
            }
            catch (Exception E)
            {
                throw new Exception(E.Message);
            }

            BindGrid();
        }
Пример #13
0
        private void bt_Save_Click(object sender, System.EventArgs e)
        {
            string sSQL   = "";
            string sWhere = "";

            if (p_theID.Value.Length > 0)
            {
                sWhere = " where ID=" + CCUtility.ToSQL(p_theID.Value, FieldTypes.Number);
                sSQL   = @" UPDATE Area SET Name='{0}',[fuzeren]='{1}',[jianchengdate]='{2}',[lianxiren]='{3}',[lianxitel]='{4}',[yidongtel]='{5}',[zhandiarea]='{6}'
      ,[daoluarea]='{7}',[dcheweiarea]='{8}',[jianzhuarea]='{9}',[gaocengnum]='{10}',[chekuarea]='{11}',[gonggarea]='{12}'
      ,[duocengnum]='{13}',[cheweinum]='{14}',[luhuaarea]='{15}',[weizhi]='{16}',[beizhu]='{17}' ";
                sSQL   = string.Format(sSQL, TextBox1.Text.Trim(), TextBox2.Text.Trim(), TextBox3.Text.Trim(), TextBox4.Text.Trim(),
                                       TextBox5.Text.Trim(), TextBox6.Text.Trim(), TextBox7.Text.Trim(), TextBox8.Text.Trim(), TextBox9.Text.Trim(),
                                       TextBox10.Text.Trim(), TextBox11.Text.Trim(), TextBox12.Text.Trim(), TextBox13.Text.Trim(), TextBox14.Text.Trim(),
                                       TextBox15.Text.Trim(), TextBox16.Text.Trim(), TextBox17.Text.Trim(), TextBox18.Text.Trim());
                sSQL += sWhere;
            }
            else
            {
                sSQL = @"INSERT INTO Area (Name,[fuzeren],[jianchengdate],[lianxiren],[lianxitel],[yidongtel],[zhandiarea]
      ,[daoluarea],[dcheweiarea],[jianzhuarea],[gaocengnum],[chekuarea],[gonggarea]
      ,[duocengnum],[cheweinum],[luhuaarea],[weizhi],[beizhu])
VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}'); ";

                sSQL = string.Format(sSQL, TextBox1.Text.Trim(), TextBox2.Text.Trim(), TextBox3.Text.Trim(), TextBox4.Text.Trim(),
                                     TextBox5.Text.Trim(), TextBox6.Text.Trim(), TextBox7.Text.Trim(), TextBox8.Text.Trim(), TextBox9.Text.Trim(),
                                     TextBox10.Text.Trim(), TextBox11.Text.Trim(), TextBox12.Text.Trim(), TextBox13.Text.Trim(), TextBox14.Text.Trim(),
                                     TextBox15.Text.Trim(), TextBox16.Text.Trim(), TextBox17.Text.Trim(), TextBox18.Text.Trim());
            }

            SqlCommand cmd = new SqlCommand(sSQL, Utility.Connection);

            try
            {
                cmd.ExecuteNonQuery();
            }
            catch (Exception E)
            {
                ShowErrMsg(E.Message);
            }
            Response.Redirect("XQKK.aspx");
        }
Пример #14
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // 在此处放置用户代码以初始化页面
            Utility = new CCUtility(this);

            if (!IsPostBack)
            {
                theID.Value = Utility.GetParam("ID");
                InitDropDownList();

                if (theID.Value.Trim() != "")
                {
                    strSQL = "select * from shebei_mingxi where id=' " + theID.Value.Trim() + " '";
                    tb     = Utility.ExecuteSql4Ds(strSQL).Tables[0];
                    if (tb.Rows.Count > 0)
                    {
                        ControlDataBind();
                    }
                }
            }
        }
Пример #15
0
        //protected String[] members_security_level_id_lov = "0;New;1;Member;3;Admin".Split(new Char[] {';'});

        private void Page_Load(object sender, System.EventArgs e)
        {
            // 在此处放置用户代码以初始化页面
            Utility = new CCUtility(this);
            // PageSecurity begin
            Utility.CheckSecurity(2);
            // PageSecurity end
            if (!(this.IsPostBack))
            {
                try
                {
                    ViewState["Sort"] = "";
                    ViewState["Page"] = "0";
                    Page_Show(sender, e);
                }
                catch (Exception er)
                {
                    ShowErrMsg(er.Message);
                }
                ErrorMsg.Visible = false;
            }
        }
Пример #16
0
        private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            string sSQL, sWhere;
            int    index = e.Item.ItemIndex;
            string clID  = DataGrid1.Items[index].Cells[1].Text;
            string sName = ((TextBox)e.Item.Cells[2].Controls[0]).Text;

            sName.Trim();
            getData();

            sSQL = "update " + sTable + " set " + f2 + "=" + CCUtility.ToSQL(sName);

            sWhere = " where  " + f1 + "=" + clID;
            sSQL  += sWhere;

            SqlCommand cmd = new SqlCommand(sSQL, Utility.Connection);

            try { cmd.ExecuteNonQuery(); }
            catch (Exception E) { ShowErrMsg(E.Message); }
            DataGrid1.EditItemIndex = -1;
            BindGrid();
        }
        private void btSave_Click(object sender, System.EventArgs e)
        {
            string sSQL = "";
            string sWhere = "", sExist;
            string p2_paID  = CCUtility.ToSQL(paID.Value, FieldTypes.Number);
            string p2_Room  = CCUtility.ToSQL(Utility.GetParam("tbRoom"), FieldTypes.Text);
            string p2_Area  = CCUtility.ToSQL(Utility.GetParam("tbArea"), FieldTypes.Text);
            string p2_Area2 = CCUtility.ToSQL(Utility.GetParam("tbArea2"), FieldTypes.Text);
            string p2_Layer = CCUtility.ToSQL(Utility.GetParam("tbLayer"), FieldTypes.Text);
            string p2_Cell  = CCUtility.ToSQL(Utility.GetParam("ddlCell"), FieldTypes.Number);
            string p2_Type  = CCUtility.ToSQL(Utility.GetParam("ddlTYpe"), FieldTypes.Number);
            string p2_Sunny = CCUtility.ToSQL(Utility.GetParam("ddlSunny"), FieldTypes.Number);
            string p2_Memo  = CCUtility.ToSQL(Utility.GetParam("tbMemo"), FieldTypes.Text);

            string p2_ClientName = CCUtility.ToSQL(Utility.GetParam("tbClientName"), FieldTypes.Text);
            string p2_ClientID   = CCUtility.ToSQL(Utility.GetParam("tbClientID"), FieldTypes.Text);
            string p2_UseDate    = CCUtility.ToSQL(Utility.GetParam("tbUseDate"), FieldTypes.Text);
            string p2_Phone      = CCUtility.ToSQL(Utility.GetParam("tbPhone"), FieldTypes.Text);
            string p2_ClientCard = CCUtility.ToSQL(Utility.GetParam("tbClientCard"), FieldTypes.Text);
            string p2_Unit       = CCUtility.ToSQL(Utility.GetParam("tbUnit"), FieldTypes.Text);



            if (tbRoom.Text.Trim() == "")
            {
                ShowErrMsg("请输入房间名称");
                return;
            }

            if (tbPaName.Text.Trim() == "")
            {
                ShowErrMsg("请输入楼宇名称");
                return;
            }

            if (p_theID.Value.Length == 0) //插入查询
            {
                sExist = "hoRoom=" + CCUtility.ToSQL(Utility.GetParam("tbRoom"), FieldTypes.Text) +
                         " and paID<>" + p2_paID;

                int iCount = Utility.DlookupInt("House", "count(*)", sExist);
                if (iCount != 0)
                {
                    ShowErrMsg(sErrMsg);
                    return;
                }

                sSQL = "insert into House ( " +
                       "paID," +
                       "hoRoom," +
                       "hoFloor," +
                       "hoArchArce," +
                       "hoUseArce," +
                       "cellID," +
                       "sunnyId," +
                       "indoorID," +
                       "Memo," +
                       "CLIENT_NAME," +
                       "CLIENT_CARD," +
                       "CLIENT_ACCOUNT_NUMBER," +
                       "COMPANY_NAME," +
                       "CLIENT_PHONE," +
                       "USE_DATE) " +
                       " values(" +
                       p2_paID + "," +
                       p2_Room + "," +
                       p2_Layer + "," +
                       p2_Area + "," +
                       p2_Area2 + "," +
                       p2_Cell + "," +
                       p2_Sunny + "," +
                       p2_Type + "," +
                       p2_Memo + "," +
                       p2_ClientName + "," +
                       p2_ClientID + "," +
                       p2_ClientCard + "," +
                       p2_Unit + "," +
                       p2_Phone + "," +
                       p2_UseDate + ")";
            }
            else
            {
                //查看房间是否已经存在A
                sExist = "hoRoom=" + CCUtility.ToSQL(Utility.GetParam("tbRoom"), FieldTypes.Text) +
                         " and paID<>" + p2_paID +
                         " and hoID<>" + CCUtility.ToSQL(p_theID.Value, FieldTypes.Number);
                int iCount = Utility.DlookupInt("House", "count(*)", sExist);
                if (iCount != 0)
                {
                    ShowErrMsg(sErrMsg);
                    return;
                }

                sWhere = " hoID=" + CCUtility.ToSQL(p_theID.Value, FieldTypes.Number);

                sSQL = " update House set " +
                       "[hoRoom]=" + p2_Room +
                       ",[hoFloor]=" + p2_Layer +
                       ",[hoArchArce]=" + p2_Area +
                       ",[hoUseArce]=" + p2_Area2 +
                       ",[cellID]=" + p2_Cell +
                       ",[sunnyId]=" + p2_Sunny +
                       ",[IndoorID]=" + p2_Type +
                       ",[Memo]=" + p2_Memo +
                       ",[Client_Name]=" + p2_ClientName +
                       ",[CLIENT_CARD]=" + p2_ClientID +
                       ",[CLIENT_ACCOUNT_NUMBER]=" + p2_ClientCard +
                       ",[COMPANY_NAME]=" + p2_Unit +
                       ",[CLIENT_PHONE]=" + p2_Phone +
                       ",[USE_DATE]=" + p2_UseDate;

                sSQL += " where " + sWhere;
            }
            SqlCommand cmd = new SqlCommand(sSQL, Utility.Connection);

            try
            {
                cmd.ExecuteNonQuery();
            }
            catch (Exception E)
            {
                ShowErrMsg(E.Message);
                return;
            }

            Back();//Response.Redirect(sFormAction);
        }
Пример #18
0
        private void btSave_Click(object sender, System.EventArgs e)
        {
            string sSQL = "";
            string sWhere = "", sExist;

            string p2_Login    = CCUtility.ToSQL(Utility.GetParam("tbLogin"), FieldTypes.Text);
            string p2_PassWord = CCUtility.ToSQL(Utility.GetParam("tbPassWord"), FieldTypes.Text);
            string p2_Name     = CCUtility.ToSQL(Utility.GetParam("tbName"), FieldTypes.Text);
            string p2_Level    = CCUtility.ToSQL(Utility.GetParam("ddl_Level"), FieldTypes.Number);
            string p2_Memo     = CCUtility.ToSQL(Utility.GetParam("tbMemo"), FieldTypes.Text);

            if (tbLogin.Text.Trim() == "")
            {
                ShowErrMsg("请输入登陆名.");
                return;
            }


            if (p_theID.Value.Length == 0)             //插入查询
            {
                sExist = "member_login="******"tbLogin"), FieldTypes.Text);

                int iCount = Utility.DlookupInt("Members", "count(*)", sExist);
                if (iCount != 0)
                {
                    ShowErrMsg(sErrMsg);
                    return;
                }

                sSQL = "insert into Members ( " +
                       "name," +
                       "member_login," +
                       "member_password," +
                       "security_level_id," +
                       "Memo) " +
                       " values(" +
                       p2_Name + "," +
                       p2_Login + "," +
                       p2_PassWord + "," +
                       p2_Level + "," +

                       p2_Memo + ")";
            }
            else
            {
                //查看车位是否已经存在
                sExist = "member_login="******"tbLogin"), FieldTypes.Text) +
                         " and member_id<>" + CCUtility.ToSQL(p_theID.Value, FieldTypes.Number);

                int iCount = Utility.DlookupInt("Members", "count(*)", sExist);
                if (iCount != 0)
                {
                    ShowErrMsg(sErrMsg);
                    return;
                }

                sWhere = " member_id=" + CCUtility.ToSQL(p_theID.Value, FieldTypes.Number);

                sSQL = " update members set " +
                       "[name]=" + p2_Name +
                       ",[member_login]=" + p2_Login +
                       ",[member_password]=" + p2_PassWord +
                       ",[security_level_id]=" + p2_Level +
                       ",[Memo]=" + p2_Memo;


                sSQL += " where " + sWhere;
            }
            SqlCommand cmd = new SqlCommand(sSQL, Utility.Connection);

            try
            {
                cmd.ExecuteNonQuery();
            }
            catch (Exception E)
            {
                ShowErrMsg(E.Message);
                return;
            }

            Back();            //Response.Redirect(sFormAction);
        }
        private void Login_login_Click(object sender, System.EventArgs e)
        {
            if (Login_logged)
            {
                // Login Logout begin

                // Login OnLogout Event begin
                // Login OnLogout Event end
                Login_logged          = false;
                Session["UserID"]     = 0;
                Session["UserRights"] = 0;
                Login_Show();
                // Login Logout end
            }
            else
            {
                // Login Login begin
                int iPassed = Convert.ToInt32(Utility.Dlookup("members", "count(*)", "member_login ='******' and member_password='******'"));
                if (iPassed > 0)
                {
                    // Login OnLogin Event begin
                    // Login OnLogin Event end
                    //Login_message.Visible = false;
                    Session["UserID"] = Convert.ToInt32(Utility.Dlookup("members", "member_id", "member_login ='******' and member_password='******'"));
                    Login_logged      = true;

                    Session["UserRights"] = Convert.ToInt32(Utility.Dlookup("members", "security_level_id", "member_login ='******' and member_password='******'"));

                    string sQueryString = Utility.GetParam("querystring");
                    string sPage        = Utility.GetParam("ret_page");
                    if (!sPage.Equals(Request.ServerVariables["SCRIPT_NAME"]) && sPage.Length > 0)
                    {
                        Response.Redirect(sPage + "?" + sQueryString);
                    }
                    else
                    {
                        Response.Redirect(Login_FormAction);
                    }
                }
                else
                {
                    //Login_message.Visible = true;
                }
                // Login Login end
            }
        }
Пример #20
0
        private void GridBind()
        {
            string sWhere   = "";
            bool   HasParam = false;

            //-------------------------------
            // Build WHERE statement
            //-------------------------------
            System.Collections.Specialized.StringDictionary Params = new System.Collections.Specialized.StringDictionary();

            if (!Params.ContainsKey("paID"))
            {
                string temp = Utility.GetParam("paID");
                if (Utility.IsNumeric(null, temp) && temp.Length > 0)
                {
                    temp = CCUtility.ToSQL(temp, FieldTypes.Number);
                }
                else
                {
                    temp = "";
                }
                Params.Add("paID", temp);
            }

            if (!Params.ContainsKey("search"))
            {
                string temp = Utility.GetParam("search");
                Params.Add("search", temp);
            }

            if (Params["paID"].Length > 0)
            {
                HasParam = true;
                sWhere  += "H.[paID]=" + Params["paID"];
            }

            if (Params["search"].Length > 0)
            {
                if (sWhere.Length > 0)
                {
                    sWhere += " and ";
                }
                HasParam = true;
                sWhere  += "H.[hoRoom] like '%" + Params["search"].Replace("'", "''") + "%'";
            }

            if (HasParam)
            {
                sWhere = " WHERE (" + sWhere + ")";
            }

            DataView MyDv;

            String  strsql;
            DataSet myDs;

            strsql = "select [h].[hoID] as ID," +
                     "[h].*," +
                     "[I].[Name] as IndoorName," +
                     "[c].[Name] as CellName," +
                     "[s].[Name] as sunnyName " +
                     " from ((([House] h inner join [bm_Indoor] I on [h].[indoorID]=[I].[ID]) " +
                     " inner join [bm_cell] c on [h].[cellID]=[c].[ID])" +
                     " inner join [bm_Sunny] s on [h].[sunnyID]=[s].[ID])";
            //strsql="select top 10 meterReading.mrID,meterReading.mrYear from MeterReading order by sales DESC";
            if (!HasParam)
            {
                sWhere = " where hoID=-1";
            }
            strsql += sWhere;
            myDs    = Utility.ExecuteSql4Ds(strsql);
            MyDv    = myDs.Tables[0].DefaultView;

            if (!object.Equals(ViewState["Sort"], null))
            {
                MyDv.Sort = ViewState["Sort"].ToString();
            }
            DataGrid1.DataSource = MyDv;
            if (!object.Equals(ViewState["Page"], null))
            {
                DataGrid1.CurrentPageIndex = int.Parse(ViewState["Page"].ToString());
            }
            try
            {
                DataGrid1.DataBind();
            }
            catch
            {
                DataGrid1.CurrentPageIndex = DataGrid1.PageCount - 1;
                DataGrid1.DataBind();
            }
        }
Пример #21
0
        private void btSave_Click(object sender, System.EventArgs e)
        {
            string sSQL = "";
            string sWhere = "", sExist;

            string p2_NO     = CCUtility.ToSQL(Utility.GetParam("tbNO"), FieldTypes.Text);
            string p2_CarNO  = CCUtility.ToSQL(Utility.GetParam("tbCarNO"), FieldTypes.Text);
            string p2_Type   = CCUtility.ToSQL(Utility.GetParam("tbType"), FieldTypes.Text);
            string p2_Area   = CCUtility.ToSQL(Utility.GetParam("tbArea"), FieldTypes.Text);
            string p2_Place  = CCUtility.ToSQL(Utility.GetParam("tbPlace"), FieldTypes.Text);
            string p2_Master = CCUtility.ToSQL(Utility.GetParam("tbMaster"), FieldTypes.Text);
            string p2_Memo   = CCUtility.ToSQL(Utility.GetParam("tbMemo"), FieldTypes.Text);

            if (tbNO.Text.Trim() == "")
            {
                ShowErrMsg("请输入车位号.");
                return;
            }


            if (p_theID.Value.Length == 0)             //插入查询
            {
                sExist = "theNO=" + CCUtility.ToSQL(Utility.GetParam("tbNO"), FieldTypes.Text);

                int iCount = Utility.DlookupInt("CarBarn", "count(*)", sExist);
                if (iCount != 0)
                {
                    ShowErrMsg(sErrMsg);
                    return;
                }

                sSQL = "insert into Carbarn ( " +
                       "theNO," +
                       "carNO," +
                       "carType," +
                       "Area," +
                       "Place," +
                       "Master," +
                       "Memo) " +
                       " values(" +
                       p2_NO + "," +
                       p2_CarNO + "," +
                       p2_Type + "," +
                       p2_Area + "," +
                       p2_Place + "," +
                       p2_Master + "," +
                       p2_Memo + ")";
            }
            else
            {
                //查看车位是否已经存在
                sExist = "theNO=" + CCUtility.ToSQL(Utility.GetParam("tbNO"), FieldTypes.Text) +
                         " and ID<>" + CCUtility.ToSQL(p_theID.Value, FieldTypes.Number);

                int iCount = Utility.DlookupInt("Carbarn", "count(*)", sExist);
                if (iCount != 0)
                {
                    ShowErrMsg(sErrMsg);
                    return;
                }

                sWhere = " ID=" + CCUtility.ToSQL(p_theID.Value, FieldTypes.Number);

                sSQL = " update carbarn set " +
                       "[theNO]=" + p2_NO +
                       ",[carNO]=" + p2_CarNO +
                       ",[carType]=" + p2_Type +
                       ",[Area]=" + p2_Area +
                       ",[Place]=" + p2_Place +
                       ",[Master]=" + p2_Master +
                       ",[Memo]=" + p2_Memo;


                sSQL += " where " + sWhere;
            }
            SqlCommand cmd = new SqlCommand(sSQL, Utility.Connection);

            try
            {
                cmd.ExecuteNonQuery();
            }
            catch (Exception E)
            {
                ShowErrMsg(E.Message);
                return;
            }

            Back();            //Response.Redirect(sFormAction);
        }
        private void btSave_Click(object sender, System.EventArgs e)
        {
            string sSQL = "";
            // EditMeter Check Event begin
            bool bResult = EditMeter_Validate();

            // EditMeter Check Event end
            if (!bResult)
            {
                return;
            }

            string p2_Pavilion = CCUtility.ToSQL(paID.Value, FieldTypes.Number);
            string p2_House    = CCUtility.ToSQL(Utility.GetParam("ddl_House"), FieldTypes.Number);
            string p2_Phone    = CCUtility.ToSQL(Utility.GetParam("tbPhone"), FieldTypes.Text);
            string p2_Memo     = CCUtility.ToSQL(Utility.GetParam("tb_Memo"), FieldTypes.Text);

            if (tbPhone.Text == "")
            {
                ShowErrMsg("请输入电话号码");
                return;
            }

            if (p_theID.Value.Length == 0)
            {
                sSQL = "phone=" + p2_Phone;
                int iCount = Utility.DlookupInt("Phone", "count(*)", sSQL);
                if (iCount != 0)
                {
                    ShowErrMsg("该电话已经存在!");
                    return;
                }

                sSQL = "insert into Phone (" +
                       "paID," +
                       "hoID," +
                       "phone," +
                       "Memo)" +
                       " values (" +
                       p2_Pavilion + "," +
                       p2_House + "," +
                       p2_Phone + "," +
                       p2_Memo + ")";
            }
            else
            {
                string sExist;
                sExist = "phone=" + p2_Phone + " and id<>" + CCUtility.ToSQL(p_theID.Value, FieldTypes.Number);

                int iCount = Utility.DlookupInt("Phone", "count(*)", sExist);
                if (iCount != 0)
                {
                    ShowErrMsg("该电话已经存在!");
                    return;
                }

                string sWhere = "ID=" + CCUtility.ToSQL(p_theID.Value, FieldTypes.Number);

                sSQL = "update Phone set" +
                       "[paID]=" + p2_Pavilion +
                       ",[hoID]=" + p2_House +
                       ",[phone]=" + p2_Phone +
                       ",[Memo]=" + p2_Memo;


                sSQL = sSQL + " where " + sWhere;
            }

            SqlCommand cmd = new SqlCommand(sSQL, Utility.Connection);

            try
            {
                cmd.ExecuteNonQuery();
            }
            catch (Exception E)
            {
                theValidationSummary.Text   += E.Message;
                theValidationSummary.Visible = true;
                return;
            }

            Back();
        }
        private void btSave_Click(object sender, System.EventArgs e)
        {
            string sSQL       = "";
            string sWhere     = "";
            string p2_Name    = CCUtility.ToSQL(Utility.GetParam("btName"), FieldTypes.Text);
            string p2_AllName = CCUtility.ToSQL(Utility.GetParam("btAllName"), FieldTypes.Text);
            string p2_Note    = CCUtility.ToSQL(Utility.GetParam("btNote"), FieldTypes.Text);
            string p2_P1      = CCUtility.ToSQL(Utility.GetParam("btP1"), FieldTypes.Text);
            string p2_P2      = CCUtility.ToSQL(Utility.GetParam("btP2"), FieldTypes.Text);
            string p2_Phone   = CCUtility.ToSQL(Utility.GetParam("btPhone"), FieldTypes.Text);
            string p2_Memo    = CCUtility.ToSQL(Utility.GetParam("btMemo"), FieldTypes.Text);
            string p2_Type    = CCUtility.ToSQL(Utility.GetParam("ddl_Type"), FieldTypes.Number);

            if (p_theID.Value.Length == 0)
            {
                sSQL = "insert into AreaKK ( " +
                       "name," +
                       "allName," +
                       "Note," +
                       "MainPerson," +
                       "ContactPerson," +
                       "Phone," +
                       "Memo," +
                       "typeID) " +
                       " values(" +
                       p2_Name + "," +
                       p2_AllName + "," +
                       p2_Note + "," +
                       p2_P1 + "," +
                       p2_P2 + "," +
                       p2_Phone + "," +
                       p2_Memo + "," +
                       p2_Type + ")";
            }
            else
            {
                sWhere = " where ID=" + CCUtility.ToSQL(p_theID.Value, FieldTypes.Number);

                sSQL = " update AreaKK set " +
                       "[Name]=" + p2_Name +
                       ",[AllName]=" + p2_AllName +
                       ",[Note]=" + p2_Note +
                       ",[MainPerson]=" + p2_P1 +
                       ",[ContactPerson]=" + p2_P2 +
                       ",[Phone]=" + p2_Phone +
                       ",[Memo]=" + p2_Memo +
                       ",[typeID]=" + p2_Type;

                sSQL += sWhere;
            }
            SqlCommand cmd = new SqlCommand(sSQL, Utility.Connection);

            try
            {
                cmd.ExecuteNonQuery();
            }
            catch (Exception E)
            {
                ShowErrMsg(E.Message);
            }

            Response.Redirect(sFormAction);
        }
        protected void Page_Show(object sender, EventArgs e)
        {
            Utility.buildListBox(ddlCell.Items, "select ID,Name from bm_Cell", "ID", "Name", null, "");
            Utility.buildListBox(ddlSunny.Items, "select ID,Name from bm_Sunny", "ID", "Name", null, "");
            Utility.buildListBox(ddlType.Items, "select ID,Name from bm_Indoor", "ID", "Name", null, "");
            //楼名称
            tbPaName.Text    = Utility.Dlookup("pavilion", "Name", "paID=" + CCUtility.ToSQL(paID.Value, FieldTypes.Number));
            tbPaName.Enabled = false;

            if (p_theID.Value.Length > 0)
            {
                string sWhere = "";

                sWhere += "hoID=" + CCUtility.ToSQL(p_theID.Value, FieldTypes.Number);

                string         sSQL      = "select * from House where " + sWhere;
                SqlDataAdapter dsCommand = new SqlDataAdapter(sSQL, Utility.Connection);
                DataSet        ds        = new DataSet();
                DataRow        row;

                if (dsCommand.Fill(ds, 0, 1, "Table") > 0)
                {
                    row         = ds.Tables[0].Rows[0];
                    theID.Value = CCUtility.GetValue(row, "hoID");
                    paID.Value  = CCUtility.GetValue(row, "paID");

                    tbRoom.Text  = CCUtility.GetValue(row, "hoRoom");
                    tbLayer.Text = CCUtility.GetValue(row, "hoFloor");
                    tbArea.Text  = CCUtility.GetValue(row, "hoArchArce");
                    tbArea2.Text = CCUtility.GetValue(row, "hoUseArce");

                    tbClientName.Text = CCUtility.GetValue(row, "Client_Name");
                    tbClientID.Text   = CCUtility.GetValue(row, "CLIENT_CARD");
                    tbPhone.Text      = CCUtility.GetValue(row, "CLIENT_PHONE");
                    tbClientCard.Text = CCUtility.GetValue(row, "CLIENT_ACCOUNT_NUMBER");
                    tbUseDate.Text    = CCUtility.GetValue(row, "USE_DATE");
                    tbUnit.Text       = CCUtility.GetValue(row, "COMPANY_NAME");

                    tbMemo.Text = CCUtility.GetValue(row, "Memo");
                    //类型
                    string s = CCUtility.GetValue(row, "indoorID");
                    try
                    {
                        ddlType.SelectedIndex = ddlType.Items.IndexOf(ddlType.Items.FindByValue(s));
                    }
                    catch { }
                    //单元
                    s = CCUtility.GetValue(row, "cellID");
                    try
                    {
                        ddlCell.SelectedIndex = ddlCell.Items.IndexOf(ddlCell.Items.FindByValue(s));
                    }
                    catch { }
                    //朝向
                    s = CCUtility.GetValue(row, "sunnyID");
                    try
                    {
                        ddlSunny.SelectedIndex = ddlSunny.Items.IndexOf(ddlSunny.Items.FindByValue(s));
                    }
                    catch { }
                }
            }
        }
        private void btSave_Click(object sender, System.EventArgs e)
        {
            string sSQL         = "";
            string sWhere       = "";
            string p2_Name      = CCUtility.ToSQL(Utility.GetParam("tbName"), FieldTypes.Text);
            string p2_Area      = CCUtility.ToSQL(Utility.GetParam("tbArea"), FieldTypes.Text);
            string p2_High      = CCUtility.ToSQL(Utility.GetParam("tbHigh"), FieldTypes.Text);
            string p2_Layer     = CCUtility.ToSQL(Utility.GetParam("tbLayer"), FieldTypes.Text);
            string p2_BuildDate = CCUtility.ToSQL(Utility.GetParam("tbBuildDate"), FieldTypes.Text);
            string p2_Type      = CCUtility.ToSQL(Utility.GetParam("ddlTYpe"), FieldTypes.Number);
            string p2_Sunny     = CCUtility.ToSQL(Utility.GetParam("ddlSunny"), FieldTypes.Number);
            string p2_Memo      = CCUtility.ToSQL(Utility.GetParam("tbMemo"), FieldTypes.Text);

            if (tbName.Text.Trim() == "")
            {
                ShowErrMsg("请输入楼宇名称");
                return;
            }
            if (p_theID.Value.Length == 0)
            {
                int iCount = Utility.DlookupInt("pavilion", "count(*)", "Name=" + CCUtility.ToSQL(Utility.GetParam("tbName"), FieldTypes.Text));
                if (iCount != 0)
                {
                    ShowErrMsg(sErrMsg);
                    return;
                }

                sSQL = "insert into Pavilion ( " +
                       "name," +
                       "Area," +
                       "High," +
                       "Layer," +
                       "BuildDate," +
                       "Memo," +
                       "sunnyID," +
                       "typeID) " +
                       " values(" +
                       p2_Name + "," +
                       p2_Area + "," +
                       p2_High + "," +
                       p2_Layer + "," +
                       p2_BuildDate + "," +
                       p2_Memo + "," +
                       p2_Sunny + "," +
                       p2_Type + ")";
            }
            else
            {
                sWhere = " paID=" + CCUtility.ToSQL(p_theID.Value, FieldTypes.Number);
                int iCount = Utility.DlookupInt("pavilion", "count(*)", "Name=" + CCUtility.ToSQL(Utility.GetParam("tbName"), FieldTypes.Text) + " and not(" + sWhere + ")");
                if (iCount != 0)
                {
                    ShowErrMsg(sErrMsg);
                    return;
                }

                sSQL = " update Pavilion set " +
                       "[Name]=" + p2_Name +
                       ",[Area]=" + p2_Area +
                       ",[High]=" + p2_High +
                       ",[Layer]=" + p2_Layer +
                       ",[BuildDate]=" + p2_BuildDate +
                       ",[Memo]=" + p2_Memo +
                       ",[typeID]=" + p2_Type +
                       ",[sunnyID]=" + p2_Sunny;

                sSQL += " where " + sWhere;
            }
            SqlCommand cmd = new SqlCommand(sSQL, Utility.Connection);

            try
            {
                cmd.ExecuteNonQuery();
            }
            catch (Exception E)
            {
                ShowErrMsg(E.Message);
                return;
            }

            Response.Redirect(sFormAction);
        }