Beispiel #1
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int       id        = int.Parse(GridView1.Rows[e.RowIndex].Cells[3].Text);
            InvLodhdr newDelete = db.InvLodhdr.Single(p => p.Doc_No == id);

            db.InvLodhdr.Remove(newDelete);
            db.SaveChanges();
        }
Beispiel #2
0
        protected void btn_save_Click(object sender, EventArgs e)
        {
            //save values in data base
            short comp_No     = short.Parse(ddl_company.SelectedValue);
            short activity_No = short.Parse(ddl_activity.SelectedValue);
            short store_Id    = short.Parse(ddl_branch.SelectedValue);
            short refType     = short.Parse(ddl_ref_type.SelectedValue);
            short mostwd3     = short.Parse(ddl_mostwd3.SelectedValue);
            short payment     = short.Parse(ddl_pay.SelectedValue);
            int   customer    = int.Parse(txt_customer_no.Text);
            // int customer = int.Parse(ddl_customer.SelectedValue);
            short salesMan = short.Parse(ddl_sales_man.SelectedValue);

            txt_pill.Text = (db.InvLodhdr.Max(p => p.Doc_No) + 1).ToString();
            //  TextBox1.Text = (db.AstDprtmnt.Max(o => o.Dpm_No) + 1).ToString();


            //    var query = db.InvLodhdr.Where(p => p.Doc_Ty == 13).Select(p => p.Doc_No).Last();
            InvLodhdr newInvlodhdr = new InvLodhdr()
            {
                Cmp_No      = comp_No,
                Actvty_No   = activity_No,
                StoreID     = store_Id,
                Doc_Ty      = 13,
                Doc_No      = int.Parse(txt_pill.Text),
                Doc_Dt      = txt_DateEN.Text,
                Doc_DtAr    = TXT_DateAR.Text,
                Reftyp_No   = refType,
                Dlv_Stor    = mostwd3,
                Pym_No      = payment,
                Cstm_No     = customer,
                Slm_No      = salesMan,
                Credit_Days = int.Parse(txt_pay_time.Text),
                Pym_Dt      = txt_pay_date.Text,
                //neww
                //Notes = txt_note1.Text,
                //Tot_Cost=int.Parse(txt_total.Text)
            };



            db.InvLodhdr.Add(newInvlodhdr);
            db.SaveChanges();

            Response.Redirect("SalesInvoic.aspx");
        }
        protected void Btn_Delete_Click(object sender, EventArgs e)
        {
            short Comp_No  = short.Parse(DDL_Com_NO.SelectedValue);
            short Activ_No = short.Parse(DDL_Actinvity_NO.SelectedValue);
            short Store_No = short.Parse(DDL_Store_Number.SelectedValue);
            Int64 Doc_No   = Int64.Parse(Txt_Doc_No.Text);

            InvLodhdr Header = new InvLodhdr()
            {
                Cmp_No    = Comp_No,
                Actvty_No = Activ_No,
                StoreID   = Store_No,
                Doc_No    = Doc_No,
                Doc_Ty    = 2
            };

            db.InvLodhdr.Remove(Header);
            db.SaveChanges();
        }