Exemplo n.º 1
0
        /// <summary>
        /// 新增資料
        /// </summary>
        public int Add(Models.MVote mod)
        {
            SqlCommand    cmd    = new SqlCommand();
            StringBuilder sbTSQL = new StringBuilder();

            sbTSQL.AppendLine("insert into [TB_Vote] ([TWYear],[MemberID],[AgentMemberID],[CreateDate],[CreateUser])");
            sbTSQL.AppendLine("values (@TWYear,@MemberID,@AgentMemberID,@CreateDate,@CreateUser)");
            sbTSQL.AppendLine(";select @@identity;");
            cmd.CommandType = CommandType.Text;

            cmd.Parameters.Add("@TWYear", SqlDbType.Int).Value             = mod.TWYear;
            cmd.Parameters.Add("@MemberID", SqlDbType.NVarChar).Value      = mod.MemberID;
            cmd.Parameters.Add("@AgentMemberID", SqlDbType.NVarChar).Value = mod.AgentMemberID;
            cmd.Parameters.Add("@CreateDate", SqlDbType.DateTime).Value    = mod.CreateDate;
            cmd.Parameters.Add("@CreateUser", SqlDbType.NVarChar).Value    = mod.CreateUser;
            cmd.CommandText = sbTSQL.ToString();
            object obj   = SQLUtil.ExecuteScalar(cmd);
            int    intID = 0;

            if (obj != null && int.TryParse(obj.ToString(), out intID))
            {
                mod.VoteID = intID;
            }
            return(intID);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 新增資料
        /// </summary>
        public int Add(Models.MReceipt mod)
        {
            SqlCommand    cmd    = new SqlCommand();
            StringBuilder sbTSQL = new StringBuilder();

            sbTSQL.AppendLine("insert into [TB_Receipt] ([TWYear],[MemberID],[MemberType],[ReceiptType]");
            sbTSQL.AppendLine(",[Fee],[ReceivedFromAppend],[Remark],[CreateUser],[CreateDate],[CancelUser]");
            sbTSQL.AppendLine(",[CancelDate],[Enable])");
            sbTSQL.AppendLine("values (@TWYear,@MemberID,@MemberType,@ReceiptType");
            sbTSQL.AppendLine(",@Fee,@ReceivedFromAppend,@Remark,@CreateUser,@CreateDate,@CancelUser");
            sbTSQL.AppendLine(",@CancelDate,@Enable)");
            sbTSQL.AppendLine(";select @@identity;");
            cmd.CommandType = CommandType.Text;
            cmd.Parameters.Add("@TWYear", SqlDbType.Int).Value           = mod.TWYear;
            cmd.Parameters.Add("@MemberID", SqlDbType.NVarChar).Value    = mod.MemberID;
            cmd.Parameters.Add("@MemberType", SqlDbType.NVarChar).Value  = mod.MemberType;
            cmd.Parameters.Add("@ReceiptType", SqlDbType.NVarChar).Value = mod.ReceiptType;
            cmd.Parameters.Add("@Fee", SqlDbType.Int).Value = mod.Fee;
            cmd.Parameters.Add("@ReceivedFromAppend", SqlDbType.NVarChar).Value = mod.ReceivedFromAppend;
            cmd.Parameters.Add("@Remark", SqlDbType.NVarChar).Value             = mod.Remark;
            cmd.Parameters.Add("@CreateUser", SqlDbType.NVarChar).Value         = mod.CreateUser;
            cmd.Parameters.Add("@CreateDate", SqlDbType.DateTime).Value         = mod.CreateDate;
            cmd.Parameters.Add("@CancelUser", SqlDbType.NVarChar).Value         = SQLUtil.CheckDBValue(mod.CancelUser);
            cmd.Parameters.Add("@CancelDate", SqlDbType.DateTime).Value         = SQLUtil.CheckDBValue(mod.CancelDate);
            cmd.Parameters.Add("@Enable", SqlDbType.Bit).Value = mod.Enable;
            cmd.CommandText = sbTSQL.ToString();
            object obj   = SQLUtil.ExecuteScalar(cmd);
            int    intID = 0;

            if (obj != null && int.TryParse(obj.ToString(), out intID))
            {
                mod.ReceiptID = intID;
            }
            return(intID);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 新增資料
        /// </summary>
        public int Add(Models.MAwardWinner mod)
        {
            SqlCommand cmd = new SqlCommand("STP_AwardWinnerAdd");

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@AwardID", SqlDbType.Int).Value     = mod.AwardID;
            cmd.Parameters.Add("@AwardTypeID", SqlDbType.Int).Value = SQLUtil.CheckDBValue(mod.AwardTypeID);
            cmd.Parameters.Add("@Year", SqlDbType.Int).Value        = mod.Year;
            cmd.Parameters.Add("@Works", SqlDbType.NVarChar).Value  = mod.Works;
            //cmd.Parameters.Add("@WinnerID", SqlDbType.Int).Value = mod.WinnerID;
            cmd.Parameters.Add("@WinnerName", SqlDbType.NVarChar).Value = mod.WinnerName;
            cmd.Parameters.Add("@Photo", SqlDbType.Image).Value         = SQLUtil.CheckDBValue(mod.Photo);
            cmd.Parameters.Add("@Contents", SqlDbType.NVarChar).Value   = mod.Contents;
            //cmd.Parameters.Add("@WinnerTitle", SqlDbType.NVarChar).Value = SQLUtil.CheckDBValue(mod.WinnerTitle);
            //cmd.Parameters.Add("@Experience", SqlDbType.NVarChar).Value = SQLUtil.CheckDBValue(mod.Experience);
            //cmd.Parameters.Add("@Contribution", SqlDbType.NVarChar).Value = SQLUtil.CheckDBValue(mod.Contribution);
            //cmd.Parameters.Add("@Draft", SqlDbType.Bit).Value = SQLUtil.CheckDBValue(mod.Draft);
            cmd.Parameters.Add("@CreateUser", SqlDbType.NVarChar).Value     = mod.CreateUser;
            cmd.Parameters.Add("@LastUpdateUser", SqlDbType.NVarChar).Value = mod.LastUpdateUser;
            object obj   = SQLUtil.ExecuteScalar(cmd);
            int    intID = 0;

            if (obj != null && int.TryParse(obj.ToString(), out intID))
            {
                mod.AwardWinnerID = intID;
            }
            return(intID);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 由UserID計算User筆數
        /// </summary>
        public int CountByUserID(string strUserid)
        {
            SqlCommand cmd = new SqlCommand("STP_UserCountByUserID");

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@UserID", SqlDbType.NVarChar).Value = strUserid;
            return(Convert.ToInt32(SQLUtil.ExecuteScalar(cmd)));
        }
Exemplo n.º 5
0
        /// <summary>
        /// 計算用AwardID取得資料筆數
        /// </summary>
        public int GetCountByAwardID(int AwardID)
        {
            SqlCommand cmd = new SqlCommand("STP_AwardWinnerCountByAwardID");

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@AwardID", SqlDbType.Int).Value = AwardID;
            return(Convert.ToInt32(SQLUtil.ExecuteScalar(cmd)));
        }
Exemplo n.º 6
0
        /// <summary>
        /// 新增資料
        /// </summary>
        public int Add(Models.MPaper mod)
        {
            SqlCommand    cmd    = new SqlCommand();
            StringBuilder sbTSQL = new StringBuilder();

            sbTSQL.AppendLine("insert into [TB_Paper] ([PaperID],[TWYear],[PaperTitle],[PaperAuthor],[Company]");
            sbTSQL.AppendLine(",[SummaryC],[SummaryE],[MemberType],[MemberID],[Tel1]");
            sbTSQL.AppendLine(",[Tel2],[Ext],[Fax1],[Fax2],[Email]");
            sbTSQL.AppendLine(",[UploadDate],[PublishType],[PaperDomainID],[Publish],[FileExtension]");
            sbTSQL.AppendLine(",[Examine],[ExamineDate],[PaperNo])");
            sbTSQL.AppendLine("values (@PaperID,@TWYear,@PaperTitle,@PaperAuthor,@Company");
            sbTSQL.AppendLine(",@SummaryC,@SummaryE,@MemberType,@MemberID,@Tel1");
            sbTSQL.AppendLine(",@Tel2,@Ext,@Fax1,@Fax2,@Email");
            sbTSQL.AppendLine(",@UploadDate,@PublishType,@PaperDomainID,@Publish,@FileExtension");
            sbTSQL.AppendLine(",@Examine,@ExamineDate,@PaperNo)");
            sbTSQL.AppendLine(";select @@identity;");


            cmd.CommandType = CommandType.Text;

            cmd.Parameters.Add("@PaperID", SqlDbType.Int).Value            = mod.PaperID;
            cmd.Parameters.Add("@TWYear", SqlDbType.Int).Value             = mod.TWYear;
            cmd.Parameters.Add("@PaperTitle", SqlDbType.NVarChar).Value    = mod.PaperTitle;
            cmd.Parameters.Add("@PaperAuthor", SqlDbType.NVarChar).Value   = mod.PaperAuthor;
            cmd.Parameters.Add("@Company", SqlDbType.NVarChar).Value       = mod.Company;
            cmd.Parameters.Add("@SummaryC", SqlDbType.NVarChar).Value      = mod.SummaryC;
            cmd.Parameters.Add("@SummaryE", SqlDbType.NVarChar).Value      = mod.SummaryE;
            cmd.Parameters.Add("@MemberType", SqlDbType.NVarChar).Value    = mod.MemberType;
            cmd.Parameters.Add("@MemberID", SqlDbType.NVarChar).Value      = mod.MemberID;
            cmd.Parameters.Add("@Tel1", SqlDbType.NVarChar).Value          = mod.Tel1;
            cmd.Parameters.Add("@Tel2", SqlDbType.NVarChar).Value          = mod.Tel2;
            cmd.Parameters.Add("@Ext", SqlDbType.NVarChar).Value           = mod.Ext;
            cmd.Parameters.Add("@Fax1", SqlDbType.NVarChar).Value          = mod.Fax1;
            cmd.Parameters.Add("@Fax2", SqlDbType.NVarChar).Value          = mod.Fax2;
            cmd.Parameters.Add("@Email", SqlDbType.NVarChar).Value         = mod.Email;
            cmd.Parameters.Add("@UploadDate", SqlDbType.DateTime).Value    = SQLUtil.CheckDBValue(mod.UploadDate);
            cmd.Parameters.Add("@PublishType", SqlDbType.NVarChar).Value   = mod.PublishType;
            cmd.Parameters.Add("@PaperDomainID", SqlDbType.NVarChar).Value = mod.PaperDomainID;
            cmd.Parameters.Add("@Publish", SqlDbType.Bit).Value            = mod.Publish;
            cmd.Parameters.Add("@FileExtension", SqlDbType.NVarChar).Value = mod.FileExtension;
            cmd.Parameters.Add("@Examine", SqlDbType.NVarChar).Value       = mod.Examine;
            cmd.Parameters.Add("@ExamineDate", SqlDbType.DateTime).Value   = SQLUtil.CheckDBValue(mod.ExamineDate);
            cmd.Parameters.Add("@PaperNo", SqlDbType.NVarChar).Value       = mod.PaperNo;
            cmd.CommandText = sbTSQL.ToString();
            object obj   = SQLUtil.ExecuteScalar(cmd);
            int    intID = 0;

            if (obj != null && int.TryParse(obj.ToString(), out intID))
            {
                mod.PaperID = intID;
            }
            return(intID);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 新增資料
        /// </summary>
        public int Add(Models.MPaperSuggestion mod)
        {
            SqlCommand cmd = new SqlCommand("STP_PaperSuggestionAdd");

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@PaperID", SqlDbType.Int).Value = mod.PaperID;
            cmd.Parameters.Add("@PaperSuggestion", SqlDbType.NVarChar).Value = mod.PaperSuggestion;
            object obj   = SQLUtil.ExecuteScalar(cmd);
            int    intID = 0;

            if (obj != null && int.TryParse(obj.ToString(), out intID))
            {
                mod.PaperSuggestionID = intID;
            }
            return(intID);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 是否繳過入會費
        /// <summary>
        public int CheckMemberFeePay(string strMemberID, string strMemberType)
        {
            SqlCommand cmd = new SqlCommand("STP_FeeCheckMemberPay");

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@MemberType", SqlDbType.NVarChar).Value = strMemberType;
            cmd.Parameters.Add("@MemberID", SqlDbType.NVarChar).Value   = strMemberID;
            object obj      = SQLUtil.ExecuteScalar(cmd);
            int    intCount = 0;

            if (obj != null && int.TryParse(obj.ToString(), out intCount))
            {
                intCount = Convert.ToInt32(obj.ToString());
            }
            return(intCount);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 新增資料
        /// </summary>
        public int Add(Models.MOnSiteRegistration mod)
        {
            SqlCommand    cmd    = new SqlCommand();
            StringBuilder sbTSQL = new StringBuilder();

            sbTSQL.AppendLine("insert into [TB_OnSiteRegistration] ([TWYear],[MemberID],[MemberType],[RegisterName]");
            sbTSQL.AppendLine(",[Company],[PayType],[Fee2],[Fee3],[Attend]");
            sbTSQL.AppendLine(",[MealType],[CreateUser],[CreateDate],[UpdateUser],[UpdateDate],[FeeID])");
            sbTSQL.AppendLine("values (@TWYear,@MemberID,@MemberType,@RegisterName");
            sbTSQL.AppendLine(",@Company,@PayType,@Fee2,@Fee3,@Attend");
            sbTSQL.AppendLine(",@MealType,@CreateUser,@CreateDate,@UpdateUser,@UpdateDate,@FeeID)");
            sbTSQL.AppendLine(";select @@identity;");
            cmd.CommandType = CommandType.Text;

            cmd.Parameters.Add("@TWYear", SqlDbType.Int).Value            = mod.TWYear;
            cmd.Parameters.Add("@MemberID", SqlDbType.NVarChar).Value     = mod.MemberID;
            cmd.Parameters.Add("@MemberType", SqlDbType.NVarChar).Value   = mod.MemberType;
            cmd.Parameters.Add("@RegisterName", SqlDbType.NVarChar).Value = mod.RegisterName;
            cmd.Parameters.Add("@Company", SqlDbType.NVarChar).Value      = mod.Company;
            cmd.Parameters.Add("@PayType", SqlDbType.NVarChar).Value      = mod.PayType;
            cmd.Parameters.Add("@Fee2", SqlDbType.Int).Value            = mod.Fee2;
            cmd.Parameters.Add("@Fee3", SqlDbType.Int).Value            = mod.Fee3;
            cmd.Parameters.Add("@Attend", SqlDbType.Bit).Value          = mod.Attend;
            cmd.Parameters.Add("@MealType", SqlDbType.NVarChar).Value   = mod.MealType;
            cmd.Parameters.Add("@CreateUser", SqlDbType.NVarChar).Value = mod.CreateUser;
            cmd.Parameters.Add("@CreateDate", SqlDbType.DateTime).Value = mod.CreateDate;
            cmd.Parameters.Add("@UpdateUser", SqlDbType.NVarChar).Value = mod.UpdateUser;
            cmd.Parameters.Add("@UpdateDate", SqlDbType.DateTime).Value = SQLUtil.CheckDBValue(mod.UpdateDate);
            cmd.Parameters.Add("@FeeID", SqlDbType.Int).Value           = SQLUtil.CheckDBValue(mod.FeeID);
            cmd.CommandText = sbTSQL.ToString();
            object obj   = SQLUtil.ExecuteScalar(cmd);
            int    intID = 0;

            if (obj != null && int.TryParse(obj.ToString(), out intID))
            {
                mod.OnSiteRegistrationID = intID;
            }
            return(intID);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 新增資料
        /// </summary>
        public int Add(Models.MFeeP mod)
        {
            SqlCommand cmd = new SqlCommand("STP_FeePAdd");

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@MemberPID", SqlDbType.NVarChar).Value = mod.MemberPID;
            cmd.Parameters.Add("@TWYear", SqlDbType.Int).Value         = mod.TWYear;
            cmd.Parameters.Add("@PayType", SqlDbType.NVarChar).Value   = mod.PayType;
            cmd.Parameters.Add("@Fee1", SqlDbType.Int).Value           = mod.Fee1;
            cmd.Parameters.Add("@Fee2", SqlDbType.Int).Value           = mod.Fee2;
            cmd.Parameters.Add("@Fee3", SqlDbType.Int).Value           = mod.Fee3;
            cmd.Parameters.Add("@PayDate", SqlDbType.DateTime).Value   = mod.PayDate;
            cmd.Parameters.Add("@OrderID", SqlDbType.Int).Value        = SQLUtil.CheckDBValue(mod.OrderID);
            cmd.Parameters.Add("@Remark", SqlDbType.NVarChar).Value    = mod.Remark;
            object obj   = SQLUtil.ExecuteScalar(cmd);
            int    intID = 0;

            if (obj != null && int.TryParse(obj.ToString(), out intID))
            {
                mod.FeePID = intID;
            }
            return(intID);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 新增資料
        /// </summary>
        public int Add(Models.MRegister mod)
        {
            SqlCommand    cmd    = new SqlCommand();
            StringBuilder sbTSQL = new StringBuilder();

            sbTSQL.AppendLine("insert into [TB_Register] ([TWYear],[MemberID],[MemberType],[RegisterName]");
            sbTSQL.AppendLine(",[TEL],[Email1],[Email2],[ZipCode],[City]");
            sbTSQL.AppendLine(",[Area],[Address],[MealType],[RegisterDate],[UpdateDate])");
            sbTSQL.AppendLine("values (@TWYear,@MemberID,@MemberType,@RegisterName");
            sbTSQL.AppendLine(",@TEL,@Email1,@Email2,@ZipCode,@City");
            sbTSQL.AppendLine(",@Area,@Address,@MealType,@RegisterDate,@UpdateDate)");
            sbTSQL.AppendLine(";select @@identity;");
            cmd.CommandType = CommandType.Text;
            cmd.Parameters.Add("@TWYear", SqlDbType.Int).Value            = mod.TWYear;
            cmd.Parameters.Add("@MemberID", SqlDbType.NVarChar).Value     = mod.MemberID;
            cmd.Parameters.Add("@MemberType", SqlDbType.NVarChar).Value   = mod.MemberType;
            cmd.Parameters.Add("@RegisterName", SqlDbType.NVarChar).Value = mod.RegisterName;
            cmd.Parameters.Add("@TEL", SqlDbType.NVarChar).Value          = mod.TEL;
            cmd.Parameters.Add("@Email1", SqlDbType.NVarChar).Value       = mod.Email1;
            cmd.Parameters.Add("@Email2", SqlDbType.NVarChar).Value       = mod.Email2;
            cmd.Parameters.Add("@ZipCode", SqlDbType.NVarChar).Value      = mod.ZipCode;
            cmd.Parameters.Add("@City", SqlDbType.NVarChar).Value         = mod.City;
            cmd.Parameters.Add("@Area", SqlDbType.NVarChar).Value         = mod.Area;
            cmd.Parameters.Add("@Address", SqlDbType.NVarChar).Value      = mod.Address;
            cmd.Parameters.Add("@MealType", SqlDbType.NVarChar).Value     = mod.MealType;
            cmd.Parameters.Add("@RegisterDate", SqlDbType.DateTime).Value = mod.RegisterDate;
            cmd.Parameters.Add("@UpdateDate", SqlDbType.DateTime).Value   = mod.UpdateDate;
            cmd.CommandText = sbTSQL.ToString();
            object obj   = SQLUtil.ExecuteScalar(cmd);
            int    intID = 0;

            if (obj != null && int.TryParse(obj.ToString(), out intID))
            {
                mod.RegisterID = intID;
            }
            return(intID);
        }
Exemplo n.º 12
0
    protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
    {
        try
        {
            CreateUserWizard1.UserName = ((TextBox)UserTemplate.ContentTemplateContainer.FindControl("UserName")).Text;

            user = Membership.GetUser(CreateUserWizard1.UserName);

            user.ChangePasswordQuestionAndAnswer(user.GetPassword(), "1", "1");
            user.IsApproved = true;
            user.Comment    = ((TextBox)UserTemplate.ContentTemplateContainer.FindControl("Corp")).Text;

            Roles.AddUserToRole(CreateUserWizard1.UserName, "user");
            Membership.UpdateUser(user);

            p = (ProfileCommon)ProfileCommon.Create(CreateUserWizard1.UserName, true);
            p.UserProfile.Owner    = ((TextBox)UserTemplate.ContentTemplateContainer.FindControl("Name")).Text;
            p.UserProfile.Name     = ((TextBox)UserTemplate.ContentTemplateContainer.FindControl("Name")).Text;
            p.UserProfile.Tel      = ((TextBox)UserTemplate.ContentTemplateContainer.FindControl("Tel")).Text;
            p.UserProfile.Corp     = ((TextBox)UserTemplate.ContentTemplateContainer.FindControl("Corp")).Text;
            p.UserProfile.City     = ((DropDownList)UserTemplate.ContentTemplateContainer.FindControl("cityList")).SelectedValue;
            p.UserProfile.Postcode = ((DropDownList)UserTemplate.ContentTemplateContainer.FindControl("zipList")).SelectedValue;
            p.UserProfile.Address  = ((TextBox)UserTemplate.ContentTemplateContainer.FindControl("Address")).Text;
            p.UserProfile.Fax      = ((TextBox)UserTemplate.ContentTemplateContainer.FindControl("Fax")).Text;
            p.UserProfile.Kind     = ((DropDownList)UserTemplate.ContentTemplateContainer.FindControl("Kind")).SelectedValue;
            p.UserProfile.Type     = "1";
            p.UserProfile.Zipcht   = ((DropDownList)UserTemplate.ContentTemplateContainer.FindControl("zipList")).SelectedValue +
                                     ((DropDownList)UserTemplate.ContentTemplateContainer.FindControl("cityList")).SelectedItem.Text +
                                     ((DropDownList)UserTemplate.ContentTemplateContainer.FindControl("zipList")).SelectedItem.Text;
            p.Save();


            /* UserProfiles */
            UserProfiles up = new UserProfiles();
            up.Username = CreateUserWizard1.UserName;
            up.Owner    = ((TextBox)UserTemplate.ContentTemplateContainer.FindControl("Name")).Text;
            up.Name     = ((TextBox)UserTemplate.ContentTemplateContainer.FindControl("Name")).Text;
            up.Tel      = ((TextBox)UserTemplate.ContentTemplateContainer.FindControl("Tel")).Text;
            up.Corp     = ((TextBox)UserTemplate.ContentTemplateContainer.FindControl("Corp")).Text;
            up.City     = ((DropDownList)UserTemplate.ContentTemplateContainer.FindControl("cityList")).SelectedValue;
            up.Postcode = ((DropDownList)UserTemplate.ContentTemplateContainer.FindControl("zipList")).SelectedValue;
            up.Address  = ((TextBox)UserTemplate.ContentTemplateContainer.FindControl("Address")).Text;
            up.Fax      = ((TextBox)UserTemplate.ContentTemplateContainer.FindControl("Fax")).Text;
            up.Kind     = ((DropDownList)UserTemplate.ContentTemplateContainer.FindControl("Kind")).SelectedValue;
            up.Type     = "1";
            up.Zipcht   = ((DropDownList)UserTemplate.ContentTemplateContainer.FindControl("zipList")).SelectedValue +
                          ((DropDownList)UserTemplate.ContentTemplateContainer.FindControl("cityList")).SelectedItem.Text +
                          ((DropDownList)UserTemplate.ContentTemplateContainer.FindControl("zipList")).SelectedItem.Text;


            String sqlUp = "";
            sqlUp = sqlUp + " insert into UserProfiles ([address],[city],[corp],[fax]	,[kind],[name],[owner],[postcode],[tel],[type],[username],[zipcht]) ";
            sqlUp = sqlUp + " values (@address,@city,@corp,@fax	,@kind,@name,@owner,@postcode,@tel,@type,@username,@zipcht)";
            //sqlUp = sqlUp + " insert into UserProfiles ([address],[city],[corp],[fax],[kind],[name],[owner],[postcode],[tel],[type],[username],[zipcht]) ";
            //sqlUp = sqlUp + " values (@address,@city,@corp,@fax,@kind,@name,@owner,@postcode,@tel,@type,@username,@zipcht) ";
            OleDbCommand cmdM = new OleDbCommand(sqlUp);
            cmdM.Parameters.Add("@address", OleDbType.VarChar).Value  = up.Address;
            cmdM.Parameters.Add("@city", OleDbType.VarChar).Value     = up.City;
            cmdM.Parameters.Add("@corp", OleDbType.VarChar).Value     = up.Corp;
            cmdM.Parameters.Add("@fax", OleDbType.VarChar).Value      = up.Fax;
            cmdM.Parameters.Add("@kind", OleDbType.VarChar).Value     = up.Kind;
            cmdM.Parameters.Add("@name", OleDbType.VarChar).Value     = up.Name;
            cmdM.Parameters.Add("@owner", OleDbType.VarChar).Value    = up.Owner;
            cmdM.Parameters.Add("@postcode", OleDbType.VarChar).Value = up.Postcode;
            cmdM.Parameters.Add("@tel", OleDbType.VarChar).Value      = up.Tel;
            cmdM.Parameters.Add("@type", OleDbType.VarChar).Value     = up.Type;
            cmdM.Parameters.Add("@username", OleDbType.VarChar).Value = up.Username;
            cmdM.Parameters.Add("@zipcht", OleDbType.VarChar).Value   = up.Zipcht;
            cmdM.CommandType = CommandType.Text;

            //SQLUtil.ExecuteSql(cmdM);
            object objUserProfile = SQLUtil.ExecuteScalar(cmdM);
            //mgr.Save(null, null, up);

            ((Label)CompleteWizardStep1.ContentTemplateContainer.FindControl("Msg")).Text = "學研機構會員新增完成。";
        }
        catch (Exception err)
        {
            Membership.DeleteUser(CreateUserWizard1.UserName, true);

            ((Label)CompleteWizardStep1.ContentTemplateContainer.FindControl("Msg")).Text = "錯誤: " + err.ToString();
        }
    }
Exemplo n.º 13
0
    public void Save(ReuseTech obj, IList matchList, UserProfiles up)
    {
        #region  Save

        if (up != null)
        {
            String sqlUp = "";
            sqlUp = sqlUp + " insert into UserProfiles ([address],[city],[corp],[fax]	,[kind],[name],[owner],[postcode],[tel],[type],[username],[zipcht]) ";
            sqlUp = sqlUp + " values (@address,@city,@corp,@fax	,@kind,@name,@owner,@postcode,@tel,@type,@username,@zipcht)";
            OleDbCommand cmdM = new OleDbCommand(sqlUp);
            cmdM.Parameters.Add("@address", OleDbType.VarChar).Value  = up.Address;
            cmdM.Parameters.Add("@city", OleDbType.VarChar).Value     = up.City;
            cmdM.Parameters.Add("@corp", OleDbType.VarChar).Value     = up.Corp;
            cmdM.Parameters.Add("@fax", OleDbType.VarChar).Value      = up.Fax;
            cmdM.Parameters.Add("@kind", OleDbType.VarChar).Value     = up.Kind;
            cmdM.Parameters.Add("@name", OleDbType.VarChar).Value     = up.Name;
            cmdM.Parameters.Add("@owner", OleDbType.VarChar).Value    = up.Owner;
            cmdM.Parameters.Add("@postcode", OleDbType.VarChar).Value = up.Postcode;
            cmdM.Parameters.Add("@tel", OleDbType.VarChar).Value      = up.Tel;
            cmdM.Parameters.Add("@type", OleDbType.VarChar).Value     = up.Type;
            cmdM.Parameters.Add("@username", OleDbType.VarChar).Value = up.Username;
            cmdM.Parameters.Add("@zipcht", OleDbType.VarChar).Value   = up.Zipcht;
            cmdM.CommandType = CommandType.Text;
            //SQLUtil.ExecuteSql(cmdM);

            object objUserProfile = SQLUtil.ExecuteScalar(cmdM);
            int    intID          = 0;
            if (obj != null && int.TryParse(obj.ToString(), out intID))
            {
                //mod.AccountsPayableID = intID;

                String sqlAspUser = "";
                sqlAspUser = sqlAspUser + " insert into aspnet_Users ([userid],[username],[mobilealias],[isanonymous]	,[lastactivitydate]) ";
                sqlAspUser = sqlAspUser + " values ( @userid,@username,@mobilealias,@isanonymous,@lastactivitydate)";

                OleDbCommand cmdAspUser = new OleDbCommand(sqlAspUser);
                cmdAspUser.Parameters.Add("@userid", OleDbType.VarChar).Value        = up.Address;
                cmdAspUser.Parameters.Add("@username", OleDbType.VarChar).Value      = up.Name;
                cmdAspUser.Parameters.Add("@mobilealias", OleDbType.VarChar).Value   = "";
                cmdAspUser.Parameters.Add("@isanonymous", OleDbType.Boolean).Value   = false;
                cmdAspUser.Parameters.Add("@lastactivitydate", OleDbType.Date).Value = DateTime.Now;
                cmdAspUser.CommandType = CommandType.Text;
                SQLUtil.ExecuteSql(cmdAspUser);
            }
        }
        if (obj != null)
        {
            String sqlRT = "";
            sqlRT = sqlRT + " insert into ReuseTech (isapproved,patent,researchitem,reusename,techadv,techdesc,techitem,techname,techother,type,username,wasteitem,wastename,wasteother,createdate) ";
            sqlRT = sqlRT + " values (@isapproved,@patent,@researchitem,@reusename,@techadv,@techdesc,@techitem,@techname,@techother,@type,@username,@wasteitem,@wastename,@wasteother,@createdate)";
            OleDbCommand cmdRT = new OleDbCommand(sqlRT);
            cmdRT.Parameters.Add("@isapproved", OleDbType.Boolean).Value   = obj.Isapproved;
            cmdRT.Parameters.Add("@patent", OleDbType.VarChar).Value       = obj.Patent;
            cmdRT.Parameters.Add("@researchitem", OleDbType.VarChar).Value = obj.Researchitem;
            cmdRT.Parameters.Add("@reusename", OleDbType.VarChar).Value    = obj.Reusename;

            cmdRT.Parameters.Add("@techadv", OleDbType.VarChar).Value   = obj.Techadv;
            cmdRT.Parameters.Add("@techdesc", OleDbType.VarChar).Value  = obj.Techdesc;
            cmdRT.Parameters.Add("@techitem", OleDbType.VarChar).Value  = obj.Techitem;
            cmdRT.Parameters.Add("@techname", OleDbType.VarChar).Value  = obj.Techname;
            cmdRT.Parameters.Add("@techother", OleDbType.VarChar).Value = obj.Techother;
            cmdRT.Parameters.Add("@type", OleDbType.VarChar).Value      = obj.Type;
            cmdRT.Parameters.Add("@username", OleDbType.VarChar).Value  = obj.Username;

            cmdRT.Parameters.Add("@wasteitem", OleDbType.VarChar).Value  = obj.Wasteitem;
            cmdRT.Parameters.Add("@wastename", OleDbType.VarChar).Value  = obj.Wastename;
            cmdRT.Parameters.Add("@wasteother", OleDbType.VarChar).Value = obj.Wasteother;
            cmdRT.Parameters.Add("@createdate", OleDbType.Date).Value    = obj.Createdate;

            SQLUtil.ExecuteSql(cmdRT);

            //HibernateTemplate.SaveOrUpdate(obj);
        }
        if (matchList != null)
        {
            foreach (Match item in matchList)
            {
                if (obj.Type.Equals("1"))
                {
                    item.Rid1 = obj.Id; // ReuseTech 編號
                }
                else
                {
                    item.Rid2 = obj.Id; // ReuseTech 編號
                }
                String sqlM = "";
                sqlM = sqlM + " insert into MatchList ([approveddate],[confirmdate1],[confirmdate2],[corp1],[corp2]";
                sqlM = sqlM + " ,[createdate1],[createdate2],[deletedate1],[deletedate2],[isapproved1],[isapproved2]";
                sqlM = sqlM + " ,[ischecked],[isconfirm1],[isconfirm2],[isdeleted],[isdeleted1],[isdeleted2],[isdroped1],[isdroped2],[matchdate],[name1],[name2]";
                sqlM = sqlM + " ,[reusename1],[reusename2],[rid1],[rid2],[techadv],[techdesc],[techitem1],[techitem2],[techname1],[techname2]";
                sqlM = sqlM + " ,[tel1],[tel2],[username1],[username2],[wasteitem1],[wasteitem2],[wastename1],[wastename2])";
                sqlM = sqlM + " values (@approveddate,@confirmdate1,@confirmdate2,@corp1,@corp2";
                sqlM = sqlM + " ,@createdate1,@createdate2,@deletedate1,@deletedate2,@isapproved1,@isapproved2";
                sqlM = sqlM + " ,@ischecked,@isconfirm1,@isconfirm2,@isdeleted,@isdeleted1,@isdeleted2,@isdroped1,@isdroped2,@matchdate,@name1,@name2";
                sqlM = sqlM + " ,@reusename1,@reusename2,@rid1,@rid2,@techadv,@techdesc,@techitem1,@techitem2,@techname1,@techname2";
                sqlM = sqlM + " ,@tel1,@tel2,@username1,@username2,@wasteitem1,@wasteitem2,@wastename1,@wastename2 )";
                OleDbCommand cmdM = new OleDbCommand(sqlM);

                cmdM.Parameters.Add("@approveddate", OleDbType.Date).Value   = item.Approveddate;
                cmdM.Parameters.Add("@confirmdate1", OleDbType.Date).Value   = item.Confirmdate1;
                cmdM.Parameters.Add("@confirmdate2", OleDbType.Date).Value   = item.Confirmdate2;
                cmdM.Parameters.Add("@corp1", OleDbType.VarChar).Value       = item.Isapproved1;
                cmdM.Parameters.Add("@corp2", OleDbType.VarChar).Value       = item.Isapproved1;
                cmdM.Parameters.Add("@createdate1", OleDbType.Date).Value    = item.Createdate1;
                cmdM.Parameters.Add("@createdate2", OleDbType.Date).Value    = item.Createdate2;
                cmdM.Parameters.Add("@deletedate1", OleDbType.Date).Value    = item.Deletedate1;
                cmdM.Parameters.Add("@deletedate2", OleDbType.Date).Value    = item.Deletedate2;
                cmdM.Parameters.Add("@isapproved1", OleDbType.Boolean).Value = item.Isapproved1;
                cmdM.Parameters.Add("@isapproved2", OleDbType.Boolean).Value = item.Isapproved2;
                cmdM.Parameters.Add("@ischecked", OleDbType.VarChar).Value   = item.Ischecked;
                cmdM.Parameters.Add("@isconfirm1", OleDbType.VarChar).Value  = item.Isconfirm1;
                cmdM.Parameters.Add("@isconfirm2", OleDbType.VarChar).Value  = item.Isconfirm2;
                cmdM.Parameters.Add("@isdeleted", OleDbType.Boolean).Value   = item.Isdeleted;
                cmdM.Parameters.Add("@isdeleted1", OleDbType.Boolean).Value  = item.Isdeleted1;
                cmdM.Parameters.Add("@isdeleted2", OleDbType.Boolean).Value  = item.Isdeleted2;
                cmdM.Parameters.Add("@isdroped1", OleDbType.VarChar).Value   = item.Isdroped1;
                cmdM.Parameters.Add("@isdroped2", OleDbType.VarChar).Value   = item.Isdroped2;
                cmdM.Parameters.Add("@matchdate", OleDbType.Date).Value      = item.Matchdate;
                cmdM.Parameters.Add("@name1", OleDbType.VarChar).Value       = item.Name1;
                cmdM.Parameters.Add("@name2", OleDbType.VarChar).Value       = item.Name2;
                cmdM.Parameters.Add("@reusename1", OleDbType.VarChar).Value  = item.Reusename1;
                cmdM.Parameters.Add("@reusename2", OleDbType.VarChar).Value  = item.Reusename2;
                cmdM.Parameters.Add("@rid1", OleDbType.Integer).Value        = item.Rid1;
                cmdM.Parameters.Add("@rid2", OleDbType.Integer).Value        = item.Rid2;
                cmdM.Parameters.Add("@techadv", OleDbType.VarChar).Value     = item.Techadv;
                cmdM.Parameters.Add("@techdesc", OleDbType.VarChar).Value    = item.Techdesc;
                cmdM.Parameters.Add("@techitem1", OleDbType.VarChar).Value   = item.Techitem1;
                cmdM.Parameters.Add("@techitem2", OleDbType.VarChar).Value   = item.Techitem2;
                cmdM.Parameters.Add("@techname1", OleDbType.VarChar).Value   = item.Techname1;
                cmdM.Parameters.Add("@techname2", OleDbType.VarChar).Value   = item.Techname2;
                cmdM.Parameters.Add("@tel1", OleDbType.VarChar).Value        = item.Tel1;
                cmdM.Parameters.Add("@tel2", OleDbType.VarChar).Value        = item.Tel2;
                cmdM.Parameters.Add("@username1", OleDbType.VarChar).Value   = item.Username1;
                cmdM.Parameters.Add("@username2", OleDbType.VarChar).Value   = item.Username2;
                cmdM.Parameters.Add("@wasteitem1", OleDbType.VarChar).Value  = item.Wasteitem1;
                cmdM.Parameters.Add("@wasteitem2", OleDbType.VarChar).Value  = item.Wasteitem2;
                cmdM.Parameters.Add("@wastename1", OleDbType.VarChar).Value  = item.Wastename1;
                cmdM.Parameters.Add("@wastename2", OleDbType.VarChar).Value  = item.Wastename2;
                SQLUtil.ExecuteSql(cmdM);

                //HibernateTemplate.Save(item);
            }
        }

        #endregion
    }