C# 在ASP.NET中运行的应用程序未提供所需的输出

C# 在ASP.NET中运行的应用程序未提供所需的输出,c#,asp.net,C#,Asp.net,我有一个应用程序没有正确计算百分比。假设以百分比计算输入。但在某个地方有一个bug阻止它这么做 例如,如果我输入任何以小数开头的数字,如0.01或0.001或0.02等,它将分别给出输出1、0.1和2。如果我输入任何整数,如1、2、3、10,它将始终给出相同的输出,即0.01 这项申请是由一些承包商在5年前提出的。负责此应用程序的主管已离开。这让我和我在c#和asp.net方面的一点经验都无法解决这个问题。在我寻求任何进一步的帮助之前,我想我应该问问那里的天才们,看看他们有什么要说的,也许在你们

我有一个应用程序没有正确计算百分比。假设以百分比计算输入。但在某个地方有一个bug阻止它这么做

例如,如果我输入任何以小数开头的数字,如
0.01
0.001
0.02
等,它将分别给出输出
1
0.1
2
。如果我输入任何整数,如
1
2
3
10
,它将始终给出相同的输出,即
0.01

这项申请是由一些承包商在5年前提出的。负责此应用程序的主管已离开。这让我和我在c#和asp.net方面的一点经验都无法解决这个问题。在我寻求任何进一步的帮助之前,我想我应该问问那里的天才们,看看他们有什么要说的,也许在你们的帮助下,我最终会解决这个问题。我确实和我部门的其他IT人员谈过,他们猜测可能是因为下面的代码

    if (int.TryParse(string.IsNullOrEmpty(txtminup.Text) ? "0" : txtminup.Text, out n))
我不是100%确定如何调试或找到问题。如果有人能给我指出任何可能对我有帮助的东西,或者提供一些我可以查阅的资源,那将非常有帮助。我复制了几行代码。我可以提供更多信息,但不知道哪一个更相关

    protected string MinUp
{
    get
    {
        return (string)ViewState["minup"];
    }
    set
    {
        ViewState["minup"] = value;
    }
}
==============

  MinUp = rows["process_minimum_up"].ToString();
                        PIMSSource = rows["pims_source"].ToString();
                        //MinUp = Convert.ToDouble()
                        if (MinUp != string.Empty || MinUp.Length > 0)
                        {
                            MinUp = Convert.ToString(Convert.ToDouble(MinUp) * 100);
                        }     
    if (DCFoption != "P")
        {
            MinUp = "";
        }

        if (DcfmSeq != "0")
        {
            int caret;
            caret = ddlvbcfmseq.SelectedValue.IndexOf("^");
            DcfmSeq = DcfmSeq.Substring(0, caret);
        }

        if (DCFoption != "P" && ddlpdwnlst.SelectedItem.Value == "0")
        {
            MinUp = "";
        }

        if (PIMSTagId == "Not specified")
        {
            PIMSTagId = "";
        }

        if (MinUp != string.Empty || MinUp.Length > 0)
        {
            int n;
            if (int.TryParse(string.IsNullOrEmpty(txtminup.Text) ? "0" : txtminup.Text, out n))
            {
                MinUp = Convert.ToString(Convert.ToInt32(MinUp) / 100);
                if (Convert.ToInt32(MinUp) < 0)
                {
                    MinUp = "0";
                }
                else if (Convert.ToInt32(MinUp) > 1)
                {
                    MinUp = "1";
                }
            }
        }

        if ((DCFoption == string.Empty || DCFoption.Length < 1) || DCFoption == "D")
        {
            MinUp = "";
        }

        if (MinUp != string.Empty || MinUp.Length > 0)
        {
            int n;
            if (int.TryParse(string.IsNullOrEmpty(txtminup.Text) ? "0" : txtminup.Text, out n))
            {
              if (Convert.ToDouble(MinUp) <= 0)
              {
                  MinUp = ".0001";
              }
            }
        }
    if (rdbProcess.Checked == true && (txtminup.Text == string.Empty || txtminup.Text.Length < 1) && ddlpdwnlst.SelectedItem.Value == "0")
                                                            {
                                                                Utilities.ShowAlert(this.Page, Resources.Resource.RIPimsUpload_MinUptime.ToString());
                                                                txtminup.Focus();
    int n;
                                                                        if (!int.TryParse(string.IsNullOrEmpty(txtRound.Text) ? "0" : txtRound.Text, out n))
                                                                        {
                                                                            Utilities.ShowAlert(this.Page, Resources.Resource.RIPimsUpload_RoundingNum.ToString());
                                                                        }
                                                                        else if (!IsDouble(txtminup.Text))
    try
    {
        DBResults objDBResult = new DBResults();
        WEIS.RIPimsUpload objRI = new WEIS.RIPimsUpload();
        objDBResult = objRI.SaveItemInsert(reciseq, shortname, name, eiscprocess2, period, media, euseq, eqmtseq, eiscuom, pollseq, dcfmseq, rounding, formula, physmin, physmax, warn1min, warn1max, warn2min, warn2max, pimsStatus, pimsTagidp, datapoint, freq, periodoffset, initpimstTagId, initDataPoint, initLoadFrequency, initperiodoffset, day0result, retention, audituser, dcfoption, minup, pimssource);

        if (objDBResult.oraErrMsg.Trim().ToString().Length > 1)
        {
            Exception ex = new Exception(objDBResult.oraErrMsg.ToString());
            throw ex;
        }

        return objDBResult.oraIntReturn;
    }
    protected int SaveItemUpdate(int reciseq, string shortname, string name, int eiscprocess2, int period, int media, int euseq, int eqmtseq, int eiscuom, int pollseq, int dcfmseq, string rounding, string formula, string physmin, string physmax, string warn1min, string warn1max, string warn2min, string warn2max, string pimsStatus, string pimsTagidp, string datapoint, string freq, char periodoffset, string initpimstTagId, char initDataPoint, char initLoadFrequency, char initperiodoffset, string day0result, string retention, string audituser, string dcfoption, string minup, string pimssource)
{
    try
    {
        DBResults objDBResult = new DBResults();
        WEIS.RIPimsUpload objRI = new WEIS.RIPimsUpload();
        objDBResult = objRI.SaveItemUpdate(reciseq, shortname, name, eiscprocess2, period, media, euseq, eqmtseq, eiscuom, pollseq, dcfmseq, rounding, formula, physmin, physmax, warn1min, warn1max, warn2min, warn2max, pimsStatus, pimsTagidp, datapoint, freq, periodoffset, initpimstTagId, initDataPoint, initLoadFrequency, initperiodoffset, day0result, retention, audituser, dcfoption, minup, pimssource);

        if (objDBResult.oraErrMsg.Trim().ToString().Length > 1)
        {
            Exception ex = new Exception(objDBResult.oraErrMsg.ToString());
            throw ex;
        }
    protected void btnSave_Click(object sender, EventArgs e)
{
    try
    {
        lblUserMsgText.Text = "";
        bool dcfm = ddlvbcfmseq.Enabled;
        string minup, dcfoption="";

        minup = txtminup.Text;

        if (rdbNone.Checked == true)
        {
            dcfoption = "NONE";
        }
        else if (rdbProcess.Checked == true)
        {
            dcfoption = "P";
        }
        else if (rdbData.Checked == true)
        {
            dcfoption = "D";
        }

        Index = Convert.ToInt32(rdbListradios.SelectedIndex);

        SaveItem();

        RetainClientControlValues(dcfm, dcfoption, minup);
    }
    protected void btnExcMod_Click(object sender, EventArgs e)
{
    try
    {
        lblUserMsgText.Text = "";
        bool dcfm = ddlvbcfmseq.Enabled;
        string minup, dcfoption = "";
        Index = Convert.ToInt32(rdbListradios.SelectedIndex);
        minup = txtminup.Text;

        if (rdbNone.Checked == true)
        {
            dcfoption = "NONE";
        }
        else if (rdbProcess.Checked == true)
        {
            dcfoption = "P";
        }
        else if (rdbData.Checked == true)
        {
            dcfoption = "D";
        }

        Button btn = (Button)sender;
        int evntseq = Convert.ToInt32(btn.CommandArgument.ToString());

        RetainClientControlValues(dcfm, dcfoption, minup);
        //Response.Write("you clicked on button");
    }
=====================

  MinUp = rows["process_minimum_up"].ToString();
                        PIMSSource = rows["pims_source"].ToString();
                        //MinUp = Convert.ToDouble()
                        if (MinUp != string.Empty || MinUp.Length > 0)
                        {
                            MinUp = Convert.ToString(Convert.ToDouble(MinUp) * 100);
                        }     
    if (DCFoption != "P")
        {
            MinUp = "";
        }

        if (DcfmSeq != "0")
        {
            int caret;
            caret = ddlvbcfmseq.SelectedValue.IndexOf("^");
            DcfmSeq = DcfmSeq.Substring(0, caret);
        }

        if (DCFoption != "P" && ddlpdwnlst.SelectedItem.Value == "0")
        {
            MinUp = "";
        }

        if (PIMSTagId == "Not specified")
        {
            PIMSTagId = "";
        }

        if (MinUp != string.Empty || MinUp.Length > 0)
        {
            int n;
            if (int.TryParse(string.IsNullOrEmpty(txtminup.Text) ? "0" : txtminup.Text, out n))
            {
                MinUp = Convert.ToString(Convert.ToInt32(MinUp) / 100);
                if (Convert.ToInt32(MinUp) < 0)
                {
                    MinUp = "0";
                }
                else if (Convert.ToInt32(MinUp) > 1)
                {
                    MinUp = "1";
                }
            }
        }

        if ((DCFoption == string.Empty || DCFoption.Length < 1) || DCFoption == "D")
        {
            MinUp = "";
        }

        if (MinUp != string.Empty || MinUp.Length > 0)
        {
            int n;
            if (int.TryParse(string.IsNullOrEmpty(txtminup.Text) ? "0" : txtminup.Text, out n))
            {
              if (Convert.ToDouble(MinUp) <= 0)
              {
                  MinUp = ".0001";
              }
            }
        }
    if (rdbProcess.Checked == true && (txtminup.Text == string.Empty || txtminup.Text.Length < 1) && ddlpdwnlst.SelectedItem.Value == "0")
                                                            {
                                                                Utilities.ShowAlert(this.Page, Resources.Resource.RIPimsUpload_MinUptime.ToString());
                                                                txtminup.Focus();
    int n;
                                                                        if (!int.TryParse(string.IsNullOrEmpty(txtRound.Text) ? "0" : txtRound.Text, out n))
                                                                        {
                                                                            Utilities.ShowAlert(this.Page, Resources.Resource.RIPimsUpload_RoundingNum.ToString());
                                                                        }
                                                                        else if (!IsDouble(txtminup.Text))
    try
    {
        DBResults objDBResult = new DBResults();
        WEIS.RIPimsUpload objRI = new WEIS.RIPimsUpload();
        objDBResult = objRI.SaveItemInsert(reciseq, shortname, name, eiscprocess2, period, media, euseq, eqmtseq, eiscuom, pollseq, dcfmseq, rounding, formula, physmin, physmax, warn1min, warn1max, warn2min, warn2max, pimsStatus, pimsTagidp, datapoint, freq, periodoffset, initpimstTagId, initDataPoint, initLoadFrequency, initperiodoffset, day0result, retention, audituser, dcfoption, minup, pimssource);

        if (objDBResult.oraErrMsg.Trim().ToString().Length > 1)
        {
            Exception ex = new Exception(objDBResult.oraErrMsg.ToString());
            throw ex;
        }

        return objDBResult.oraIntReturn;
    }
    protected int SaveItemUpdate(int reciseq, string shortname, string name, int eiscprocess2, int period, int media, int euseq, int eqmtseq, int eiscuom, int pollseq, int dcfmseq, string rounding, string formula, string physmin, string physmax, string warn1min, string warn1max, string warn2min, string warn2max, string pimsStatus, string pimsTagidp, string datapoint, string freq, char periodoffset, string initpimstTagId, char initDataPoint, char initLoadFrequency, char initperiodoffset, string day0result, string retention, string audituser, string dcfoption, string minup, string pimssource)
{
    try
    {
        DBResults objDBResult = new DBResults();
        WEIS.RIPimsUpload objRI = new WEIS.RIPimsUpload();
        objDBResult = objRI.SaveItemUpdate(reciseq, shortname, name, eiscprocess2, period, media, euseq, eqmtseq, eiscuom, pollseq, dcfmseq, rounding, formula, physmin, physmax, warn1min, warn1max, warn2min, warn2max, pimsStatus, pimsTagidp, datapoint, freq, periodoffset, initpimstTagId, initDataPoint, initLoadFrequency, initperiodoffset, day0result, retention, audituser, dcfoption, minup, pimssource);

        if (objDBResult.oraErrMsg.Trim().ToString().Length > 1)
        {
            Exception ex = new Exception(objDBResult.oraErrMsg.ToString());
            throw ex;
        }
    protected void btnSave_Click(object sender, EventArgs e)
{
    try
    {
        lblUserMsgText.Text = "";
        bool dcfm = ddlvbcfmseq.Enabled;
        string minup, dcfoption="";

        minup = txtminup.Text;

        if (rdbNone.Checked == true)
        {
            dcfoption = "NONE";
        }
        else if (rdbProcess.Checked == true)
        {
            dcfoption = "P";
        }
        else if (rdbData.Checked == true)
        {
            dcfoption = "D";
        }

        Index = Convert.ToInt32(rdbListradios.SelectedIndex);

        SaveItem();

        RetainClientControlValues(dcfm, dcfoption, minup);
    }
    protected void btnExcMod_Click(object sender, EventArgs e)
{
    try
    {
        lblUserMsgText.Text = "";
        bool dcfm = ddlvbcfmseq.Enabled;
        string minup, dcfoption = "";
        Index = Convert.ToInt32(rdbListradios.SelectedIndex);
        minup = txtminup.Text;

        if (rdbNone.Checked == true)
        {
            dcfoption = "NONE";
        }
        else if (rdbProcess.Checked == true)
        {
            dcfoption = "P";
        }
        else if (rdbData.Checked == true)
        {
            dcfoption = "D";
        }

        Button btn = (Button)sender;
        int evntseq = Convert.ToInt32(btn.CommandArgument.ToString());

        RetainClientControlValues(dcfm, dcfoption, minup);
        //Response.Write("you clicked on button");
    }
======================

  MinUp = rows["process_minimum_up"].ToString();
                        PIMSSource = rows["pims_source"].ToString();
                        //MinUp = Convert.ToDouble()
                        if (MinUp != string.Empty || MinUp.Length > 0)
                        {
                            MinUp = Convert.ToString(Convert.ToDouble(MinUp) * 100);
                        }     
    if (DCFoption != "P")
        {
            MinUp = "";
        }

        if (DcfmSeq != "0")
        {
            int caret;
            caret = ddlvbcfmseq.SelectedValue.IndexOf("^");
            DcfmSeq = DcfmSeq.Substring(0, caret);
        }

        if (DCFoption != "P" && ddlpdwnlst.SelectedItem.Value == "0")
        {
            MinUp = "";
        }

        if (PIMSTagId == "Not specified")
        {
            PIMSTagId = "";
        }

        if (MinUp != string.Empty || MinUp.Length > 0)
        {
            int n;
            if (int.TryParse(string.IsNullOrEmpty(txtminup.Text) ? "0" : txtminup.Text, out n))
            {
                MinUp = Convert.ToString(Convert.ToInt32(MinUp) / 100);
                if (Convert.ToInt32(MinUp) < 0)
                {
                    MinUp = "0";
                }
                else if (Convert.ToInt32(MinUp) > 1)
                {
                    MinUp = "1";
                }
            }
        }

        if ((DCFoption == string.Empty || DCFoption.Length < 1) || DCFoption == "D")
        {
            MinUp = "";
        }

        if (MinUp != string.Empty || MinUp.Length > 0)
        {
            int n;
            if (int.TryParse(string.IsNullOrEmpty(txtminup.Text) ? "0" : txtminup.Text, out n))
            {
              if (Convert.ToDouble(MinUp) <= 0)
              {
                  MinUp = ".0001";
              }
            }
        }
    if (rdbProcess.Checked == true && (txtminup.Text == string.Empty || txtminup.Text.Length < 1) && ddlpdwnlst.SelectedItem.Value == "0")
                                                            {
                                                                Utilities.ShowAlert(this.Page, Resources.Resource.RIPimsUpload_MinUptime.ToString());
                                                                txtminup.Focus();
    int n;
                                                                        if (!int.TryParse(string.IsNullOrEmpty(txtRound.Text) ? "0" : txtRound.Text, out n))
                                                                        {
                                                                            Utilities.ShowAlert(this.Page, Resources.Resource.RIPimsUpload_RoundingNum.ToString());
                                                                        }
                                                                        else if (!IsDouble(txtminup.Text))
    try
    {
        DBResults objDBResult = new DBResults();
        WEIS.RIPimsUpload objRI = new WEIS.RIPimsUpload();
        objDBResult = objRI.SaveItemInsert(reciseq, shortname, name, eiscprocess2, period, media, euseq, eqmtseq, eiscuom, pollseq, dcfmseq, rounding, formula, physmin, physmax, warn1min, warn1max, warn2min, warn2max, pimsStatus, pimsTagidp, datapoint, freq, periodoffset, initpimstTagId, initDataPoint, initLoadFrequency, initperiodoffset, day0result, retention, audituser, dcfoption, minup, pimssource);

        if (objDBResult.oraErrMsg.Trim().ToString().Length > 1)
        {
            Exception ex = new Exception(objDBResult.oraErrMsg.ToString());
            throw ex;
        }

        return objDBResult.oraIntReturn;
    }
    protected int SaveItemUpdate(int reciseq, string shortname, string name, int eiscprocess2, int period, int media, int euseq, int eqmtseq, int eiscuom, int pollseq, int dcfmseq, string rounding, string formula, string physmin, string physmax, string warn1min, string warn1max, string warn2min, string warn2max, string pimsStatus, string pimsTagidp, string datapoint, string freq, char periodoffset, string initpimstTagId, char initDataPoint, char initLoadFrequency, char initperiodoffset, string day0result, string retention, string audituser, string dcfoption, string minup, string pimssource)
{
    try
    {
        DBResults objDBResult = new DBResults();
        WEIS.RIPimsUpload objRI = new WEIS.RIPimsUpload();
        objDBResult = objRI.SaveItemUpdate(reciseq, shortname, name, eiscprocess2, period, media, euseq, eqmtseq, eiscuom, pollseq, dcfmseq, rounding, formula, physmin, physmax, warn1min, warn1max, warn2min, warn2max, pimsStatus, pimsTagidp, datapoint, freq, periodoffset, initpimstTagId, initDataPoint, initLoadFrequency, initperiodoffset, day0result, retention, audituser, dcfoption, minup, pimssource);

        if (objDBResult.oraErrMsg.Trim().ToString().Length > 1)
        {
            Exception ex = new Exception(objDBResult.oraErrMsg.ToString());
            throw ex;
        }
    protected void btnSave_Click(object sender, EventArgs e)
{
    try
    {
        lblUserMsgText.Text = "";
        bool dcfm = ddlvbcfmseq.Enabled;
        string minup, dcfoption="";

        minup = txtminup.Text;

        if (rdbNone.Checked == true)
        {
            dcfoption = "NONE";
        }
        else if (rdbProcess.Checked == true)
        {
            dcfoption = "P";
        }
        else if (rdbData.Checked == true)
        {
            dcfoption = "D";
        }

        Index = Convert.ToInt32(rdbListradios.SelectedIndex);

        SaveItem();

        RetainClientControlValues(dcfm, dcfoption, minup);
    }
    protected void btnExcMod_Click(object sender, EventArgs e)
{
    try
    {
        lblUserMsgText.Text = "";
        bool dcfm = ddlvbcfmseq.Enabled;
        string minup, dcfoption = "";
        Index = Convert.ToInt32(rdbListradios.SelectedIndex);
        minup = txtminup.Text;

        if (rdbNone.Checked == true)
        {
            dcfoption = "NONE";
        }
        else if (rdbProcess.Checked == true)
        {
            dcfoption = "P";
        }
        else if (rdbData.Checked == true)
        {
            dcfoption = "D";
        }

        Button btn = (Button)sender;
        int evntseq = Convert.ToInt32(btn.CommandArgument.ToString());

        RetainClientControlValues(dcfm, dcfoption, minup);
        //Response.Write("you clicked on button");
    }
===============================

  MinUp = rows["process_minimum_up"].ToString();
                        PIMSSource = rows["pims_source"].ToString();
                        //MinUp = Convert.ToDouble()
                        if (MinUp != string.Empty || MinUp.Length > 0)
                        {
                            MinUp = Convert.ToString(Convert.ToDouble(MinUp) * 100);
                        }     
    if (DCFoption != "P")
        {
            MinUp = "";
        }

        if (DcfmSeq != "0")
        {
            int caret;
            caret = ddlvbcfmseq.SelectedValue.IndexOf("^");
            DcfmSeq = DcfmSeq.Substring(0, caret);
        }

        if (DCFoption != "P" && ddlpdwnlst.SelectedItem.Value == "0")
        {
            MinUp = "";
        }

        if (PIMSTagId == "Not specified")
        {
            PIMSTagId = "";
        }

        if (MinUp != string.Empty || MinUp.Length > 0)
        {
            int n;
            if (int.TryParse(string.IsNullOrEmpty(txtminup.Text) ? "0" : txtminup.Text, out n))
            {
                MinUp = Convert.ToString(Convert.ToInt32(MinUp) / 100);
                if (Convert.ToInt32(MinUp) < 0)
                {
                    MinUp = "0";
                }
                else if (Convert.ToInt32(MinUp) > 1)
                {
                    MinUp = "1";
                }
            }
        }

        if ((DCFoption == string.Empty || DCFoption.Length < 1) || DCFoption == "D")
        {
            MinUp = "";
        }

        if (MinUp != string.Empty || MinUp.Length > 0)
        {
            int n;
            if (int.TryParse(string.IsNullOrEmpty(txtminup.Text) ? "0" : txtminup.Text, out n))
            {
              if (Convert.ToDouble(MinUp) <= 0)
              {
                  MinUp = ".0001";
              }
            }
        }
    if (rdbProcess.Checked == true && (txtminup.Text == string.Empty || txtminup.Text.Length < 1) && ddlpdwnlst.SelectedItem.Value == "0")
                                                            {
                                                                Utilities.ShowAlert(this.Page, Resources.Resource.RIPimsUpload_MinUptime.ToString());
                                                                txtminup.Focus();
    int n;
                                                                        if (!int.TryParse(string.IsNullOrEmpty(txtRound.Text) ? "0" : txtRound.Text, out n))
                                                                        {
                                                                            Utilities.ShowAlert(this.Page, Resources.Resource.RIPimsUpload_RoundingNum.ToString());
                                                                        }
                                                                        else if (!IsDouble(txtminup.Text))
    try
    {
        DBResults objDBResult = new DBResults();
        WEIS.RIPimsUpload objRI = new WEIS.RIPimsUpload();
        objDBResult = objRI.SaveItemInsert(reciseq, shortname, name, eiscprocess2, period, media, euseq, eqmtseq, eiscuom, pollseq, dcfmseq, rounding, formula, physmin, physmax, warn1min, warn1max, warn2min, warn2max, pimsStatus, pimsTagidp, datapoint, freq, periodoffset, initpimstTagId, initDataPoint, initLoadFrequency, initperiodoffset, day0result, retention, audituser, dcfoption, minup, pimssource);

        if (objDBResult.oraErrMsg.Trim().ToString().Length > 1)
        {
            Exception ex = new Exception(objDBResult.oraErrMsg.ToString());
            throw ex;
        }

        return objDBResult.oraIntReturn;
    }
    protected int SaveItemUpdate(int reciseq, string shortname, string name, int eiscprocess2, int period, int media, int euseq, int eqmtseq, int eiscuom, int pollseq, int dcfmseq, string rounding, string formula, string physmin, string physmax, string warn1min, string warn1max, string warn2min, string warn2max, string pimsStatus, string pimsTagidp, string datapoint, string freq, char periodoffset, string initpimstTagId, char initDataPoint, char initLoadFrequency, char initperiodoffset, string day0result, string retention, string audituser, string dcfoption, string minup, string pimssource)
{
    try
    {
        DBResults objDBResult = new DBResults();
        WEIS.RIPimsUpload objRI = new WEIS.RIPimsUpload();
        objDBResult = objRI.SaveItemUpdate(reciseq, shortname, name, eiscprocess2, period, media, euseq, eqmtseq, eiscuom, pollseq, dcfmseq, rounding, formula, physmin, physmax, warn1min, warn1max, warn2min, warn2max, pimsStatus, pimsTagidp, datapoint, freq, periodoffset, initpimstTagId, initDataPoint, initLoadFrequency, initperiodoffset, day0result, retention, audituser, dcfoption, minup, pimssource);

        if (objDBResult.oraErrMsg.Trim().ToString().Length > 1)
        {
            Exception ex = new Exception(objDBResult.oraErrMsg.ToString());
            throw ex;
        }
    protected void btnSave_Click(object sender, EventArgs e)
{
    try
    {
        lblUserMsgText.Text = "";
        bool dcfm = ddlvbcfmseq.Enabled;
        string minup, dcfoption="";

        minup = txtminup.Text;

        if (rdbNone.Checked == true)
        {
            dcfoption = "NONE";
        }
        else if (rdbProcess.Checked == true)
        {
            dcfoption = "P";
        }
        else if (rdbData.Checked == true)
        {
            dcfoption = "D";
        }

        Index = Convert.ToInt32(rdbListradios.SelectedIndex);

        SaveItem();

        RetainClientControlValues(dcfm, dcfoption, minup);
    }
    protected void btnExcMod_Click(object sender, EventArgs e)
{
    try
    {
        lblUserMsgText.Text = "";
        bool dcfm = ddlvbcfmseq.Enabled;
        string minup, dcfoption = "";
        Index = Convert.ToInt32(rdbListradios.SelectedIndex);
        minup = txtminup.Text;

        if (rdbNone.Checked == true)
        {
            dcfoption = "NONE";
        }
        else if (rdbProcess.Checked == true)
        {
            dcfoption = "P";
        }
        else if (rdbData.Checked == true)
        {
            dcfoption = "D";
        }

        Button btn = (Button)sender;
        int evntseq = Convert.ToInt32(btn.CommandArgument.ToString());

        RetainClientControlValues(dcfm, dcfoption, minup);
        //Response.Write("you clicked on button");
    }
=============================

  MinUp = rows["process_minimum_up"].ToString();
                        PIMSSource = rows["pims_source"].ToString();
                        //MinUp = Convert.ToDouble()
                        if (MinUp != string.Empty || MinUp.Length > 0)
                        {
                            MinUp = Convert.ToString(Convert.ToDouble(MinUp) * 100);
                        }     
    if (DCFoption != "P")
        {
            MinUp = "";
        }

        if (DcfmSeq != "0")
        {
            int caret;
            caret = ddlvbcfmseq.SelectedValue.IndexOf("^");
            DcfmSeq = DcfmSeq.Substring(0, caret);
        }

        if (DCFoption != "P" && ddlpdwnlst.SelectedItem.Value == "0")
        {
            MinUp = "";
        }

        if (PIMSTagId == "Not specified")
        {
            PIMSTagId = "";
        }

        if (MinUp != string.Empty || MinUp.Length > 0)
        {
            int n;
            if (int.TryParse(string.IsNullOrEmpty(txtminup.Text) ? "0" : txtminup.Text, out n))
            {
                MinUp = Convert.ToString(Convert.ToInt32(MinUp) / 100);
                if (Convert.ToInt32(MinUp) < 0)
                {
                    MinUp = "0";
                }
                else if (Convert.ToInt32(MinUp) > 1)
                {
                    MinUp = "1";
                }
            }
        }

        if ((DCFoption == string.Empty || DCFoption.Length < 1) || DCFoption == "D")
        {
            MinUp = "";
        }

        if (MinUp != string.Empty || MinUp.Length > 0)
        {
            int n;
            if (int.TryParse(string.IsNullOrEmpty(txtminup.Text) ? "0" : txtminup.Text, out n))
            {
              if (Convert.ToDouble(MinUp) <= 0)
              {
                  MinUp = ".0001";
              }
            }
        }
    if (rdbProcess.Checked == true && (txtminup.Text == string.Empty || txtminup.Text.Length < 1) && ddlpdwnlst.SelectedItem.Value == "0")
                                                            {
                                                                Utilities.ShowAlert(this.Page, Resources.Resource.RIPimsUpload_MinUptime.ToString());
                                                                txtminup.Focus();
    int n;
                                                                        if (!int.TryParse(string.IsNullOrEmpty(txtRound.Text) ? "0" : txtRound.Text, out n))
                                                                        {
                                                                            Utilities.ShowAlert(this.Page, Resources.Resource.RIPimsUpload_RoundingNum.ToString());
                                                                        }
                                                                        else if (!IsDouble(txtminup.Text))
    try
    {
        DBResults objDBResult = new DBResults();
        WEIS.RIPimsUpload objRI = new WEIS.RIPimsUpload();
        objDBResult = objRI.SaveItemInsert(reciseq, shortname, name, eiscprocess2, period, media, euseq, eqmtseq, eiscuom, pollseq, dcfmseq, rounding, formula, physmin, physmax, warn1min, warn1max, warn2min, warn2max, pimsStatus, pimsTagidp, datapoint, freq, periodoffset, initpimstTagId, initDataPoint, initLoadFrequency, initperiodoffset, day0result, retention, audituser, dcfoption, minup, pimssource);

        if (objDBResult.oraErrMsg.Trim().ToString().Length > 1)
        {
            Exception ex = new Exception(objDBResult.oraErrMsg.ToString());
            throw ex;
        }

        return objDBResult.oraIntReturn;
    }
    protected int SaveItemUpdate(int reciseq, string shortname, string name, int eiscprocess2, int period, int media, int euseq, int eqmtseq, int eiscuom, int pollseq, int dcfmseq, string rounding, string formula, string physmin, string physmax, string warn1min, string warn1max, string warn2min, string warn2max, string pimsStatus, string pimsTagidp, string datapoint, string freq, char periodoffset, string initpimstTagId, char initDataPoint, char initLoadFrequency, char initperiodoffset, string day0result, string retention, string audituser, string dcfoption, string minup, string pimssource)
{
    try
    {
        DBResults objDBResult = new DBResults();
        WEIS.RIPimsUpload objRI = new WEIS.RIPimsUpload();
        objDBResult = objRI.SaveItemUpdate(reciseq, shortname, name, eiscprocess2, period, media, euseq, eqmtseq, eiscuom, pollseq, dcfmseq, rounding, formula, physmin, physmax, warn1min, warn1max, warn2min, warn2max, pimsStatus, pimsTagidp, datapoint, freq, periodoffset, initpimstTagId, initDataPoint, initLoadFrequency, initperiodoffset, day0result, retention, audituser, dcfoption, minup, pimssource);

        if (objDBResult.oraErrMsg.Trim().ToString().Length > 1)
        {
            Exception ex = new Exception(objDBResult.oraErrMsg.ToString());
            throw ex;
        }
    protected void btnSave_Click(object sender, EventArgs e)
{
    try
    {
        lblUserMsgText.Text = "";
        bool dcfm = ddlvbcfmseq.Enabled;
        string minup, dcfoption="";

        minup = txtminup.Text;

        if (rdbNone.Checked == true)
        {
            dcfoption = "NONE";
        }
        else if (rdbProcess.Checked == true)
        {
            dcfoption = "P";
        }
        else if (rdbData.Checked == true)
        {
            dcfoption = "D";
        }

        Index = Convert.ToInt32(rdbListradios.SelectedIndex);

        SaveItem();

        RetainClientControlValues(dcfm, dcfoption, minup);
    }
    protected void btnExcMod_Click(object sender, EventArgs e)
{
    try
    {
        lblUserMsgText.Text = "";
        bool dcfm = ddlvbcfmseq.Enabled;
        string minup, dcfoption = "";
        Index = Convert.ToInt32(rdbListradios.SelectedIndex);
        minup = txtminup.Text;

        if (rdbNone.Checked == true)
        {
            dcfoption = "NONE";
        }
        else if (rdbProcess.Checked == true)
        {
            dcfoption = "P";
        }
        else if (rdbData.Checked == true)
        {
            dcfoption = "D";
        }

        Button btn = (Button)sender;
        int evntseq = Convert.ToInt32(btn.CommandArgument.ToString());

        RetainClientControlValues(dcfm, dcfoption, minup);
        //Response.Write("you clicked on button");
    }
==============================

  MinUp = rows["process_minimum_up"].ToString();
                        PIMSSource = rows["pims_source"].ToString();
                        //MinUp = Convert.ToDouble()
                        if (MinUp != string.Empty || MinUp.Length > 0)
                        {
                            MinUp = Convert.ToString(Convert.ToDouble(MinUp) * 100);
                        }     
    if (DCFoption != "P")
        {
            MinUp = "";
        }

        if (DcfmSeq != "0")
        {
            int caret;
            caret = ddlvbcfmseq.SelectedValue.IndexOf("^");
            DcfmSeq = DcfmSeq.Substring(0, caret);
        }

        if (DCFoption != "P" && ddlpdwnlst.SelectedItem.Value == "0")
        {
            MinUp = "";
        }

        if (PIMSTagId == "Not specified")
        {
            PIMSTagId = "";
        }

        if (MinUp != string.Empty || MinUp.Length > 0)
        {
            int n;
            if (int.TryParse(string.IsNullOrEmpty(txtminup.Text) ? "0" : txtminup.Text, out n))
            {
                MinUp = Convert.ToString(Convert.ToInt32(MinUp) / 100);
                if (Convert.ToInt32(MinUp) < 0)
                {
                    MinUp = "0";
                }
                else if (Convert.ToInt32(MinUp) > 1)
                {
                    MinUp = "1";
                }
            }
        }

        if ((DCFoption == string.Empty || DCFoption.Length < 1) || DCFoption == "D")
        {
            MinUp = "";
        }

        if (MinUp != string.Empty || MinUp.Length > 0)
        {
            int n;
            if (int.TryParse(string.IsNullOrEmpty(txtminup.Text) ? "0" : txtminup.Text, out n))
            {
              if (Convert.ToDouble(MinUp) <= 0)
              {
                  MinUp = ".0001";
              }
            }
        }
    if (rdbProcess.Checked == true && (txtminup.Text == string.Empty || txtminup.Text.Length < 1) && ddlpdwnlst.SelectedItem.Value == "0")
                                                            {
                                                                Utilities.ShowAlert(this.Page, Resources.Resource.RIPimsUpload_MinUptime.ToString());
                                                                txtminup.Focus();
    int n;
                                                                        if (!int.TryParse(string.IsNullOrEmpty(txtRound.Text) ? "0" : txtRound.Text, out n))
                                                                        {
                                                                            Utilities.ShowAlert(this.Page, Resources.Resource.RIPimsUpload_RoundingNum.ToString());
                                                                        }
                                                                        else if (!IsDouble(txtminup.Text))
    try
    {
        DBResults objDBResult = new DBResults();
        WEIS.RIPimsUpload objRI = new WEIS.RIPimsUpload();
        objDBResult = objRI.SaveItemInsert(reciseq, shortname, name, eiscprocess2, period, media, euseq, eqmtseq, eiscuom, pollseq, dcfmseq, rounding, formula, physmin, physmax, warn1min, warn1max, warn2min, warn2max, pimsStatus, pimsTagidp, datapoint, freq, periodoffset, initpimstTagId, initDataPoint, initLoadFrequency, initperiodoffset, day0result, retention, audituser, dcfoption, minup, pimssource);

        if (objDBResult.oraErrMsg.Trim().ToString().Length > 1)
        {
            Exception ex = new Exception(objDBResult.oraErrMsg.ToString());
            throw ex;
        }

        return objDBResult.oraIntReturn;
    }
    protected int SaveItemUpdate(int reciseq, string shortname, string name, int eiscprocess2, int period, int media, int euseq, int eqmtseq, int eiscuom, int pollseq, int dcfmseq, string rounding, string formula, string physmin, string physmax, string warn1min, string warn1max, string warn2min, string warn2max, string pimsStatus, string pimsTagidp, string datapoint, string freq, char periodoffset, string initpimstTagId, char initDataPoint, char initLoadFrequency, char initperiodoffset, string day0result, string retention, string audituser, string dcfoption, string minup, string pimssource)
{
    try
    {
        DBResults objDBResult = new DBResults();
        WEIS.RIPimsUpload objRI = new WEIS.RIPimsUpload();
        objDBResult = objRI.SaveItemUpdate(reciseq, shortname, name, eiscprocess2, period, media, euseq, eqmtseq, eiscuom, pollseq, dcfmseq, rounding, formula, physmin, physmax, warn1min, warn1max, warn2min, warn2max, pimsStatus, pimsTagidp, datapoint, freq, periodoffset, initpimstTagId, initDataPoint, initLoadFrequency, initperiodoffset, day0result, retention, audituser, dcfoption, minup, pimssource);

        if (objDBResult.oraErrMsg.Trim().ToString().Length > 1)
        {
            Exception ex = new Exception(objDBResult.oraErrMsg.ToString());
            throw ex;
        }
    protected void btnSave_Click(object sender, EventArgs e)
{
    try
    {
        lblUserMsgText.Text = "";
        bool dcfm = ddlvbcfmseq.Enabled;
        string minup, dcfoption="";

        minup = txtminup.Text;

        if (rdbNone.Checked == true)
        {
            dcfoption = "NONE";
        }
        else if (rdbProcess.Checked == true)
        {
            dcfoption = "P";
        }
        else if (rdbData.Checked == true)
        {
            dcfoption = "D";
        }

        Index = Convert.ToInt32(rdbListradios.SelectedIndex);

        SaveItem();

        RetainClientControlValues(dcfm, dcfoption, minup);
    }
    protected void btnExcMod_Click(object sender, EventArgs e)
{
    try
    {
        lblUserMsgText.Text = "";
        bool dcfm = ddlvbcfmseq.Enabled;
        string minup, dcfoption = "";
        Index = Convert.ToInt32(rdbListradios.SelectedIndex);
        minup = txtminup.Text;

        if (rdbNone.Checked == true)
        {
            dcfoption = "NONE";
        }
        else if (rdbProcess.Checked == true)
        {
            dcfoption = "P";
        }
        else if (rdbData.Checked == true)
        {
            dcfoption = "D";
        }

        Button btn = (Button)sender;
        int evntseq = Convert.ToInt32(btn.CommandArgument.ToString());

        RetainClientControlValues(dcfm, dcfoption, minup);
        //Response.Write("you clicked on button");
    }

@Umaheswaran谢谢你的提示

    int n;
    if (int.TryParse(string.IsNullOrEmpty(txtminup.Text) ? "0" : txtminup.Text, out n))
上面是初始代码,我将其更改为

     double n;
    if (double.TryParse(string.IsNullOrEmpty(txtminup.Text) ? "0" : txtminup.Text, out n))
    Convert.ToDouble 
无论它在什么地方转变为

   Convert.ToInt32
我把它改成了

     double n;
    if (double.TryParse(string.IsNullOrEmpty(txtminup.Text) ? "0" : txtminup.Text, out n))
    Convert.ToDouble 
我不知道是什么问题,因为我对asp.net和c不太熟悉,但更改上述代码解决了问题。现在,每当我输入一个数字,它都会变为百分比,并将其保存为正确的格式


谢谢大家的帮助和关心。我还有一些不同的问题。我会尽力解决它,如果不是,我会把它贴在这里,尽量简洁和中肯

问题是什么?你想让我们做什么?请解释更多这是代码中唯一进行计算的部分吗?将代码的其余部分张贴在它们相乘的地方,这也有助于看到更高的层次。您能否给我们代码的其余部分,因为这甚至不是一个公平的示例,因为
n
是从未使用过的解析值@A.Pasa如果您在此处列出的代码必须将整个num转换为十进制,则应使用类似以下的convert.ToString((float)convert.ToInt32(MinUp)/100)而不是convert.ToString(convert.ToInt32(MinUp)/100)