Beispiel #1
0
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     if (!Page.IsValid)
     {
         return;
     }
     try
     {
         obj.MemberId        = txtboxMemberId.Text.Trim();
         obj.CurrentBalance  = Convert.ToDouble(txtcurbal.Text.Trim());
         obj.TotalPoint      = Convert.ToDouble(txtadjustment.Text.Trim());
         obj.Remarks         = txtRemarks.Text.Trim();
         obj.CurrentBalance  = obj.CurrentBalance + Convert.ToDouble(obj.TotalPoint);
         obj.TransactionType = "ADJ";
         if (obj.TotalPoint > 0)
         {
             obj.NumberType = "Added";
         }
         else
         {
             obj.NumberType = "Removed";
         }
         bool result1 = B.UpdateCurBal(obj); //Business layer
         if (result1 == true)
         {
             string CloseWindow1 = "alert('Incentive Point Saved successfully')";
             //ScriptManager.RegisterStartupScript(EditUpdatePanel, EditUpdatePanel.GetType(), "alert", CloseWindow1, true);
             ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindow", CloseWindow1, true);
             btnUpdate.Enabled = false;
             EmailDetails details = new EmailDetails();
             details = SendMail(txtboxMemberId.Text, txtcurbal.Text, txtadjustment.Text, txtRemarks.Text, obj.CurrentBalance, obj.NumberType);
             SendMailObject obj1    = new SendMailObject();
             bool           resultv = obj1.InsertIntoEmailQueue(details);
         }
         else
         {
             string CloseWindow1 = "alert('Incentive Point Saved successfully')";
             ScriptManager.RegisterStartupScript(EditUpdatePanel, EditUpdatePanel.GetType(), "alert", CloseWindow1, true);
             btnUpdate.Enabled = false;
         }
     }
     catch (Exception ex)
     {
         log.Error(ex.StackTrace);
         log.Error(ex.Message);
         ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Error!!!!!!!!!!')</script>");
     }
 }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (!Page.IsValid)
        {
            return;
        }
        try
        {
            IncentiveBusiness obj = new IncentiveBusiness();
            IncentivePoint    j   = new IncentivePoint();

            if (txtMemberId.Text.Trim() == "")
            {
                string CloseWindow1 = "alert('Please enter member id')";
                ScriptManager.RegisterStartupScript(EditUpdatePanel, EditUpdatePanel.GetType(), "alert", CloseWindow1, true);
                return;
            }
            string memberid      = txtMemberId.Text.Trim();
            string year          = DdlYear.SelectedValue;
            string pointsAwarded = txtPointsAwarded.Text.Trim();
            j.MemberId = memberid;
            j.Year     = Convert.ToInt32(year);


            j.Points         = Convert.ToDouble(pointsAwarded);
            j.TotalPoint     = j.Points;
            j.ThresholdPoint = j.Points;
            string currentbalance = obj.SelectMemberCurrentBal(memberid);
            j.CurrentBalance = Convert.ToDouble(currentbalance);
            j.CurrentBalance = j.CurrentBalance + j.TotalPoint;
            j.Remarks        = txtRemarks.Text;
            bool result = false;


            result = obj.AdditionalPointAward(memberid, j);

            if (result == true)
            {
                SendMail();
                string CloseWindow1 = "alert('Additional Points Saved successfully')";
                ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "CloseWindow", CloseWindow1, true);
                btnSave.Enabled       = false;
                txtPointsAwarded.Text = "";
                txtMemberId.Text      = "";
                txtcurbal.Text        = "";
                txtRemarks.Text       = "";
                lblNote.Visible       = false;
                lblNote1.Visible      = false;
                DdlYear.Items.Clear();
            }
            else
            {
                string CloseWindow1 = "alert('problem while saving')";
                ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "CloseWindow", CloseWindow1, true);
                btnSave.Enabled = false;
            }
        }
        catch (Exception ex)
        {
            string CloseWindow1 = "alert('problem while saving points')";
            ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "CloseWindow", CloseWindow1, true);
            btnSave.Enabled = true;
            log.Error(ex.Message);
            log.Error(ex.StackTrace);
        }
    }
Beispiel #3
0
 protected void BtnSave_Click(object sender, EventArgs e)
 {
     if (!Page.IsValid)
     {
         return;
     }
     try
     {
         if (ChkTypeOfUtilization.SelectedValue == "UTO")
         {
             if (txtOldBalance.Text == "0")
             {
                 string CloseWindow1 = "alert('Old scheme is zero.Cannot be used for Utilization')";
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindow", CloseWindow1, true);
                 return;
             }
             if (Convert.ToDouble(txtOldBalance.Text) < Convert.ToDouble(txtUtilization.Text.Trim()))
             {
                 string CloseWindow1 = "alert('Utilization point must be eqaul or less than old scheme')";
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindow", CloseWindow1, true);
                 return;
             }
         }
         else
         {
             if (txtCurrentBalance.Text == "0")
             {
                 string CloseWindow1 = "alert('Current  scheme is zero.Cannot be used for Utilization')";
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindow", CloseWindow1, true);
                 return;
             }
             if (Convert.ToDouble(txtCurrentBalance.Text) < Convert.ToDouble(txtUtilization.Text.Trim()))
             {
                 string CloseWindow1 = "alert('Utilization point must be eqaul or less than current scheme')";
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindow", CloseWindow1, true);
                 return;
             }
         }
         IncentivePoint obj = new IncentivePoint();
         obj.MemberId    = txtID.Text.Trim();
         obj.Utilization = Convert.ToDouble(txtUtilization.Text.Trim());
         obj.Remarks     = txtRemarks.Text.Trim();
         if (ChkTypeOfUtilization.SelectedValue == "UTN")
         {
             obj.CurrentBalance = Convert.ToDouble(txtCurrentBalance.Text.Trim());
             obj.CurrentBalance = obj.CurrentBalance - obj.Utilization;
         }
         else
         {
             obj.CurrentBalance = Convert.ToDouble(txtOldBalance.Text.Trim());
             obj.CurrentBalance = obj.CurrentBalance - obj.Utilization;
         }
         obj.Utilization     = Convert.ToDouble("-" + txtUtilization.Text.Trim());
         obj.TransactionType = ChkTypeOfUtilization.SelectedValue;
         obj.UtilizationType = ChkTypeOfUtilization.SelectedValue;
         // obj.UtilizationType = "UTN";
         obj.UtilizationDate = Convert.ToDateTime(txtUtilizationDate.Text.Trim());
         bool result1 = B.InsertUtilizationPoint(obj); //Business layer
         if (result1 == true)
         {
             string CloseWindow1 = "alert('Utilization point entered successfully')";
             //ScriptManager.RegisterStartupScript(EditUpdatePanel, EditUpdatePanel.GetType(), "alert", CloseWindow1, true);
             ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindow", CloseWindow1, true);
             btnSave.Enabled = false;
             Label1.Visible  = true;
             DataTable dt = new DataTable();
             dt = B.CountUtilizationPoints(txtID.Text.Trim());
             if (dt.Rows.Count > 0)
             {
                 GridView2.Columns[2].FooterText = "Total";
                 GridView2.Columns[3].FooterText = dt.Rows[0]["count1"].ToString();
                 GridView2.Columns[4].FooterText = dt.Rows[0]["count2"].ToString();
                 GridView2.DataSource            = dt;
                 GridView2.DataBind();
             }
             {
                 GridView2.DataBind();
             }
             GridView2.Visible = true;
             if (ChkTypeOfUtilization.SelectedValue == "UTN")
             {
                 obj.CurrentBalance     = Convert.ToDouble(txtCurrentBalance.Text.Trim());
                 txtCurrentBalance.Text = (obj.CurrentBalance - Convert.ToDouble(txtUtilization.Text.Trim())).ToString();
             }
             else
             {
                 obj.CurrentBalance = Convert.ToDouble(txtOldBalance.Text.Trim());
                 txtOldBalance.Text = (obj.CurrentBalance - Convert.ToDouble(txtUtilization.Text.Trim())).ToString();
             }
             txtUtilization.Text     = "";
             txtRemarks.Text         = "";
             txtUtilizationDate.Text = DateTime.Now.ToShortDateString();
         }
         else
         {
             string CloseWindow1 = "alert('Problem while saving data')";
             ScriptManager.RegisterStartupScript(EditUpdatePanel, EditUpdatePanel.GetType(), "alert", CloseWindow1, true);
             btnSave.Enabled = true;
         }
     }
     catch (Exception ex)
     {
         log.Error(ex.StackTrace);
         log.Error(ex.Message);
         log.Error("Error!!!!!!!!!!!!!!!! ");
         ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Error!!!!!!!!!!')</script>");
     }
 }
    protected void btnupdatePatent_Click(object sender, EventArgs e)
    {
        //if (!Page.IsValid)
        //{
        //    return;
        //}
        try
        {
            if (txttotalPointPatent.Text.Trim() == "")
            {
                string CloseWindow1 = "alert('Please enter total point')";
                ScriptManager.RegisterStartupScript(EditUpdatePanel, EditUpdatePanel.GetType(), "alert", CloseWindow1, true);
                return;
            }
            if (txtPatentRemarks.Text.Trim() == "")
            {
                string CloseWindow1 = "alert('Please enter Remarks')";
                ScriptManager.RegisterStartupScript(EditUpdatePanel, EditUpdatePanel.GetType(), "alert", CloseWindow1, true);
                return;
            }



            bool result = B.CheckPatentId(txtreferencePatent.Text.Trim(), txtmemberPatent.Text.Trim());
            if (result == false)
            {
                string CloseWindow1 = "alert('Invalid reference id')";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindow", CloseWindow1, true);
                return;
            }
            obj.MemberId       = txtmemberPatent.Text.Trim();
            obj.CurrentBalance = Convert.ToDouble(TxtcurrentPatent.Text.Trim());
            //if (txtBasePoint.Text.Trim() != "")
            //{
            //    obj.BasePoint = Convert.ToDouble(txtBasePoint.Text.Trim());
            //}
            //if (txtSNIPSJRPoint.Text.Trim() != "")
            //{
            //    obj.SNIPSJRPoint = Convert.ToDouble(txtSNIPSJRPoint.Text.Trim());
            //}
            //point 3 (crosses 6 publication) is awarded once in a year
            //if (txtThresholdPoint.Text.Trim() != "")
            //{
            //    obj.ThresholdPoint = Convert.ToDouble(txtThresholdPoint.Text.Trim());
            //}
            obj.TotalPoint      = Convert.ToDouble(txttotalPointPatent.Text);
            obj.ReferenceNumber = txtreferencePatent.Text.Trim();
            obj.Remarks         = txtPatentRemarks.Text.Trim();
            obj.CurrentBalance  = obj.CurrentBalance + obj.TotalPoint;
            obj.TransactionType = "ADJ";
            bool result1 = B.UpdateCurBal(obj);     //Business layer

            if (result1 == true)
            {
                string CloseWindow1 = "alert('Incentive Point Saved successfully')";
                //ScriptManager.RegisterStartupScript(EditUpdatePanel, EditUpdatePanel.GetType(), "alert", CloseWindow1, true);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindow", CloseWindow1, true);
                btnupdatePatent.Enabled = false;
                TxtcurrentPatent.Text   = obj.CurrentBalance.ToString();
                //txtBasePoint.Text = "";
                //txtSNIPSJRPoint.Text = "";
                txtPatentRemarks.Text    = "";
                txttotalPointPatent.Text = "";
            }
            else
            {
                string CloseWindow1 = "alert('Incentive Point Saved successfully')";
                // ScriptManager.RegisterStartupScript(EditUpdatePanel, EditUpdatePanel.GetType(), "alert", CloseWindow1, true);
                btnupdatePatent.Enabled = false;
            }
        }
        catch (Exception ex)
        {
            log.Error(ex.StackTrace);
            log.Error(ex.Message);
            ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Error')</script>");
        }
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        //EditUpdatePanel.Update();
        if (!Page.IsValid)
        {
            return;
        }
        try
        {
            if (txtBasePoint.Text.Trim() == "" && txtSNIPSJRPoint.Text.Trim() == "")
            {
                string CloseWindow1 = "alert('Please enter atleast one point')";
                ScriptManager.RegisterStartupScript(EditUpdatePanel, EditUpdatePanel.GetType(), "alert", CloseWindow1, true);
                return;
            }

            bool result = B.CheckPublcationId(txtReferenceId.Text.Trim(), txtboxMemberId.Text.Trim());
            if (result == false)
            {
                string CloseWindow1 = "alert('Invalid reference id')";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindow", CloseWindow1, true);
                return;
            }
            obj.MemberId       = txtboxMemberId.Text.Trim();
            obj.CurrentBalance = Convert.ToDouble(txtcurbal.Text.Trim());
            if (txtBasePoint.Text.Trim() != "")
            {
                obj.BasePoint = Convert.ToDouble(txtBasePoint.Text.Trim());
            }
            if (txtSNIPSJRPoint.Text.Trim() != "")
            {
                obj.SNIPSJRPoint = Convert.ToDouble(txtSNIPSJRPoint.Text.Trim());
            }
            //point 3 (crosses 6 publication) is awarded once in a year
            //if (txtThresholdPoint.Text.Trim() != "")
            //{
            //    obj.ThresholdPoint = Convert.ToDouble(txtThresholdPoint.Text.Trim());
            //}
            obj.TotalPoint      = (obj.BasePoint + obj.SNIPSJRPoint + obj.ThresholdPoint);
            obj.ReferenceNumber = txtReferenceId.Text.Trim();
            obj.Remarks         = txtRemarks.Text.Trim();
            obj.CurrentBalance  = obj.CurrentBalance + obj.TotalPoint;
            obj.TransactionType = "ADJ";
            if (obj.TotalPoint > 0)
            {
                obj.NumberType        = "Added";
                Session["Numbertype"] = "Added";
            }
            else
            {
                obj.NumberType        = "Removed";
                Session["Numbertype"] = "Removed";
            }
            bool result1 = B.UpdateCurBal(obj);     //Business layer

            if (result1 == true)
            {
                string CloseWindow1 = "alert('Incentive Point Saved successfully')";
                //ScriptManager.RegisterStartupScript(EditUpdatePanel, EditUpdatePanel.GetType(), "alert", CloseWindow1, true);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindow", CloseWindow1, true);
                btnUpdate.Enabled = false;
                txtcurbal.Text    = obj.CurrentBalance.ToString();
                SendMail();
                txtBasePoint.Text    = "";
                txtSNIPSJRPoint.Text = "";
                txtRemarks.Text      = "";
                txtTotalPoint.Text   = "";
            }
            else
            {
                string CloseWindow1 = "alert('Problem while updating the Incentive point')";
                ScriptManager.RegisterStartupScript(EditUpdatePanel, EditUpdatePanel.GetType(), "alert", CloseWindow1, true);
                btnUpdate.Enabled = false;
            }
        }
        catch (Exception ex)
        {
            log.Error(ex.StackTrace);
            log.Error(ex.Message);
            ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Error')</script>");
        }
    }