Exemplo n.º 1
0
        private void btnSendDataToB_Click_1(object sender, EventArgs e)
        {
            //dùng delegate send message từ frmA sang frmB
            //khởi tạo mới một delegate sau đó truyền  hàm FunDataB từ formB sang
            // truyền vào giá trị của txtA vào trong dataSend
            //frmB sẽ nhận giá trị của txtA thông qua hàm FunDataB và hiển thị lên frmB
            SendDataAToB dataSend = new SendDataAToB(myFrmB.FunDataB);

            dataSend(this.txtA);

            //hàm save message vào db
            FormContent message = new FormContent();

            message.messageText = "A: " + txtA.Text;
            idaoFrm.addMessage(message);
            loadData();
            myFrmB.loadData();


            PassIdFormA dataObject = new PassIdFormA(myFrmB.FunObjectB);

            dataObject(this);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Session["FormReply"] == null)
         {
             ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('錯誤,請重新選擇');window.location='/songlist';</script>");
             Response.Redirect("/songlist");
             return;
         }
         FormReply = (FormContent)Session["FormReply"];
         if (FormReply == null)
         {
             return;
         }
         DateLabel.Text                = "傳情日期:" + DateString[FormReply.Date - 1];
         ClassLabel.Text               = "傳情時間:" + ClassString[FormReply.Class - 2];
         TeamLabel.Text                = "傳情歌手:" + FormReply.TeamMemberName;
         SongLabel.Text                = "傳情歌曲:" + FormReply.SongName;
         CategoryLabel.Text            = "歌曲分類:" + FormReply.Category;
         PlaceLabel.Text               = "傳情地點:" + FormReply.Place;
         ClassNameLabel.Text           = "課堂名稱:" + FormReply.ClassName;
         GeneralLessonLabel.Text       = "是否為通識課:" + GereralLessonString[FormReply.GeneralLesson];
         NameLabel.Text                = "傳情者姓名:" + FormReply.Name;
         DepartmentGradeLabel.Text     = "傳情者系級:" + FormReply.DepartGrade;
         PhoneLabel.Text               = "傳情者手機:" + FormReply.Phone;
         EmailLabel.Text               = "傳情者Email:" + FormReply.Email;
         SentNameLabel.Text            = "被傳情者姓名:" + FormReply.SentName;
         SentDepartmentGradeLabel.Text = "被傳情者系級:" + FormReply.SentDepartGrade;
         SentPhoneLabel.Text           = "被傳情者手機:" + FormReply.SentPhone;
         SentEmailLabel.Text           = "被傳情者Email:" + FormReply.SentEmail;
         PayDayLabel.Text              = "前往攤位繳費時間:" + ReserveString[FormReply.PayDay - 1];
         SpecialRequestLabel.Text      = "特殊需求:<br/>" + FormReply.SpecialRequest;
         RemarkLabel.Text              = "備註:<br/>" + FormReply.Remark.Replace(Environment.NewLine, "<br />");
     }
 }
Exemplo n.º 3
0
 internal CalcGenerator(FormContent formContent, string outDir)
     : base(formContent, outDir)
 {
 }
Exemplo n.º 4
0
 private void FillFormContent(RaeClassContentType contentType, ref FormContent formContent)
 {
     formContent.fnumber        = serialNumberRepository.GetSerialNumber(contentType);
     formContent.frecordFileId1 = formContent.frecordFileId1;
     formContent.frecordFileId2 = formContent.frecordFileId2;
 }
Exemplo n.º 5
0
 protected static string FullOutDir(FormContent fc, string baseOutDir)
 {
     return(Path.Combine(Path.Combine(Path.Combine(baseOutDir, fc.Organization), fc.DocType), fc.Version));
 }
Exemplo n.º 6
0
 internal BaseGenerator(FormContent formContent, string outDir)
 {
     Directory.CreateDirectory(outDir);
     this.FormContent     = formContent;
     this.OutputDirectory = FullOutDir(formContent, outDir);
 }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int    RID   = TryToParse(Request.Form["RID"]); /*post method*/
            string Phone = Request.Form["Phone"];
            string Name  = Request.Form["Name"];

            if (RID <= 0 || Phone == null || Name == null)
            {
                return;
            }
            if (Session["QueryOrderRIDList"] == null)
            {
                return;
            }
            else
            {
                List <int> RIDSessionList = (List <int>)Session["QueryOrderRIDList"];
                if (!RIDSessionList.Contains(RID))
                {
                    return;
                }
            }

            string        strConn = ConfigurationManager.ConnectionStrings["LoveCarrierConnectionString"].ConnectionString;
            SqlConnection myConn  = new SqlConnection(strConn);

            try
            {
                myConn.Open();
                String     strSQL    = @"SELECT Day,Class,TeamMember1,TeamMember2,SongName,Category,Place,ClassName,GeneralLesson,Name,DepartGrade,Phone,Email,SentName,SentDepartGrade,SentPhone,SentEmail,PayDay,SpecialRequest,Remark,IsPaid from [Reserve],[Song],[Team] WHERE Reserve.TID = Team.Tid and Reserve.SID = Song.SID and Reserve.RID = @RID and Reserve.Name = @Name and Reserve.Phone = @Phone";
                SqlCommand myCommand = new SqlCommand(strSQL, myConn);
                myCommand.Parameters.AddWithValue("@RID", RID);
                myCommand.Parameters.AddWithValue("@Name", Name);
                myCommand.Parameters.AddWithValue("@Phone", Phone);

                FormContent Form = new FormContent();

                using (SqlDataReader myDataReader = myCommand.ExecuteReader())
                {
                    myDataReader.Read();
                    FormContent FormReply = new FormContent(
                        Convert.ToInt32(myDataReader["Day"].ToString()),
                        Convert.ToInt32(myDataReader["Class"].ToString()),
                        0,
                        myDataReader["TeamMember1"].ToString() + " " + myDataReader["TeamMember2"].ToString(),
                        0,
                        myDataReader["SongName"].ToString(),
                        myDataReader["Category"].ToString(),
                        myDataReader["Place"].ToString(),
                        myDataReader["ClassName"].ToString(),
                        Convert.ToInt32(myDataReader["GeneralLesson"].ToString()),
                        myDataReader["Name"].ToString(),
                        myDataReader["DepartGrade"].ToString(),
                        myDataReader["Phone"].ToString(),
                        myDataReader["Email"].ToString(),
                        myDataReader["SentName"].ToString(),
                        myDataReader["SentDepartGrade"].ToString(),
                        myDataReader["SentPhone"].ToString(),
                        myDataReader["SentEmail"].ToString(),
                        Convert.ToInt32(myDataReader["PayDay"].ToString()),
                        myDataReader["SpecialRequest"].ToString(),
                        myDataReader["Remark"].ToString(),
                        Convert.ToInt32(myDataReader["IsPaid"])
                        );

                    JavaScriptSerializer js = new JavaScriptSerializer();
                    string strJson          = js.Serialize(FormReply);
                    Response.Write(strJson);
                }



                //Response.Clear();
                //Response.ContentType = "application/json; charset=utf-8";

                //Response.End();
            }
            finally
            {
                myConn.Close();
            }
        }
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            /*check if repeat*/
            bool          IsReserved       = false;
            bool          IsFull           = false;
            string        connectionString = ConfigurationManager.ConnectionStrings["LoveCarrierConnectionString"].ConnectionString;
            SqlConnection Connection       = new SqlConnection(connectionString);

            try
            {
                Connection.Open();
                String     strSQL    = @"SELECT count(1) from [Reserve] WHERE Reserve.Day = @Date and Reserve.Class = @Class and Reserve.TID = @Team";
                SqlCommand myCommand = new SqlCommand(strSQL, Connection);
                myCommand.Parameters.AddWithValue("@Date", Convert.ToInt32(DateHd.Value));
                myCommand.Parameters.AddWithValue("@Class", Convert.ToInt32(ClassHd.Value));
                myCommand.Parameters.AddWithValue("@Team", Convert.ToInt32(TeamHd.Value));
                using (SqlDataReader myDataReader = myCommand.ExecuteReader())
                {
                    myDataReader.Read();
                    if (myDataReader[0].ToString() != "0")
                    {
                        IsReserved = true;
                    }
                }
                if (IsReserved)
                {
                    ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('本時段您指定的傳情歌手已被他人選歌,請重新選擇...');window.location='/songlist';</script>");
                    //Response.Redirect("/songlist");
                    return;
                }

                //strSQL = @"SELECT SongCount from [SongTotal] WHERE Day = @Date and Class = @Class";
                //myCommand = new SqlCommand(strSQL, Connection);
                //myCommand.Parameters.AddWithValue("@Date", Convert.ToInt32(DateHd.Value));
                //myCommand.Parameters.AddWithValue("@Class", Convert.ToInt32(ClassHd.Value));
                //using(SqlDataReader myDataReader = myCommand.ExecuteReader())
                //{
                //    myDataReader.Read();
                //    if(Convert.ToInt32(myDataReader[0].ToString()) >= 10) IsFull = true;
                //}
                //if(IsFull)
                //{
                //    ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('本時段可選歌數已滿,請重新選擇...');window.location='/songlist';</script>");
                //    //Response.Redirect("/songlist");
                //    return;
                //}
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('連線錯誤');window.location='/songlist';</script>");
                //Response.Redirect("/songlist");
                return;
            }
            finally
            {
                Connection.Close();
            }

            /*Fill Session to Send*/
            if (!IsReserved && !IsFull)
            {
                bool   isRemark           = false;
                string SpecialRequestText = "";
                for (int i = 0; i < SpecialRequestCheckBox.Items.Count; i++)
                {
                    if (SpecialRequestCheckBox.Items[i].Selected)
                    {
                        isRemark            = true;
                        SpecialRequestText += "[" + SpecialRequestCheckBox.Items[i].Value + "] ";
                    }
                }
                if (!isRemark)
                {
                    SpecialRequestText = "無";
                }

                FormContent FormReply = new FormContent(
                    Convert.ToInt32(DateHd.Value),
                    Convert.ToInt32(ClassHd.Value),
                    Convert.ToInt32(TeamHd.Value),
                    TeamLabel.Text,
                    Convert.ToInt32(SongHd.Value),
                    SongLabel.Text,
                    CategoryLabel.Text,
                    PlaceTextBox.Text,
                    ClassNameTextBox.Text,
                    Convert.ToInt32(GeneralLessonDropDownList.SelectedValue),
                    NameTextBox.Text,
                    DepartmentGradeTextBox.Text,
                    PhoneTextBox.Text,
                    EmailTextBox.Text,
                    SentNameTextBox.Text,
                    SentDepartmentGradeTextBox.Text,
                    SentPhoneTextBox.Text,
                    SentEmailTextBox.Text,
                    Convert.ToInt32(PayDayDropDownList.SelectedValue),
                    SpecialRequestText,
                    RemarkTextBox.Text,
                    0
                    );
                Session["FormReply"] = FormReply;
                Response.Redirect("/confirm");
            }
            return;
        }
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            if (Session["FormReply"] == null)
            {
                ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('錯誤,請重新選擇');window.location='/songlist';</script>");
                Response.Redirect("/songlist");
                return;
            }
            FormReply = (FormContent)Session["FormReply"];

            int    Date            = FormReply.Date;
            int    Class           = FormReply.Class;
            int    Team            = FormReply.Team;
            int    Song            = FormReply.Song;
            string Place           = FormReply.Place;
            string ClassName       = FormReply.ClassName;
            int    GeneralLesson   = FormReply.GeneralLesson;
            string Name            = FormReply.Name;
            string DepartGrade     = FormReply.DepartGrade;
            string Phone           = FormReply.Phone;
            string Email           = FormReply.Email;
            string SentName        = FormReply.SentName;
            string SentDepartGrade = FormReply.SentDepartGrade;
            string SentPhone       = FormReply.SentPhone;
            string SentEmail       = FormReply.SentEmail;
            int    PayDay          = FormReply.PayDay;
            string SpecialRequest  = FormReply.SpecialRequest;
            string Remark          = FormReply.Remark;
            bool   IsReserved      = false;
            bool   IsFull          = false;

            Session.Clear();

            string        connectionString = ConfigurationManager.ConnectionStrings["LoveCarrierConnectionString"].ConnectionString;
            SqlConnection Connection       = new SqlConnection(connectionString);

            try
            {
                Connection.Open();

                String     strSQL    = @"SELECT count(1) from [Reserve] WHERE Reserve.Day = @Date and Reserve.Class = @Class and Reserve.TID = @Team";
                SqlCommand myCommand = new SqlCommand(strSQL, Connection);
                myCommand.Parameters.AddWithValue("@Date", Date);
                myCommand.Parameters.AddWithValue("@Class", Class);
                myCommand.Parameters.AddWithValue("@Team", Team);
                using (SqlDataReader myDataReader = myCommand.ExecuteReader())
                {
                    myDataReader.Read();
                    if (myDataReader[0].ToString() != "0")
                    {
                        IsReserved = true;
                    }
                }
                if (IsReserved)
                {
                    ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('本時段您指定的傳情歌手已被他人選歌,請重新選擇...');window.location='/songlist';</script>");
                    //Response.Redirect("/songlist");
                    return;
                }

                //strSQL = @"SELECT SongCount from [SongTotal] WHERE Day = @Date and Class = @Class";
                //myCommand = new SqlCommand(strSQL, Connection);
                //myCommand.Parameters.AddWithValue("@Date", Date);
                //myCommand.Parameters.AddWithValue("@Class", Class);
                //using(SqlDataReader myDataReader = myCommand.ExecuteReader())
                //{
                //    myDataReader.Read();
                //    if(Convert.ToInt32(myDataReader[0].ToString()) >= 10) IsFull = true;
                //}
                //if(IsFull)
                //{
                //    ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('本時段可選歌數已滿,請重新選擇...');window.location='/songlist';</script>");
                //    //Response.Redirect("/songlist");
                //    return;
                //}

                else if (!IsFull && !IsReserved)
                {
                    strSQL    = "INSERT INTO Reserve ([TID],[Day],[Class],[SID],[Place],[ClassName],[GeneralLesson],[Name],[DepartGrade],[Phone],[Email],[SentName],[SentDepartGrade],[SentPhone],[SentEmail],[PayDay],[SpecialRequest],[Remark]) VALUES (@TID, @Day, @Class, @SID, @Place, @ClassName, @GeneralLesson, @Name, @DepartGrade, @Phone, @Email, @SentName, @SentDepartGrade,@SentPhone,@SentEmail,@PayDay,@SpecialRequest,@Remark)";
                    myCommand = new SqlCommand(strSQL, Connection);
                    myCommand.Parameters.AddWithValue("@TID", Team);
                    myCommand.Parameters.AddWithValue("@Day", Date);
                    myCommand.Parameters.AddWithValue("@Class", Class);
                    myCommand.Parameters.AddWithValue("@SID", Song);
                    myCommand.Parameters.AddWithValue("@Place", Place);
                    myCommand.Parameters.AddWithValue("@ClassName", ClassName);
                    myCommand.Parameters.AddWithValue("@GeneralLesson", GeneralLesson);
                    myCommand.Parameters.AddWithValue("@Name", Name);
                    myCommand.Parameters.AddWithValue("@DepartGrade", DepartGrade);
                    myCommand.Parameters.AddWithValue("@Phone", Phone);
                    myCommand.Parameters.AddWithValue("@Email", Email);
                    myCommand.Parameters.AddWithValue("@SentName", SentName);
                    myCommand.Parameters.AddWithValue("@SentDepartGrade", SentDepartGrade);
                    myCommand.Parameters.AddWithValue("@SentPhone", SentPhone);
                    myCommand.Parameters.AddWithValue("@SentEmail", SentEmail);
                    myCommand.Parameters.AddWithValue("@PayDay", PayDay);
                    myCommand.Parameters.AddWithValue("@SpecialRequest", SpecialRequest);
                    myCommand.Parameters.AddWithValue("@Remark", Remark);

                    //String strSQL2 = @"UPDATE [SongTotal] SET SongCount+=1 WHERE Day = @Date and Class = @Class";
                    //SqlCommand myCommand2 = new SqlCommand(strSQL2, Connection);
                    //myCommand2.Parameters.AddWithValue("@Date", Date);
                    //myCommand2.Parameters.AddWithValue("@Class", Class);
                    try
                    {
                        myCommand.ExecuteNonQuery();
                        //myCommand2.ExecuteNonQuery();
                    }
                    catch (Exception ex)
                    {
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('資料庫錯誤');window.location='/songlist';", true);
                        //Response.Redirect("/songlist");
                        return;
                    }
                    AlertMsg.Text = "<script language='javascript'>Congrats();</script>";
                    this.Page.Controls.Add(AlertMsg);
                }
            }
            catch
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('連線錯誤');window.location='/songlist';", true);
                //Response.Redirect("/songlist");
                return;
            }
            finally
            {
                Connection.Close();
            }
        }
Exemplo n.º 10
0
 public IResult FormTest(FormContent content)
 {
     Console.WriteLine($"Received form content of number of parameters: {content.Form.Count}");
     return(new Redirect("http://www.google.com"));
 }
Exemplo n.º 11
0
 public JsonResult UpdateFormContent(FormContent formContents)
 {
     context.FormContentCollection.Save(formContents);
     return(Json("Update Successfull", JsonRequestBehavior.AllowGet));
 }
Exemplo n.º 12
0
 internal HtmlGenerator(FormContent formContent, string outDir)
     : base(formContent, outDir)
 {
     FieldBase.Init();
 }