예제 #1
0
        protected void BtnInsert_Click(Object sender, System.EventArgs e)
        {
            int    t  = 0;
            ClSahm cl = new ClSahm();

            cl = Data;
            if (LblParamSahmID.Text == "0")
            {
                t = SahmClass.insert(cl);
            }
            else
            {
                t = SahmClass.Update(cl);
            }

            if (t == 0)
            {
                LblMsg.ForeColor = System.Drawing.Color.Red;
                LblMsg.Text      = "خطا در ثبت";
            }
            else if (t == -1)
            {
                TerraficPlanBLL.Utility.ShowMsg(Page, TerraficPlanBLL.ProPertyData.MsgType.warning, "برای این نوع تخفیف در این سال سهمبه ثبت شده است=");
            }
            else
            {
                LblMsg.ForeColor = System.Drawing.Color.Green;
                LblMsg.Text      = "ثبت  انجام شد.";
                BindGrid();
            }
            LblParamSahmID.Text = "0";
        }
예제 #2
0
        public void UpItem(object sender, EventArgs e)
        {
            String SahmID = ((HtmlAnchor)sender).HRef.ToString();
            ClSahm cl     = new ClSahm();

            cl.SahmID           = Convert.ToInt32(SahmID);
            LblParamSahmID.Text = SahmID;
            Data = cl;
            BtnInsert.Visible = true;
            LightBox.Value    = "1";
        }
예제 #3
0
        private void BindSahm()
        {
            ClSahm clsahm = new ClSahm();

            clsahm.CompanyID        = Convert.ToInt32(lblCompanyID.Text);
            clsahm.Year             = Convert.ToInt32(ddYear.SelectedValue.ToString());
            ddsahmie.DataSource     = SahmClass.GetListWhithHaghighi(clsahm);
            ddsahmie.DataTextField  = "SahmName";
            ddsahmie.DataValueField = "SahmID";
            ddsahmie.DataBind();
        }
예제 #4
0
        public void BindGrid()
        {
            ClSahm   cl = new ClSahm();
            DataSet  ds = SahmClass.GetList(cl);
            DataView dv = new DataView(ds.Tables[0]);

            if (ViewState["Sahm"] == null)
            {
                ViewState["Sahm"] = "SahmID Desc";
            }
            dv.Sort = Securenamespace.SecureData.CheckSecurity(ViewState["Sahm"].ToString()).ToString();
            GridView1.DataSource = dv;
            GridView1.DataBind();
        }
예제 #5
0
        protected void BtnSerach_Click1(object sender, EventArgs e)
        {
            ClSahm   cl      = Data;
            DataSet  ds      = SahmClass.GetList(cl);
            DataView dv      = new DataView(ds.Tables[0]);
            String   StrSort = Securenamespace.SecureData.CheckSecurity(ViewState["Sahm"].ToString());

            if (StrSort != null)
            {
                dv.Sort = StrSort;
            }
            GridView1.DataSource = dv;
            GridView1.DataBind();
        }
예제 #6
0
        //---------------------------------------------------------------------------------------------------------
        public static DataSet GetList(ClSahm c)
        {
            SqlCommand cmd = new SqlCommand("PRC_Sahm_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("SahmID", SqlDbType.Int)).Value          = Securenamespace.SecureData.CheckSecurity(c.SahmID);
            cmd.Parameters.Add(new SqlParameter("CompanyID", SqlDbType.Int)).Value       = Securenamespace.SecureData.CheckSecurity(c.CompanyID);
            cmd.Parameters.Add(new SqlParameter("DiscountTypeID", SqlDbType.Int)).Value  = Securenamespace.SecureData.CheckSecurity(c.DiscountTypeID);
            cmd.Parameters.Add(new SqlParameter("sahmNumbre", SqlDbType.Int)).Value      = Securenamespace.SecureData.CheckSecurity(c.sahmNumbre);
            cmd.Parameters.Add(new SqlParameter("DiscountPersent", SqlDbType.Int)).Value = Securenamespace.SecureData.CheckSecurity(c.DiscountPersent);
            cmd.Parameters.Add(new SqlParameter("Comment", SqlDbType.NVarChar)).Value    = Securenamespace.SecureData.CheckSecurity(c.Comment);
            cmd.Parameters.Add(new SqlParameter("RegDate", SqlDbType.NVarChar)).Value    = Securenamespace.SecureData.CheckSecurity(c.RegDate);
            cmd.Parameters.Add(new SqlParameter("RegUser", SqlDbType.Int)).Value         = Securenamespace.SecureData.CheckSecurity(c.RegUser);
            cmd.Parameters.Add(new SqlParameter("Year", SqlDbType.Int)).Value            = Securenamespace.SecureData.CheckSecurity(c.Year);


            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();
            }
        }
예제 #7
0
        public static int insert(ClSahm c)

        {
            SqlCommand cmd = new SqlCommand("PRC_Sahm_Insert", 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("CompanyID", SqlDbType.Int)).Value       = Securenamespace.SecureData.CheckSecurity(c.CompanyID);
            cmd.Parameters.Add(new SqlParameter("DiscountTypeID", SqlDbType.Int)).Value  = Securenamespace.SecureData.CheckSecurity(c.DiscountTypeID);
            cmd.Parameters.Add(new SqlParameter("sahmNumbre", SqlDbType.Int)).Value      = Securenamespace.SecureData.CheckSecurity(c.sahmNumbre);
            cmd.Parameters.Add(new SqlParameter("DiscountPersent", SqlDbType.Int)).Value = Securenamespace.SecureData.CheckSecurity(c.DiscountPersent);
            cmd.Parameters.Add(new SqlParameter("Comment", SqlDbType.NVarChar)).Value    = Securenamespace.SecureData.CheckSecurity(c.Comment);
            cmd.Parameters.Add(new SqlParameter("RegDate", SqlDbType.NVarChar)).Value    = Securenamespace.SecureData.CheckSecurity(c.RegDate);
            cmd.Parameters.Add(new SqlParameter("RegUser", SqlDbType.Int)).Value         = Securenamespace.SecureData.CheckSecurity(c.RegUser);
            cmd.Parameters.Add(new SqlParameter("Year", SqlDbType.Int)).Value            = Securenamespace.SecureData.CheckSecurity(c.Year);


            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();
            }
        }