public void BindGrid()
        {
            ClAgreeExplanPrice cl = new ClAgreeExplanPrice();

            if (NotDefaultAgree == false)
            {
                cl.AgreementID = 0;
            }
            else
            {
                cl.AgreementID = Convert.ToInt32(AgreementID);
            }

            cl.SubjectID = Convert.ToInt32(ddsubject.SelectedValue);


            DataSet  ds = AgreeExplanPriceClass.GetList(cl);
            DataView dv = new DataView(ds.Tables[0]);

            if (ViewState["ExplanPriceID"] == null)
            {
                ViewState["ExplanPriceID"] = "ExplanPriceID Desc";
            }
            dv.Sort = Securenamespace.SecureData.CheckSecurity(ViewState["ExplanPriceID"].ToString()).ToString();
            GridView1.DataSource = dv;
            GridView1.DataBind();
        }
Example #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            ClAgreeExplanPrice cl = new ClAgreeExplanPrice();

            //cl.PriceDayExplan = Convert.ToInt32(TXTPriceDayExplan.Text);
            //cl.PriceNightExplan = Convert.ToInt32(TXTPriceNightExplan.Text == "" ? "0" : TXTPriceNightExplan.Text);
            //cl.ExplanID = Convert.ToInt32(DDExplanID.SelectedValue);
            cl.SubjectID = Convert.ToInt32(ddsubject.SelectedValue);
            //    cl.AgreementID = Convert.ToInt32(lblagreementID.Text);
            //  cl.ExplanPriceID = Convert.ToInt32(LblParamExplanPriceID.Text);

            //  cl = Data;

            int ttt = 0;

            //if (CSharp.PublicFunction.ModeInsert(ExplanPriceID.ToString()))
            ttt = AgreeExplanPriceClass.insert_all(cl);

            if (ttt == 0)
            {
                LblMsg.ForeColor = System.Drawing.Color.Red;
                LblMsg.Text      = "خطا در ثبت";
            }
            else
            {
                LblMsg.ForeColor = System.Drawing.Color.Green;
                LblMsg.Text      = "ثبت  انجام شد.";
                //BindGrid();
            }
            //    LightBox.Value = "0";


            //LblParamExplanPriceID.Text = "0";
        }
        protected void BtnInsert_Click(Object sender, System.EventArgs e)
        {
            ClAgreeExplanPrice cl = new ClAgreeExplanPrice();

            cl = Data;

            int t = 0;

            if (CSharp.PublicFunction.ModeInsert(ExplanPriceID.ToString()))
            {
                t = AgreeExplanPriceClass.insert(cl);
            }
            else
            {
                t = AgreeExplanPriceClass.Update(cl);
            }

            if (t == 0)
            {
                LblMsg.ForeColor = System.Drawing.Color.Red;
                LblMsg.Text      = "خطا در ثبت";
            }
            else
            {
                LblMsg.ForeColor = System.Drawing.Color.Green;
                LblMsg.Text      = "ثبت  انجام شد.";
                BindGrid();
            }
            LightBox.Value = "0";


            LblParamExplanPriceID.Text = "0";
        }
Example #4
0
        //---------------------------------------------------------------------------------------------------------
        public static int UpdateAct(ClAgreeExplanPrice c)
        {
            SqlCommand cmd = new SqlCommand("PRC_AgreeExplanPrice_UpdateAct", cnn);

            cmd.CommandType = System.Data.CommandType.StoredProcedure;

            cmd.Parameters.Add(new SqlParameter("UserIDLog", SqlDbType.NVarChar)).Value = CSharp.PublicFunction.GetUserID();
            cmd.Parameters.Add(new SqlParameter("IpLog", SqlDbType.NVarChar)).Value     = CSharp.PublicFunction.GetIPAddress();
            cmd.Parameters.Add(new SqlParameter("OSLog", SqlDbType.NVarChar)).Value     = CSharp.PublicFunction.GetOS();
            cmd.Parameters.Add(new SqlParameter("OSVerLog", SqlDbType.NVarChar)).Value  = CSharp.PublicFunction.GetBrowser() + CSharp.PublicFunction.GetBrowserVersion();
            cmd.Parameters.Add(new SqlParameter("URLLog", SqlDbType.NVarChar)).Value    = CSharp.PublicFunction.GetURL();

            cmd.Parameters.Add(new SqlParameter("ExplanPriceID", SqlDbType.Int)).Value = Securenamespace.SecureData.CheckSecurity(c.ExplanPriceID);
            cmd.Parameters.Add(new SqlParameter("ActID", SqlDbType.Int)).Value         = Securenamespace.SecureData.CheckSecurity(c.ActID);


            SqlParameter prmResult = new SqlParameter("Result", SqlDbType.Int);

            prmResult.Direction = ParameterDirection.Output;
            cmd.Parameters.Add(prmResult);
            try
            {
                cnn.Open();
                cmd.ExecuteNonQuery();
                return(Convert.ToInt32(prmResult.Value));
            }
            catch (Exception ex)
            {
                return(0);
            }
            finally
            {
                cnn.Close();
            }
        }
        public void UpItem(object sender, EventArgs e)
        {
            String ExplanPriceID = ((HtmlAnchor)sender).HRef.ToString();

            LblParamExplanPriceID.Text = ExplanPriceID;
            ClAgreeExplanPrice cl = new ClAgreeExplanPrice();

            cl.ExplanPriceID = Convert.ToInt32(ExplanPriceID);
            Data             = cl;
            LightBox.Value   = "1";
        }
        protected void btnzarib_Click(object sender, EventArgs e)
        {
            ClAgreeExplanPrice cl = new ClAgreeExplanPrice();

            cl.AgreementID = AgreementID;
            cl.ZaribPrice  = txtzaribprice.Text;
            if (txtzaribprice.Text == "" || txtzaribprice.Text == "0")
            {
                return;
            }

            AgreeExplanPriceClass.Updatezarib(cl);
            BindGrid();
        }
        protected void btnSaveDates_Click1(object sender, EventArgs e)
        {
            ClAgreeExplanPrice cl = new ClAgreeExplanPrice();

            cl.ExplanPriceID  = Convert.ToInt32(ExplanPriceID);
            cl.FromDateActive = DateConvert.sh2m(txtFromDateActive.Text).ToString();
            cl.ToDateActive   = DateConvert.sh2m(txtToDateActive.Text).ToString();

            if (AgreeExplanPriceClass.Update(cl) == 0)
            {
                CSharp.Utility.ShowMsg(Page, CSharp.ProPertyData.MsgType.warning, "خطا در ثبت");
            }
            else
            {
                BindGrid();
            }
        }
        public void ActItem(object sender, EventArgs e)
        {
            String ID            = ((HtmlAnchor)sender).HRef.ToString();
            String ExplanPriceID = ID.Split('$')[0].ToString();
            String ActID         = ID.Split('$')[1].ToString();

            if (ActID == "0")
            {
                ActID = "1";
            }
            else
            {
                ActID = "0";
            }

            if (ActID == "1")
            {
                LightBox1.Value = "1";
            }
            else
            {
                LightBox1.Value = "0";
            }


            ClAgreeExplanPrice cl = new ClAgreeExplanPrice();

            cl.ExplanPriceID           = Convert.ToInt32(ExplanPriceID);
            cl.ActID                   = Convert.ToInt32(ActID);
            LblParamExplanPriceID.Text = ExplanPriceID;



            int t = AgreeExplanPriceClass.Update(cl);

            if (t == 0)
            {
                CSharp.Utility.ShowMsg(Page, CSharp.ProPertyData.MsgType.warning, "خطا در فعال کردن");
            }
            else
            {
                BindGrid();
            }
        }
Example #9
0
        //---------------------------------------------------------------------------------------------------------
        public static DataSet GetList(ClAgreeExplanPrice c)
        {
            SqlCommand cmd = new SqlCommand("PRC_AgreeExplanPrice_GetList", cnn);

            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("UserIDLog", SqlDbType.NVarChar)).Value = CSharp.PublicFunction.GetUserID();
            cmd.Parameters.Add(new SqlParameter("IpLog", SqlDbType.NVarChar)).Value     = CSharp.PublicFunction.GetIPAddress();
            cmd.Parameters.Add(new SqlParameter("OSLog", SqlDbType.NVarChar)).Value     = CSharp.PublicFunction.GetOS();
            cmd.Parameters.Add(new SqlParameter("OSVerLog", SqlDbType.NVarChar)).Value  = CSharp.PublicFunction.GetBrowser() + CSharp.PublicFunction.GetBrowserVersion();
            cmd.Parameters.Add(new SqlParameter("URLLog", SqlDbType.NVarChar)).Value    = CSharp.PublicFunction.GetURL();

            cmd.Parameters.Add(new SqlParameter("ExplanPriceID", SqlDbType.Int)).Value    = Securenamespace.SecureData.CheckSecurity(c.ExplanPriceID);
            cmd.Parameters.Add(new SqlParameter("ExplanID", SqlDbType.Int)).Value         = Securenamespace.SecureData.CheckSecurity(c.ExplanID);
            cmd.Parameters.Add(new SqlParameter("PriceNightExplan", SqlDbType.Int)).Value = Securenamespace.SecureData.CheckSecurity(c.PriceNightExplan);
            cmd.Parameters.Add(new SqlParameter("PriceDayExplan", SqlDbType.Int)).Value   = Securenamespace.SecureData.CheckSecurity(c.PriceDayExplan);
            cmd.Parameters.Add(new SqlParameter("AgreementID", SqlDbType.Int)).Value      = Securenamespace.SecureData.CheckSecurity(c.AgreementID);

            cmd.Parameters.Add(new SqlParameter("SubjectID", SqlDbType.Int)).Value = Securenamespace.SecureData.CheckSecurity(c.SubjectID);

            SqlParameter prmResult = new SqlParameter("Result", SqlDbType.Int);

            prmResult.Direction = ParameterDirection.Output;
            cmd.Parameters.Add(prmResult);
            DataSet        ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            try
            {
                cnn.Open();
                da.Fill(ds);
                return(ds);
            }
            catch (Exception ex)
            {
                return(null);
            }
            finally
            {
                cnn.Close();
            }
        }