Пример #1
0
        protected void btn_Click(object sender, EventArgs e)
        {
            try
            {
                var          FirstName = TextBox.Text;
                var          LastName  = TextBox1.Text;
                var          Dep       = DepList.SelectedValue;
                var          Email     = TextBox2.Text;
                var          mobno     = txtTinyMCE.Text;
                var          phoneno   = TextBox3.Text;
                var          role      = Rolelist.SelectedValue;
                var          context   = new MOMEntities();
                DETAILSTABLE NEWMEMBER = new DETAILSTABLE();
                NEWMEMBER.FIRSTNAME  = FirstName;
                NEWMEMBER.LASTNAME   = LastName;
                NEWMEMBER.DEPARTMENT = Convert.ToDecimal(Dep);
                NEWMEMBER.EMAIL      = Email;
                if (mobno != "")
                {
                    NEWMEMBER.MOBILE = mobno;
                }
                if (phoneno != "")
                {
                    NEWMEMBER.TELEPHONE = phoneno;
                }
                NEWMEMBER.ROLE = Convert.ToDecimal(role);

                context.DETAILSTABLE.Add(NEWMEMBER);
                context.SaveChanges();
            }
            catch (Exception ex)
            {
                Response.Write(ex);
            }
        }
Пример #2
0
        protected void MOMList_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            //string key = MOMList.SelectedRow.Cells[7].Text;
            GridViewRow row = (GridViewRow)MOMList.Rows[e.RowIndex];

            var key     = MOMList.DataKeys[e.RowIndex].Value;
            var Key     = Convert.ToInt32(key);
            var context = new MOMEntities();
            var obj     = context.MOMDETAILS.Single(x => x.KEY == Key);
            var rem     = e.NewValues["REMARKS"];

            //TextBox txtBox = (TextBox);
            if (!string.IsNullOrEmpty(e.NewValues["REMARKS"].ToString()))
            {
                obj.REMARKS = rem.ToString();// e.NewValues["REMARKS"].ToString();
            }
            else
            {
                obj.REMARKS = null;
            }
            string ATR = (MOMList.Rows[e.RowIndex].FindControl("DD2") as DropDownList).SelectedItem.Value;

            obj.ATR = ATR;
            context.SaveChanges();

            Response.Redirect("Details.aspx?identifier=" + obj.MOMDETAILS1);
        }
Пример #3
0
        protected void btn_Click(object sender, EventArgs e)
        {
            try
            {
                var         firstname = TextBox1.Text;
                var         lastname  = TextBox6.Text;
                var         email     = TextBox2.Text;
                var         mob       = TextBox3.Text;
                var         tel       = TextBox4.Text;
                var         dep       = Dep.SelectedValue;
                var         password  = TextBox5.Text;
                var         context   = new MOMEntities();
                MEMBERTABLE user      = new MEMBERTABLE();
                var         exa       = context.MEMBERTABLE.SingleOrDefault(x => x.EMAIL == email);
                if (exa != null)
                {
                    Response.Write("Email already exist");
                }
                else
                {
                    user.FIRSTNAME = firstname;
                    user.LASTNAME  = lastname;
                    user.EMAIL     = email;
                    user.MOBILE    = mob;
                    user.TELEPHONE = tel;
                    user.PASSWORD  = password;
                    user.ID        = 0;
                    var contextt = new ValidationContext(user);
                    var results  = new List <ValidationResult>();
                    var isValid  = Validator.TryValidateObject(user, contextt, results, true);

                    if (!isValid)
                    {
                        foreach (var validationResult in results)
                        {
                            //Response.Write(validationResult.ErrorMessage.ToString());
                            //Response.Redirect("SignUp.aspx");
                        }
                    }
                    else
                    {
                        user.DEPARTMENT = Convert.ToInt32(dep);
                        context.MEMBERTABLE.Add(user);
                        context.SaveChanges();
                        Response.Redirect("Login.aspx");
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
Пример #4
0
 protected void btn_Click(object sender, EventArgs e)
 {
     try
     {
         var status  = TextBox3.Text;
         var context = new MOMEntities();
         var ID      = Request.QueryString["Identifier"];
         var id      = Convert.ToInt32(ID);
         var obj     = context.MOMDETAILS.Single(x => x.KEY == id);
         obj.CURRENTSTAGE = DateTime.Now.ToLongDateString() + ":" + status;
         context.SaveChanges();
         Response.Write("Thank you!");
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
Пример #5
0
        protected void btn_Click(object sender, EventArgs e)
        {
            try
            {
                var       rem1    = TextBox1.Text;
                var       rem2    = TextBox2.Text;
                var       context = new MOMEntities();
                MAILTIMER obj1    = new MAILTIMER();
                obj1 = context.MAILTIMER.SingleOrDefault(x => x.KEYID == 1);
                //obj1.KEYID = 1;
                obj1.DAYS = Convert.ToDecimal(rem1);
                MAILTIMER obj2 = new MAILTIMER();
                obj2 = context.MAILTIMER.SingleOrDefault(x => x.KEYID == 2);
                //obj1.KEYID = 1;
                obj2.DAYS = Convert.ToDecimal(rem2);

                context.SaveChanges();
                Response.Redirect("Home.aspx");
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
Пример #6
0
        protected void btn_Click(object sender, EventArgs e)
        {
            try
            {
                var agenda      = txtTinyMCE.Text;
                var title       = TextBox3.Text;
                var chairperson = ChairpersonList.SelectedValue;
                var date        = Convert.ToDateTime(TextBox.Text);
                var time        = TextBox1.Text;

                var NewMeeting = new MEETINGTABLE();
                NewMeeting.CHAIRPERSON = Convert.ToDecimal(chairperson);
                NewMeeting.TIME        = time;
                NewMeeting.TITLE       = title;
                NewMeeting.MEETINGDATE = date;
                //NewMeeting.CHAIRPERSON = chairperson;

                var context = new MOMEntities();
                context.MEETINGTABLE.Add(NewMeeting);
                context.SaveChanges();
                var ID         = NewMeeting.MEETINGID;
                var Meetagenda = new AGENDATABLE();
                Meetagenda.MEETINGID = ID;
                Meetagenda.AGENDA    = agenda;
                context.AGENDATABLE.Add(Meetagenda);
                context.SaveChanges();
                foreach (ListItem listItem in InviteeList.Items)
                {
                    if (listItem.Selected)
                    {
                        var           val    = listItem.Value;
                        var           txt    = listItem.Text;
                        INVITEESTABLE invite = new INVITEESTABLE();
                        invite.MEETINGID = ID;
                        invite.INVITEEID = Convert.ToDecimal(val);
                        context.INVITEESTABLE.Add(invite);
                        context.SaveChanges();
                    }
                }
                foreach (ListItem LISTITEM in ListBox1.Items)
                {
                    if (LISTITEM.Selected)
                    {
                        var     val = LISTITEM.Value;
                        MEETDEP obj = new MEETDEP();
                        obj.MEETID = ID;
                        obj.DEPID  = Convert.ToInt32(val);
                        context.MEETDEP.Add(obj);
                        context.SaveChanges();
                    }
                }
                Response.Redirect("/Home.aspx");

                // var list = InviteeList.SelectedValue;
                // var ID= context.MEETINGTABLE.
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
Пример #7
0
        protected void Button3_Click()
        {
            // create some string variables and assign null values
            var ex_KEY          = 1;
            var ex_TASKDESCRIP  = "";
            var ex_CURRENTSTAGE = "";
            var Text            = "22/11/2009";

            var ID = Request.QueryString["identifier"];

            DateTime ex_EXPECTEDCLOSURE = DateTime.ParseExact(Text, "dd/MM/yyyy", null);
            // DateTime ex_EXPECTEDCLOSURE = Convert.ToDateTime("");
            var      ex_RESPONSIBILITY = "";
            var      ex_ACTIONPOINT    = "";
            var      ex_EMAIL          = "";
            DateTime ex_TARGET         = DateTime.ParseExact(Text, "dd/MM/yyyy", null);
            var      ex_ITEM           = "";
            var      ex_ITSPOC         = ""
            ;
            //string myfile_name = Path.GetFileName(FileUpload1.PostedFile.FileName);
            // assign session object data to myfile_name variable
            string myfile_name = Session["name"].ToString();
            // get complete path of excel sheet and assing it Excel_path variable
            string Excel_path = Server.MapPath(myfile_name);
            // create connection with excel database
            OleDbConnection my_con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Excel_path + ";Extended Properties=Excel 8.0;Persist Security Info=False");

            my_con.Open();
            try
            {
                // get the excel file data and assign it in OleDbcoomad object(o_cmd)
                OleDbCommand o_cmd = new OleDbCommand("select*from [Sheet1$]", my_con);
                // read the excel file data and assing it o_dr object
                OleDbDataReader o_dr = o_cmd.ExecuteReader();
                while (o_dr.Read())
                {
                    if (o_dr[0].ToString() != "")
                    {
                        //get first row data and assign it ex_id variable
                        // ex_KEY = Convert.ToInt32(o_dr[0]);
                        ex_ITSPOC = o_dr[0].ToString();
                        //get second row data and assign it ex_name variable
                        ex_TASKDESCRIP = o_dr[1].ToString();
                        //get thirdt row data and assign it ex_name variable
                        ex_CURRENTSTAGE = o_dr[2].ToString();
                        ex_ITEM         = o_dr[6].ToString();

                        //get first row data and assign it ex_location variable
                        ex_ACTIONPOINT = o_dr[3].ToString(); // DateTime.ParseExact((string)o_dr[3], "dd/MM/yyyy", null);
                                                             //ex_EXPECTEDCLOSURE = Convert.ToDateTime(o_dr[3]);
                        ex_RESPONSIBILITY = o_dr[4].ToString();
                        ex_TARGET         = (DateTime)o_dr[5];
                        // ex_TARGET =DateTime.ParseExact(o_dr[5].ToString(),"dd/MM/yyyy",null);
                        //Text = (string)o_dr[6];
                        //ex_REVIEWDATE = DateTime.ParseExact(Text, "dd/MM/yyyy", null);
                        ex_EMAIL = o_dr[6].ToString();

                        var        context = new MOMEntities();
                        MOMDETAILS rec     = new MOMDETAILS();
                        rec.TASKDESCRIPTION = ex_TASKDESCRIP;
                        rec.TARGET          = ex_TARGET;
                        rec.RESPONSIBILITY  = ex_RESPONSIBILITY;
                        //rec.RESPONSIBILITY = ex_RESPONSIBILITY;
                        rec.CURRENTSTAGE = ex_CURRENTSTAGE; rec.ACTIONPOINT = ex_ACTIONPOINT;
                        rec.EMAIL        = ex_EMAIL;
                        rec.ITSPOC       = ex_ITSPOC;
                        ////var context = new MOMEntities();
                        int id = Convert.ToInt32(ID);
                        rec.MOMDETAILS1 = id;
                        context.MOMDETAILS.Add(rec);
                        context.SaveChanges();
                    }
                    else
                    {
                        o_dr.Close();
                        break;
                    }
                } //{
                Response.Write("DATA INSERTED SUCCESSFULLY");
                Response.Redirect("Details.aspx?identifier=" + ID);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }