public ActionResult Create([Bind(Include = "FriendId,FriendName,Place")] FriendTable friendTable)
        {
            if (ModelState.IsValid)
            {
                db.FriendTables.Add(friendTable);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(friendTable));
        }
예제 #2
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try {
                string name    = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txt_name")).Text;
                string phone   = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txt_phone")).Text;
                string fax     = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txt_fax")).Text;
                string mobile  = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txt_mobile")).Text;
                string email   = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txt_email")).Text;
                string website = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txt_website")).Text;

                int id = (int)GridView1.DataKeys[e.RowIndex].Value;

                FriendsEntities ent = new FriendsEntities();
                var             wh  = (from warehouse in ent.Customers
                                       where warehouse.Customer_Id == id
                                       select warehouse).First();
                wh.Customer_Name         = name;
                wh.Customer_Email        = email;
                wh.Customer_Website      = website;
                wh.Customer_Phone        = int.Parse(phone);
                wh.Customer_Mobile_Phone = int.Parse(mobile);
                wh.Customer_Fax          = int.Parse(fax);
                ent.SaveChanges();
                ent.SaveChanges();

                GridView1.EditIndex = -1;

                var ds = (from wh2 in ent.Customers
                          select new
                {
                    wh2.Customer_Id,
                    wh2.Customer_Name,
                    wh2.Customer_Phone,
                    wh2.Customer_Fax,
                    wh2.Customer_Mobile_Phone,
                    wh2.Customer_Email,
                    wh2.Customer_Website
                }).ToList();
                GridView1.DataSource = ds;
                GridView1.DataBind();
                mpePopUp.Show();
                Label2.Text = " the Customer is Updated";
            }
            catch
            {
                mpePopUp.Show();
                Label2.Text = "try again";
            }
        }
예제 #3
0
        protected void Button5_Click(object sender, EventArgs e)
        {
            try {
                Ex_Per_Item epi = new Ex_Per_Item();
                epi.Ex_Per_Id            = int.Parse(TextBox2.Text);
                epi.Ex_Per_Item_Id       = int.Parse(DropDownList2.SelectedValue);
                epi.Cus_ID               = int.Parse(DropDownList3.SelectedValue);
                epi.Ex_Per_Item_Quantity = int.Parse(TextBox4.Text);
                FriendsEntities ent = new FriendsEntities();
                ent.Ex_Per_Item.AddObject(epi);
                ent.SaveChanges();
                TextBox4.Text = string.Empty;
                mpePopUp.Show();
                Label2.Text = "item is added to permission number : " + epi.Ex_Per_Id;

                DropDownList1.SelectedValue = default;
                DropDownList2.SelectedValue = default;
                DropDownList3.SelectedValue = default;

                //ep.Ex_Per_WH_Id = int.Parse(DropDownList1.SelectedValue);
                //ep.Ex_Per_Date = DateTime.Parse(Request["txtDatePicker3"].ToString());
                //FriendsEntities ent = new FriendsEntities();
                //ent.Export_Permission.AddObject(ep);
                //ent.SaveChanges();
            }
            catch
            {
                mpePopUp.Show();
                Label2.Text = "try again";
            }
        }
예제 #4
0
        protected void Button5_Click(object sender, EventArgs e)
        {
            try {
                Sup_Per_Item spi = new Sup_Per_Item();
                spi.Sup_Per_Id              = int.Parse(TextBox2.Text);
                spi.Sup_Per_Item_Id         = int.Parse(DropDownList2.SelectedValue);
                spi.Sup_Per_Item_Quantity   = int.Parse(TextBox3.Text);
                spi.Sup_Per_Item_Pro_Date   = DateTime.Parse(Request["txtDatePicker2"].ToString());
                spi.Sup_Per_Item_Validation = int.Parse(TextBox4.Text);
                spi.Sup_Id = int.Parse(DropDownList3.SelectedValue);
                FriendsEntities ent = new FriendsEntities();
                ent.Sup_Per_Item.AddObject(spi);
                ent.SaveChanges();
                TextBox4.Text = string.Empty;
                mpePopUp.Show();
                Label2.Text = "item is added to permission number : " + spi.Sup_Per_Id;

                DropDownList1.SelectedValue = default;
                DropDownList2.SelectedValue = default;
                DropDownList3.SelectedValue = default;
                TextBox4.Text = string.Empty;
                TextBox3.Text = string.Empty;
            }
            catch
            {
                mpePopUp.Show();
                Label2.Text = "try again";
            }
        }
예제 #5
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try {
                int id = (int)GridView1.DataKeys[e.RowIndex].Value;

                FriendsEntities ent = new FriendsEntities();
                var             wh  = (from warehouse in ent.Customers
                                       where warehouse.Customer_Id == id
                                       select warehouse).First();
                ent.Customers.DeleteObject(wh);
                ent.SaveChanges();

                var ds = (from wh2 in ent.Customers
                          select new
                {
                    wh2.Customer_Id,
                    wh2.Customer_Name,
                    wh2.Customer_Phone,
                    wh2.Customer_Fax,
                    wh2.Customer_Mobile_Phone,
                    wh2.Customer_Email,
                    wh2.Customer_Website
                }).ToList();
                GridView1.DataSource = ds;
                GridView1.DataBind();
                mpePopUp.Show();
                Label2.Text = "The Customer is Deleted";
            }
            catch
            {
                mpePopUp.Show();
                Label2.Text = "try again";
            }
        }
예제 #6
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            try
            {
                Customer wh = new Customer();
                wh.Customer_Id           = int.Parse(TextBox1.Text);
                wh.Customer_Name         = TextBox2.Text;
                wh.Customer_Phone        = int.Parse(TextBox3.Text);
                wh.Customer_Fax          = int.Parse(TextBox4.Text);
                wh.Customer_Mobile_Phone = int.Parse(TextBox5.Text);
                wh.Customer_Email        = TextBox6.Text;
                wh.Customer_Website      = TextBox7.Text;

                FriendsEntities ent = new FriendsEntities();
                ent.Customers.AddObject(wh);
                ent.SaveChanges();
                TextBox1.Text = string.Empty;
                TextBox2.Text = string.Empty;
                TextBox3.Text = string.Empty;
                TextBox4.Text = string.Empty;
                TextBox5.Text = string.Empty;
                TextBox6.Text = string.Empty;
                TextBox7.Text = string.Empty;
                mpePopUp.Show();
                Label2.Text = "New Customer is added";
            }
            catch
            {
                mpePopUp.Show();
                Label2.Text = "try again";
            }
        }
예제 #7
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                int id = (int)GridView1.DataKeys[e.RowIndex].Value;

                FriendsEntities ent = new FriendsEntities();
                var             wh  = (from warehouse in ent.Warehouses
                                       where warehouse.WH_Id == id
                                       select warehouse).First();
                ent.Warehouses.DeleteObject(wh);
                ent.SaveChanges();

                var ds = (from wh2 in ent.Warehouses
                          select new
                {
                    wh2.WH_Id,
                    wh2.WH_Name,
                    wh2.WH_Location,
                    wh2.WH_Manager
                }).ToList();
                GridView1.DataSource = ds;
                GridView1.DataBind();
                mpePopUp.Show();
                Label2.Text = "The Warehouse is Deleted";
            }
            catch
            {
                mpePopUp.Show();
                Label2.Text = "try again";
            }
        }
예제 #8
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     try
     {
         Warehouse wh = new Warehouse();
         wh.WH_Id       = int.Parse(TextBox1.Text);
         wh.WH_Name     = TextBox2.Text;
         wh.WH_Location = TextBox3.Text;
         wh.WH_Manager  = TextBox4.Text;
         FriendsEntities ent = new FriendsEntities();
         ent.Warehouses.AddObject(wh);
         ent.SaveChanges();
         TextBox1.Text = string.Empty;
         TextBox2.Text = string.Empty;
         TextBox3.Text = string.Empty;
         TextBox4.Text = string.Empty;
         mpePopUp.Show();
         Label2.Text = "New Warehouse is added";
     }
     catch
     {
         mpePopUp.Show();
         Label2.Text = "try again";
     }
 }
예제 #9
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            try {
                Item itm = new Item();
                itm.Item_Id   = int.Parse(TextBox1.Text);
                itm.Item_Code = int.Parse(TextBox2.Text);
                itm.Item_Name = TextBox3.Text;
                FriendsEntities ent = new FriendsEntities();
                ent.Items.AddObject(itm);
                ent.SaveChanges();
                TextBox1.Text = string.Empty;
                TextBox2.Text = string.Empty;
                TextBox3.Text = string.Empty;
                mpePopUp.Show();
                Label2.Text = "New Item is added";


                var itms = (from itm2 in ent.Items
                            select new { itm2.Item_Id, itm2.Item_Name });
                DropDownList1.DataSource     = itms;
                DropDownList1.DataTextField  = "Item_Name";
                DropDownList1.DataValueField = "Item_Id";
                DropDownList1.DataBind();
            }
            catch
            {
                mpePopUp.Show();
                Label2.Text = "try again";
            }
        }
예제 #10
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                int id = (int)GridView1.DataKeys[e.RowIndex].Value;

                FriendsEntities ent  = new FriendsEntities();
                var             item = (from itm in ent.Items
                                        where itm.Item_Id == id
                                        select itm).First();
                ent.Items.DeleteObject(item);
                ent.SaveChanges();

                var ds = (from itms in ent.Items
                          select new
                {
                    itms.Item_Id,
                    itms.Item_Code,
                    itms.Item_Name
                }).ToList();
                GridView1.DataSource = ds;
                GridView1.DataBind();
                mpePopUp.Show();
                Label2.Text = "The item is Deleted";
            }
            catch
            {
                mpePopUp.Show();
                Label2.Text = "try again";
            }
        }
예제 #11
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try {
                string name = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txt_name")).Text;
                int    code = int.Parse(((TextBox)GridView1.Rows[e.RowIndex].FindControl("txt_code")).Text);
                int    id   = (int)GridView1.DataKeys[e.RowIndex].Value;

                FriendsEntities ent = new FriendsEntities();
                var             wh  = (from itm in ent.Items
                                       where itm.Item_Id == id
                                       select itm).First();
                wh.Item_Name = name;
                wh.Item_Code = code;
                ent.SaveChanges();

                GridView1.EditIndex = -1;

                var ds = (from itms in ent.Items
                          select new
                {
                    itms.Item_Id,
                    itms.Item_Code,
                    itms.Item_Name
                }).ToList();
                GridView1.DataSource = ds;
                GridView1.DataBind();
                mpePopUp.Show();
                Label2.Text = " the item is Updated";
            }
            catch
            {
                mpePopUp.Show();
                Label2.Text = "try again";
            }
        }
예제 #12
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     try
     {
         Transfer t = new Transfer();
         t.Trans_Id   = int.Parse(TextBox3.Text);
         t.WH_From_Id = int.Parse(DropDownList1.SelectedValue);
         t.WH_To_Id   = int.Parse(DropDownList2.SelectedValue);
         t.Item_Id    = int.Parse(DropDownList3.SelectedValue);
         t.Quantity   = int.Parse(TextBox1.Text);
         t.Sup_Id     = int.Parse(DropDownList4.SelectedValue);
         t.Pro_Date   = DateTime.Parse(Request["txtDatePicker3"].ToString());
         t.Validation = int.Parse(TextBox2.Text);
         FriendsEntities ent = new FriendsEntities();
         ent.Transfers.AddObject(t);
         ent.SaveChanges();
         TextBox1.Text = string.Empty;
         TextBox2.Text = string.Empty;
         TextBox3.Text = string.Empty;
         DropDownList1.SelectedValue = default;
         DropDownList2.SelectedValue = default;
         DropDownList3.SelectedValue = default;
         DropDownList4.SelectedValue = default;
         mpePopUp.Show();
         Label2.Text = "New Transfer Done";
     }
     catch
     {
         mpePopUp.Show();
         Label2.Text = "try again";
     }
 }
예제 #13
0
 protected void Button5_Click(object sender, EventArgs e)
 {
     try {
         Items_MU mu = new Items_MU();
         mu.Item_Id = int.Parse(DropDownList1.SelectedValue);
         mu.MU_Name = TextBox4.Text;
         FriendsEntities ent = new FriendsEntities();
         ent.Items_MU.AddObject(mu);
         ent.SaveChanges();
         TextBox4.Text = string.Empty;
         DropDownList1.SelectedValue = default;
     }
     catch
     {
         mpePopUp.Show();
         Label2.Text = "try again";
     }
 }
예제 #14
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     try {
         Export_Permission ep = new Export_Permission();
         ep.Ex_Per_Id    = int.Parse(TextBox1.Text);
         ep.Ex_Per_WH_Id = int.Parse(DropDownList1.SelectedValue);
         ep.Ex_Per_Date  = DateTime.Parse(Request["txtDatePicker3"].ToString());
         FriendsEntities ent = new FriendsEntities();
         ent.Export_Permission.AddObject(ep);
         ent.SaveChanges();
         mpePopUp.Show();
         Label2.Text = "Permission Done";
     }
     catch
     {
         mpePopUp.Show();
         Label2.Text = "try again";
     }
 }
예제 #15
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {
                string name     = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txt_name")).Text;
                string location = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txt_loc")).Text;
                string manager  = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txt_manager")).Text;
                int    id       = (int)GridView1.DataKeys[e.RowIndex].Value;

                FriendsEntities ent = new FriendsEntities();
                var             wh  = (from warehouse in ent.Warehouses
                                       where warehouse.WH_Id == id
                                       select warehouse).First();
                wh.WH_Name     = name;
                wh.WH_Location = location;
                wh.WH_Manager  = manager;
                ent.SaveChanges();

                GridView1.EditIndex = -1;

                var ds = (from wh2 in ent.Warehouses
                          select new
                {
                    wh2.WH_Id,
                    wh2.WH_Name,
                    wh2.WH_Location,
                    wh2.WH_Manager
                }).ToList();
                GridView1.DataSource = ds;
                GridView1.DataBind();
                mpePopUp.Show();
                Label2.Text = " the Warehouse is Updated";
            }
            catch
            {
                mpePopUp.Show();
                Label2.Text = "try again";
            }
        }