Esempio n. 1
0
        /// <summary>
        /// 增加/修改事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            int      tbChatMessage_UserID_Value     = (int)Common.sink(tbChatMessage_UserID_Input.UniqueID, MethodType.Post, 10, 1, DataType.Int);
            string   tbChatMessage_UID_Value        = (string)Common.sink(tbChatMessage_UID_Input.UniqueID, MethodType.Post, 50, 0, DataType.Str);
            string   tbChatMessage_NickName_Value   = (string)Common.sink(tbChatMessage_NickName_Input.UniqueID, MethodType.Post, 50, 0, DataType.Str);
            int      tbChatMessage_IconIndex_Value  = (int)Common.sink(tbChatMessage_IconIndex_Input.UniqueID, MethodType.Post, 10, 0, DataType.Int);
            int      tbChatMessage_ChatType_Value   = (int)Common.sink(tbChatMessage_ChatType_Input.UniqueID, MethodType.Post, 10, 1, DataType.Int);
            string   tbChatMessage_TargetID_Value   = (string)Common.sink(tbChatMessage_TargetID_Input.UniqueID, MethodType.Post, 10, 1, DataType.Str);
            string   tbChatMessage_Comment_Value    = (string)Common.sink(tbChatMessage_Comment_Input.UniqueID, MethodType.Post, 256, 1, DataType.Str);
            DateTime tbChatMessage_CreateDate_Value = (DateTime)Common.sink(tbChatMessage_CreateDate_Input.UniqueID, MethodType.Post, 20, 1, DataType.Dat);

            DateTime?tbChatMessage_BeginTime_Value = (DateTime?)Common.sink(tbChatMessage_BeginTime_Input.UniqueID, MethodType.Post, 50, 0, DataType.Dat);

            tbChatMessageEntity ut = BusinessFacadeDLT.tbChatMessageDisp(IDX);

            ut.UserID     = tbChatMessage_UserID_Value;
            ut.UID        = tbChatMessage_UID_Value;
            ut.NickName   = tbChatMessage_NickName_Value;
            ut.IconIndex  = tbChatMessage_IconIndex_Value;
            ut.ChatType   = tbChatMessage_ChatType_Value;
            ut.TargetID   = tbChatMessage_TargetID_Value;
            ut.Comment    = tbChatMessage_Comment_Value;
            ut.CreateDate = tbChatMessage_CreateDate_Value;
            ut.BeginTime  = tbChatMessage_BeginTime_Value;

            if (CMD == "New")
            {
                ut.DataTable_Action_ = DataTable_Action.Insert;
            }
            else if (CMD == "Edit")
            {
                ut.DataTable_Action_ = DataTable_Action.Update;
            }
            else
            {
                EventMessage.MessageBox(2, "不存在操作字符串!", "不存在操作字符串!", Icon_Type.Error, Common.GetHomeBaseUrl("Default.aspx"));
            }
            Int32 rInt = BusinessFacadeDLT.tbChatMessageInsertUpdateDelete(ut);

            if (rInt > 0)
            {
                string OpTxt = string.Format("增加tbChatMessage成功!(ID:{0})", rInt);
                if (ut.DataTable_Action_ == DataTable_Action.Update)
                {
                    OpTxt = string.Format("修改tbChatMessage成功!(ID:{0})", IDX);
                }
                EventMessage.MessageBox(1, "操作成功", OpTxt, Icon_Type.OK, Common.GetHomeBaseUrl("Default.aspx"));
            }
            else if (rInt == -2)
            {
                EventMessage.MessageBox(1, "操作失败", "操作失败,存在相同的键值(用户名/数据)!", Icon_Type.Alert, Common.GetHomeBaseUrl("Default.aspx"));
            }
            else
            {
                EventMessage.MessageBox(1, "操作失败", string.Format("操作失败,返回值:{0}!", rInt), Icon_Type.Error, Common.GetHomeBaseUrl("Default.aspx"));
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 初始化数据
 /// </summary>
 /// <param name="ut"></param>
 private void OnStartData(tbChatMessageEntity ut)
 {
     tbChatMessage_UserID_Input.Text     = tbChatMessage_UserID_Disp.Text = ut.UserID.ToString();
     tbChatMessage_UID_Input.Text        = tbChatMessage_UID_Disp.Text = ut.UID.ToString();
     tbChatMessage_NickName_Input.Text   = tbChatMessage_NickName_Disp.Text = ut.NickName.ToString();
     tbChatMessage_IconIndex_Input.Text  = tbChatMessage_IconIndex_Disp.Text = ut.IconIndex.ToString();
     tbChatMessage_ChatType_Input.Text   = tbChatMessage_ChatType_Disp.Text = ut.ChatType.ToString();
     tbChatMessage_TargetID_Input.Text   = tbChatMessage_TargetID_Disp.Text = ut.TargetID.ToString();
     tbChatMessage_Comment_Input.Text    = tbChatMessage_Comment_Disp.Text = ut.Comment.ToString();
     tbChatMessage_CreateDate_Input.Text = tbChatMessage_CreateDate_Disp.Text = ut.CreateDate.ToString();
     tbChatMessage_BeginTime_Input.Text  = tbChatMessage_BeginTime_Disp.Text = ut.BeginTime.ToString();
 }
Esempio n. 3
0
        /// <summary>
        /// 开始操作
        /// </summary>
        private void OnStart()
        {
            tbChatMessageEntity ut = BusinessFacadeDLT.tbChatMessageDisp(IDX);

            OnStartData(ut);
            switch (CMD)
            {
            case "New":
                TabOptionItem1.Tab_Name = HeadMenuWebControls1.HeadOPTxt = "增加tbChatMessage";
                Hidden_Disp();
                break;

            case "List":
                TabOptionItem1.Tab_Name = HeadMenuWebControls1.HeadOPTxt = "查看tbChatMessage";
                Hidden_Input();
                ButtonOption.Visible = false;
                AddEditButton();
                break;

            case "Edit":
                TabOptionItem1.Tab_Name = HeadMenuWebControls1.HeadOPTxt = "修改tbChatMessage";
                Hidden_Disp();
                AddDeleteButton();
                break;

            case "Delete":
                ut.DataTable_Action_ = DataTable_Action.Delete;
                if (BusinessFacadeDLT.tbChatMessageInsertUpdateDelete(ut) > 0)
                {
                    EventMessage.MessageBox(1, "删除成功", string.Format("删除ID:{0}成功!", IDX), Icon_Type.OK, Common.GetHomeBaseUrl("Default.aspx"));
                }
                else
                {
                    EventMessage.MessageBox(1, "删除失败", string.Format("删除ID:{0}失败!", IDX), Icon_Type.Error, Common.GetHomeBaseUrl("Default.aspx"));
                }
                break;

            default:
                EventMessage.MessageBox(2, "不存在操作字符串!", "不存在操作字符串!", Icon_Type.Error, Common.GetHomeBaseUrl("Default.aspx"));
                break;
            }
        }
Esempio n. 4
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            string Checkbox_Value = (string)Common.sink("Checkbox", MethodType.Post, 2000, 1, DataType.Str);

            string[] Checkbox_Value_Array = Checkbox_Value.Split(',');
            Int32    IDX = 0;

            for (int i = 0; i < Checkbox_Value_Array.Length; i++)
            {
                if (Int32.TryParse(Checkbox_Value_Array[i], out IDX))
                {
                    tbChatMessageEntity et = new tbChatMessageEntity();
                    et.DataTable_Action_ = DataTable_Action.Delete;
                    et.ID = IDX;
                    BusinessFacadeDLT.tbChatMessageInsertUpdateDelete(et);
                }
            }

            EventMessage.MessageBox(1, "批量删除成功", string.Format("批量删除({0})成功!", Checkbox_Value), Icon_Type.OK, Common.GetHomeBaseUrl("default.aspx"));
        }
Esempio n. 5
0
        private Int32 tbChatMessageInsertUpdateDelete(tbChatMessageEntity fam)
        {
            Int32 rInt = -1;

            using (SqlConnection Conn = new SqlConnection(ConfigurationManager.AppSettings["DLTChat"]))
            {
                SqlCommand cmd = new SqlCommand("dbo.tbChatMessage_InsertUpdateDelete", Conn);
                cmd.CommandType = CommandType.StoredProcedure;
                //设置参数
                cmd.Parameters.Add("@DataTable_Action_", SqlDbType.VarChar).Value = fam.DataTable_Action_.ToString(); //操作方法 Insert:增加 Update:修改 Delete:删除

                cmd.Parameters.Add("@ID", SqlDbType.Int).Value              = fam.ID;                                 //ID
                cmd.Parameters.Add("@UserID", SqlDbType.Int).Value          = fam.UserID;                             //UserID
                cmd.Parameters.Add("@UID", SqlDbType.VarChar).Value         = fam.UID;                                //UID
                cmd.Parameters.Add("@NickName", SqlDbType.VarChar).Value    = fam.NickName;                           //NickName
                cmd.Parameters.Add("@IconIndex", SqlDbType.Int).Value       = fam.IconIndex;                          //IconIndex
                cmd.Parameters.Add("@ChatType", SqlDbType.Int).Value        = fam.ChatType;                           //ChatType
                cmd.Parameters.Add("@TargetID", SqlDbType.NChar).Value      = fam.TargetID;                           //TargetID
                cmd.Parameters.Add("@Comment", SqlDbType.VarChar).Value     = fam.Comment;                            //Comment
                cmd.Parameters.Add("@CreateDate", SqlDbType.DateTime).Value = fam.CreateDate;                         //CreateDate
                if (fam.BeginTime.HasValue)
                {
                    cmd.Parameters.Add("@BeginTime", SqlDbType.DateTime).Value = fam.BeginTime;  //BeginTime
                }
                else
                {
                    cmd.Parameters.Add("@BeginTime", SqlDbType.DateTime).Value = DBNull.Value;  //BeginTime
                }
                Conn.Open();
                rInt = Convert.ToInt32(cmd.ExecuteScalar());
                cmd.Dispose();
                Conn.Dispose();
                Conn.Close();
            }
            return(rInt);
        }