private void button1_Click_1(object sender, EventArgs e)
        {
            //try
            //{
            Int64  sood       = Int64.Parse(lblprice.Text) - Int64.Parse(lblhazine.Text);
            string DateDay    = lblsabtday.Text;
            string Year       = lblsabtyear.Text;
            string Month      = lblsabtmonth.Text;
            string Day        = lblsabtday.Text;
            string MajlesDate = cmbyear.Text + "/" + cmbmonth.Text + "/" + cmbday.Text;
            int    status;

            status = 1;
            string      type       = "0";
            string      halat      = "1";
            DBManagment objdbclass = new DBManagment();
            string      majles     = "0";
            string      takhfif;

            if (txtProtakhfif.Text == "")
            {
                takhfif = "0";
            }
            else
            {
                takhfif = txtProtakhfif.TextValue.ToString();
            }

            objdbclass.Inserttable("Insert Into Sefaresh (Sefareshid,Name,Number,Price,SumPrice,Sood,SabtDate,SabtYear,SabtMonth,SabtDay,MajlesDate,MajlesYear,MajlesMonth,MajlesDay,Des,Type,Takhfif,halat,OneSood,status) Values (N'" + Int64.Parse(lblsefareshid.Text) + "', N'" + lblname.Text + "' ,'" + Int64.Parse(txttedad.Text) + "','" + Int64.Parse(lblprice.Text) + "','" + Int64.Parse(lblprice.Text) * Int64.Parse(txttedad.Text) + "','" + sood * Int64.Parse(txttedad.Text) + "','" + DateDay + "','" + Year + "','" + Month + "','" + Day + "', '" + MajlesDate + "' , '" + cmbyear.Text + "','" + cmbmonth.Text + "','" + cmbday.Text + "','" + txtdes.Text + "','" + type + "','" + Int64.Parse(takhfif) + "','" + Int16.Parse(halat) + "','" + sood + "','" + status + "')");
            //  Loadgridview2();
            search("Select id,Name,Number,Price,SumPrice,OneSood from Sefaresh where Sefareshid='" + Int64.Parse(txtsefareshid0.Text) + "'");

            Int64 sum = Int64.Parse(lblprice.Text) * Int32.Parse(txttedad.Text);

            //  textBox1.Text = (Int64.Parse(textBox1.Text) + sum).ToString();
            // MessageBox.Show("  ثبت با موفقیت انجام شد");


            // search("Select id,Name,Number,Price,SumPrice,OneSood from Sefaresh where Sefareshid='" + Int64.Parse(txtsefareshid0.Text) + "'");
            // select("Select * from Sefaresh where Sefareshid='" + Int64.Parse(txtsefareshid0.Text) + "'");
            sumprice("  Select SUM(SumPrice)as SUM,SUM(Sood) as sood from Sefaresh where Sefareshid='" + Int64.Parse(txtsefareshid0.Text) + "'  ");
            //}
            //catch
            //{
            //    MessageBox.Show("  عملیات ثبت امکان پذیر نمی باشد");

            //}
        }
        private void button1_Click_1(object sender, EventArgs e)
        {
            DBManagment objDBClass = new DBManagment();
            string      selectCmd  = string.Format("Select * from Factor where Factorid='" + Int64.Parse(txtfactorid.Text) + "' and  Name=N'" + lblname.Text + "'");
            string      hasrows    = objDBClass.SelectHasRows(selectCmd);


            if (hasrows == "ok")
            {
                MessageBox.Show("این غذا را ثبت کرده اید لطفا از جدول پایینی تعداد آنرا اضافه کنید", "توجه");
            }
            else
            {
                bool successfullCreateAccount = true;
                try
                {
                    Int64       sood       = Int64.Parse(lblprice.Text) - Int64.Parse(lblhazine.Text);
                    string      DateDay    = FarsiLibrary.Utils.PersianDate.Now.ToString().Substring(0, 10);
                    string      Year       = FarsiLibrary.Utils.PersianDate.Now.Year.ToString();
                    string      Month      = FarsiLibrary.Utils.PersianDate.Now.Month.ToString();
                    string      Day        = FarsiLibrary.Utils.PersianDate.Now.Day.ToString();
                    DBManagment objdbclass = new DBManagment();
                    string      adi        = "1";

                    objdbclass.Inserttable("Insert Into Factor (Factorid,Name,Number,Price,SumPrice,Sood,Date,Year,Month,Day,Type,Takhfif,status) Values (N'" + Int64.Parse(txtfactorid.Text) + "', N'" + lblname.Text + "' ,'" + Int64.Parse(lbltedad.Text) + "','" + Int64.Parse(lblprice.Text) + "','" + Int64.Parse(lblprice.Text) * Int64.Parse(lbltedad.Text) + "','" + sood * Int64.Parse(lbltedad.Text) + "','" + DateDay + "','" + Year + "','" + Month + "','" + Day + "','" + adi + "','" + Int64.Parse("0") + "','" + Int64.Parse("0") + "')");
                    loadgridview2();
                    Int64 sum = Int64.Parse(lblprice.Text) * Int32.Parse(lbltedad.Text);
                    txtProNet1.Text = (Int64.Parse(txtProNet1.TextValue.ToString()) + sum).ToString();
                    string takhfif = txtProtakhfif.TextValue.ToString();
                    txtProNet2.Text = (Int64.Parse(txtProNet1.TextValue.ToString()) - Int64.Parse(takhfif)).ToString();
                }
                catch
                {
                    successfullCreateAccount = false;
                    MessageBox.Show("ثبت غذا امکانپذیر نمی باشد", "توجه");
                }
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                DBManagment objdbclass = new DBManagment();
                objdbclass.Inserttable("Insert Into person (address,tell,mobile,name) Values (N'" + textBox3.Text + "', '" + Int32.Parse(textBox1.Text) + "' ,'" + Int64.Parse(textBox2.Text) + "',N'" + textBox4.Text + "')");
                MessageBox.Show("  ثبت با موفقیت انجام شد");
                SqlConnection  objcon     = new SqlConnection("Data Source=Localhost;Initial Catalog=FoodDB; Integrated Security=True");
                SqlDataAdapter objadapter = new SqlDataAdapter("Select top 1  id  from person order by id Desc   ", objcon);
                DataSet        objset     = new DataSet();
                objadapter.Fill(objset, "person");



                DataRow objdatarow1 = objset.Tables["person"].Rows[0];

                label4.Text = objdatarow1["id"].ToString();
            }
            catch
            {
                MessageBox.Show("  عملیات ثبت امکان پذیر نمی باشد");
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                Int64  sood    = Int64.Parse(lblprice.Text) - Int64.Parse(lblhazine.Text);
                string DateDay = FarsiLibrary.Utils.PersianDate.Now.ToString().Substring(0, 10);
                string Year    = FarsiLibrary.Utils.PersianDate.Now.ToString().Substring(0, 4);
                string Month   = FarsiLibrary.Utils.PersianDate.Now.ToString().Substring(5, 2);
                string Day     = FarsiLibrary.Utils.PersianDate.Now.ToString().Substring(8, 2);


                DBManagment objdbclass = new DBManagment();
                string      majles     = "0";
                int         status     = int.Parse("0");
                objdbclass.Inserttable("Insert Into Sefaresh (Sefareshid,Name,Number,Price,SumPrice,Sood,SabtDate,SabtYear,SabtMonth,SabtDay,OneSood,status) Values (N'" + Int64.Parse(lbfactorid.Text) + "', N'" + lblname.Text + "' ,'" + Int64.Parse(txttedad.Text) + "','" + Int64.Parse(lblprice.Text) + "','" + Int64.Parse(lblprice.Text) * Int64.Parse(txttedad.Text) + "','" + sood * Int64.Parse(txttedad.Text) + "','" + DateDay + "','" + Year + "','" + Month + "','" + Day + "','" + sood + "','" + status + "')");
                Loadgridview2();
                Int64 sum = Int64.Parse(lblprice.Text) * Int32.Parse(txttedad.Text);
                txtProNet1.Text = (Int64.Parse(txtProNet1.TextValue.ToString()) + sum).ToString();
            }
            catch
            {
                MessageBox.Show("افزودن این غذا امکانپذیر نمی باشد", "توجه");
            }
        }
Пример #5
0
        private void btnsabt_Click(object sender, EventArgs e)
        {
            try
            {
                Int64 mablagh       = Int64.Parse(txtPromablagh.TextValue.ToString());
                Int64 mablaghbedehi = Int64.Parse(txtprodiv.TextValue.ToString());
                if (mablagh <= mablaghbedehi)
                {
                    string      DateDay    = FarsiLibrary.Utils.PersianDate.Now.ToString().Substring(0, 10);
                    string      Year       = FarsiLibrary.Utils.PersianDate.Now.ToString().Substring(0, 4);
                    string      Month      = FarsiLibrary.Utils.PersianDate.Now.ToString().Substring(5, 2);
                    string      Day        = FarsiLibrary.Utils.PersianDate.Now.ToString().Substring(8, 2);
                    DBManagment objdbclass = new DBManagment();
                    objdbclass.Inserttable("Insert Into SefareshMoney (Sefareshid,MoneyDate,MoneyYear,MoneyMonth,MoneyDay,Money) Values (N'" + Int64.Parse(txtsefareshid0.Text) + "', '" + DateDay + "' ,'" + Year + "','" + Month + "','" + Day + "','" + Int64.Parse(txtPromablagh.TextValue.ToString()) + "')");

                    MessageBox.Show("ثبت با موفقیت انجام شد");
                    search("select Sefareshid,MoneyDate,Money from SefareshMoney where Sefareshid='" + Int64.Parse(txtsefareshid0.Text) + "' ");
                    bedehkar();

                    sumprice("  Select SUM(SumPrice)as SUM from Sefaresh where Sefareshid='" + Int64.Parse(txtsefareshid0.Text) + "' ");
                    takhfif("  Select Takhfif from Sefaresh where Sefareshid='" + Int64.Parse(txtsefareshid0.Text) + "' ");

                    bedehkar();
                }


                else
                {
                    MessageBox.Show("مبلغ واریزی از بدهی بیشتر است");
                }
            }
            catch
            {
                MessageBox.Show("ثبت امکان پذیر نیست");
            }
        }