Exemplo n.º 1
0
        /// <summary>
        /// 更新資料
        /// </summary>
        protected void CodeLists_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            RedGlovePermission.Model.Basic_System model = new RedGlovePermission.Model.Basic_System();
            model.Code = CodeLists.DataKeys[e.RowIndex].Values[0].ToString();
            model.Items = ((TextBox)CodeLists.Rows[e.RowIndex].FindControl("txt_Items")).Text.Trim();
            UserSession user = SessionBox.GetUserSession();
            model.Modifier = user.LoginName.ToString();
            model.Modi_Date = DateTime.Now.ToString("yyyyMMdd");

            if (!bll.UpdateCode(model))
            {
                ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "MsgBox", "alert('" + ResourceManager.GetString("Pub_Msg_update_false") + "')", true);
            }
            //返回瀏覽狀態
            CodeLists.EditIndex = -1;
            BindOrder2();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 新增資料
        /// </summary>
        protected void btn_add_Click(object sender, EventArgs e)
        {
            if (txt_Code.Text.Trim() != "")
            {
                RedGlovePermission.Model.Basic_System model = new RedGlovePermission.Model.Basic_System();

                model.Code = txt_Code.Text.Trim();
                model.Items = txt_Items.Text.Trim();
                UserSession user = SessionBox.GetUserSession();
                model.Creator = user.LoginName.ToString();
                model.Create_Date = DateTime.Now.ToString("yyyyMMdd");

                if (!bll.Exists(txt_Code.Text.Trim()))
                {
                    if (bll.CreateCode(model))
                    {
                        ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "MsgBox", "alert('" + ResourceManager.GetString("Pub_Msg_add_true") + "')", true);
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "MsgBox", "alert('" + ResourceManager.GetString("Pub_Msg_add_false") + "')", true);
                    }
                    txt_Code.Text = "";
                    txt_Items.Text = "";
                    BindOrder();
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "MsgBox", "alert('" + ResourceManager.GetString("Pub_Msg_IsCustomer") + "')", true);
                }
            }
        }
Exemplo n.º 3
0
		/// <summary>
		/// 得到一個代碼資料
		/// </summary>
		/// <param name="Code">代碼</param>
		/// <returns></returns>
		public RedGlovePermission.Model.Basic_System GetCodeModel(string Code)
		{
			StringBuilder strSql = new StringBuilder();
			strSql.Append("select top 1 Code,Items from Basic_System ");
			strSql.Append(" where Code=@Code ");
			SqlParameter[] parameters = {
					new SqlParameter("@Code", SqlDbType.Char,10)};
			parameters[0].Value = Code;

			RedGlovePermission.Model.Basic_System model = new RedGlovePermission.Model.Basic_System();
			DataSet ds = SqlServerHelper.Query(strSql.ToString(), parameters);
			if (ds.Tables[0].Rows.Count > 0)
			{
				//if (ds.Tables[0].Rows[0]["MA001"].ToString() != "")
				//{
				model.Code = ds.Tables[0].Rows[0]["Code"].ToString();
				//}
				model.Items = ds.Tables[0].Rows[0]["Items"].ToString();
				return model;
			}
			else
			{
				return null;
			}
		}