当前位置: 首页>>代码示例>>C#>>正文


C# ClsBAL.deductDistributorbalance方法代码示例

本文整理汇总了C#中BAL.ClsBAL.deductDistributorbalance方法的典型用法代码示例。如果您正苦于以下问题:C# ClsBAL.deductDistributorbalance方法的具体用法?C# ClsBAL.deductDistributorbalance怎么用?C# ClsBAL.deductDistributorbalance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BAL.ClsBAL的用法示例。


在下文中一共展示了ClsBAL.deductDistributorbalance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btnDepositSubmit_Click

    protected void btnDepositSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            objBal = new ClsBAL();

            ListItem value = ddlAgents.Items.FindByText(txtAgents.Text.ToString());

            if (value == null)
            {
                ddlAgents.SelectedIndex = 0;
                lblMsg.InnerHtml = "The Agent Username does not exists.";

                txtAgentName.Focus();
                txtAgentName.Text = "";
            }
            else
            {
                if (Session["Role"].ToString() == "Admin")
                {
                    ddlAgents.SelectedItem.Value = value.Value;
                    string msg = objBal.AddAgentDeposit(Convert.ToInt32(ddlAgents.SelectedItem.Value.ToString())
                        , Convert.ToDouble(txtAmount.Text.ToString()), txtDepositDetails.Text.Trim().ToString(), Convert.ToInt32(Session["UserID"].ToString())
                        , rbtnType.SelectedItem.Text.ToString(), txtTransactionNo.Text.Trim().ToString(), txtReason.Text.Trim());

                    BindDeposits();
                    DeductAgentBalance(Convert.ToInt32(ddlAgents.SelectedItem.Value), Convert.ToDouble(0.00),
                                Convert.ToInt32(Userid), rbtnType.SelectedItem.Text.ToString(), Convert.ToDouble(txtAmount.Text.ToString()),
                                Convert.ToDouble(0.00), Convert.ToInt32(0.00));

                    System.Data.DataSet ds = objBal.GetAgentById(Convert.ToInt32(ddlAgents.SelectedItem.Value.ToString()));

                    string body = "Dear " + ds.Tables[0].Rows[0]["UserName"].ToString() + ", <br/> " + "Rs. " + txtAmount.Text.ToString() + "/- amount has been credited in your account. <br/><br/> Thanks, <br/>Love Journey Team";
                    bool res = Mailsender.SendEmail(ds.Tables[0].Rows[0]["EmailId"].ToString(), "", "", "Deposit Details", body);

                    lblMsg.InnerHtml = msg;
                    BindDeposits(); txtAmount.Text = txtDepositDetails.Text = txtTransactionNo.Text = txtReason.Text = ""; rbtnType.SelectedIndex = -1;
                }
                else if (Session["Role"].ToString() == "Distributor")
                {
                    if (Convert.ToDouble(Session["Balance"].ToString()) >= Convert.ToDouble(txtAmount.Text.ToString()))
                    {
                        ddlAgents.SelectedItem.Value = value.Value;
                        string msg = objBal.AddAgentDeposit(Convert.ToInt32(ddlAgents.SelectedItem.Value.ToString())
                            , Convert.ToDouble(txtAmount.Text.ToString()), txtDepositDetails.Text.Trim().ToString(), Convert.ToInt32(Session["UserID"].ToString())
                            , rbtnType.SelectedItem.Text.ToString(), txtTransactionNo.Text.Trim().ToString(), txtReason.Text.Trim());

                        BindDeposits();
                        DeductAgentBalance(Convert.ToInt32(ddlAgents.SelectedItem.Value), Convert.ToDouble(0.00),
                                    Convert.ToInt32(Userid), rbtnType.SelectedItem.Text.ToString(), Convert.ToDouble(txtAmount.Text.ToString()),
                                    Convert.ToDouble(0.00), Convert.ToInt32(0.00));

                        lblMsg.InnerHtml = msg;

                        if (msg == "Inserted Successfully.")
                        {
                            objBal.deductDistributorbalance(Convert.ToInt32(Session["UserID"].ToString()), Convert.ToDouble(txtAmount.Text.ToString()), "Deduct");

                            ClsBAL objBAL = new ClsBAL();
                            System.Data.DataSet dataset = objBAL.GetAgentByUserId(Convert.ToInt32(Session["UserID"].ToString()));
                            Session["Balance"] = dataset.Tables[0].Rows[0]["Balance"].ToString();

                            Label balance = (Label)this.Master.FindControl("lblDbBal");
                            balance.Text = "Your balance is : " + " " + Session["Balance"].ToString();

                        }

                        System.Data.DataSet ds = objBal.GetAgentById(Convert.ToInt32(ddlAgents.SelectedItem.Value.ToString()));

                        string body = "Dear " + ds.Tables[0].Rows[0]["UserName"].ToString() + ", <br/> " + "Rs. " + txtAmount.Text.ToString() + "/- amount has been credited in your account. <br/><br/> Thanks, <br/>Love Journey Team";
                        bool res = Mailsender.SendEmail(ds.Tables[0].Rows[0]["EmailId"].ToString(), "", "", "Deposit Details", body);

                        BindDeposits(); txtAmount.Text = txtDepositDetails.Text = txtTransactionNo.Text = txtReason.Text = ""; rbtnType.SelectedIndex = -1;
                    }
                    else
                    {
                        lblMsg.InnerHtml = "Your balance should be greater than the adding amount.";
                    }
                }
            }
        }
        catch (Exception ex)
        {
            lblMsg.InnerHtml = ex.Message;

        }
    }
开发者ID:srisai339,项目名称:LoveJourney_Working,代码行数:87,代码来源:Agents.aspx.cs


注:本文中的BAL.ClsBAL.deductDistributorbalance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。