Пример #1
0
    /// <summary>
    /// 将信息写入库
    /// </summary>
    private int Writedata(int status)
    {
        CARDataBLL dataBll = new CARDataBLL(CurrentFactoryID);
        DataInfo   info    = new DataInfo();

        if (did == 0)
        {
            info.rkey      = 0;
            info.FactoryID = decimal.Parse(CurrentFactoryID.ToString());
            info.serial_no = Serial_No.SelectedItem.Text;
        }
        else
        {
            info = dataBll.GetByKey(did);
            if (info.status == 14)
            {
                decimal fid     = decimal.Parse(info.FactoryID.ToString());
                string  strTemp = info.serial_no;
                info           = new DataInfo();
                info.rkey      = did;
                info.FactoryID = fid;
                info.serial_no = strTemp;
            }
        }
        info.required_date = Convert.ToDateTime(Required_Date.Text);
        info.happen_date   = DateTime.Parse(Happen_Date.Text);
        info.issued_date   = DateTime.Now;
        info.from_comp     = From_Comp.Text;
        info.car_comp      = CAR_Comp.Text;
        info.issued_user   = Issued_User.Text;
        info.issued_app    = Issued_APP.Text;
        info.received_user = Received_User.Text;
        info.car_content   = CAR_Content.Text;
        info.op_type       = 1;
        info.status        = status;
        info.nowuser       = CurrentUser.UserADAcount;//发起人

        int a = 0;

        if (did == 0)
        {
            a = dataBll.AddData(info);
        }
        else
        {
            a = dataBll.UpdateData(info);
        }
        if (a != 0)
        {
            return(-1);
        }
        return(int.Parse(info.rkey.ToString()));
    }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //for (int i = 0; i < TreeView1.Nodes.Count; i++)
         //{
         //    for (int j = 0; j < TreeView1.Nodes[i].ChildNodes.Count; j++)
         //    {
         //        TreeView1.Nodes[i].ChildNodes[j].NavigateUrl = TreeView1.Nodes[i].ChildNodes[j].NavigateUrl + "?FID=" + CurrentFactoryID.ToString();
         //    }
         //}
         foreach (TreeNode node in TreeView1.Nodes)
         {
             foreach (TreeNode childnode in node.ChildNodes)
             {
                 childnode.NavigateUrl = childnode.NavigateUrl + "?FID=" + CurrentFactoryID.ToString();
             }
         }
     }
 }
Пример #3
0
    private void showData(string strSQL, bool isFirst)
    {
        try
        {
            if (CurrentUser.RightIsAdmin)
            {
                string strConn = System.Configuration.ConfigurationManager.ConnectionStrings[CurrentFactoryID.ToString()].ToString();
                if (!strConn.Trim().Equals(string.Empty))
                {
                    strConn     = strConn.Substring(0, strConn.ToLower().IndexOf("user"));
                    label1.Text = "" + strConn.Replace(" ", "").Replace(";", "").Replace("DataSource=", "服务器:").Replace("InitialCatalog=", "  数据库:");
                }
            }

            SqlCommand command = new SqlCommand();
            command.CommandTimeout = 60;
            command.CommandText    = strSQL;

            labelSQL.Text = command.CommandText;

            command.Connection = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings[CurrentFactoryID.ToString()].ToString());
            // 返回DataSet数据集
            ds = FounderTecInfoSys.Common.SQLBase.ERPSQLManager.GetInstance().GetSQL(command);
            // 返回DataTable
            DataTable dt = new DataTable();
            FounderTecInfoSys.Common.SQLBase.ERPSQLManager.GetInstance().GetSQL(dt, command);

            if (ds.Tables.Count == 0)
            {
                buttonChange.Enabled = false;
                buttonSearch.Enabled = false;

                string strWarming = @"<br/><br/><br/><strong>错误提示:</strong> <br/> 1. 您的添加的查询条件不成立,或其中有错误的操作符;<br/> 2. 报表读取出现异常,请与管理员联系一下,我们会尽快解决。<br/>";
                if (CurrentUser.RightIsAdmin)
                {
                    strWarming += "3. SQL语句出现问题,请跟踪一下SQL语句的执行情况";

                    if (null != Session[FounderTecInfoSys.Common.ConstForSession.ErrorMessage])
                    {
                        strWarming += "<br/><br/><div style='background-color:#efefef'><br/><strong><font color=red>SQL执行器捕获的错误为:</font></strong><br/>&nbsp;&nbsp;&nbsp;&nbsp;" + Session[FounderTecInfoSys.Common.ConstForSession.ErrorMessage].ToString() + "<br/><br/></div>";
                    }
                }
                strWarming += @"<br/><br/><br/><br/><br/>";
                Response.Write(strWarming);
                return;
            }

            if (isFirst)
            {
                checkBoxListColumn.Items.Clear();

                for (int i = ds.Tables[0].Columns.Count - 1; i >= 0; i--)
                {
                    DataColumn dc = ds.Tables[0].Columns[i];
                    if (!isShowSpecialField)
                    {
                        if (!string.IsNullOrEmpty(strSpecialField) && FounderTecInfoSys.Common.CommonFunction.FuncForString.isContain(strSpecialField, dc.ColumnName, ','))
                        {
                            ds.Tables[0].Columns.Remove(dc);
                            continue;
                        }
                    }

                    ListItem item = new ListItem(dc.ColumnName);

                    item.Selected = true;
                    checkBoxListColumn.Items.Insert(0, item);
                }
            }

            for (int i = ds.Tables[0].Columns.Count - 1; i >= 0; i--)
            {
                DataColumn dc = ds.Tables[0].Columns[i];
                // 特殊字段显示与否
                if (!isShowSpecialField)
                {
                    if (!string.IsNullOrEmpty(strSpecialField) && FounderTecInfoSys.Common.CommonFunction.FuncForString.isContain(strSpecialField, dc.ColumnName, ','))
                    {
                        ds.Tables[0].Columns.Remove(dc);
                        continue;
                    }
                }
            }

            dsCurrent = ds.Copy();

            if (!isFirst)
            {
                foreach (ListItem item in checkBoxListColumn.Items)
                {
                    if (!item.Selected)
                    {
                        if (dsCurrent.Tables[0].Columns.Contains(item.Text))
                        {
                            dsCurrent.Tables[0].Columns.Remove(item.Text);
                        }
                    }
                }
            }



            gridDataBinding();

            buttonChange.Enabled = true;

            #region 条数限定提示
            if (isLimited && isFirst)
            {
                int totalCount = Convert.ToInt32(ds.Tables[1].Rows[0][0]);
                if (totalCount > 3000)
                {
                    FounderTecInfoSys.Common.PageGeneralAction.ShowWarmingWindow("查询的记录总数为: [" + totalCount.ToString() + "]  当前显示的条件为: [ 3000 ]");
                }
            }
            #endregion
        }
        catch (Exception ex)
        {
            buttonChange.Enabled = false;
            buttonSearch.Enabled = false;
            string strWarming = @"<strong>出现错误:</strong>请与管理员联系!<br>";
            if (CurrentUser.RightIsAdmin)
            {
                strWarming += "详细错误信息如下:<br/>" + ex.Message + "<br /><br />错误来源:" + ex.Source;
            }
            Response.Write(strWarming);
        }
    }
Пример #4
0
    /// <summary>
    /// 将信息写入库
    /// </summary>
    private int Writedata(int status)
    {
        CARDataBLL dataBll = new CARDataBLL(CurrentFactoryID);
        DataInfo   info    = new DataInfo();

        if (did == 0)
        {
            info.rkey      = 0;
            info.FactoryID = decimal.Parse(CurrentFactoryID.ToString());
        }
        else
        {
            info = dataBll.GetByKey(did);
            if (info.status == 14)
            {
                decimal fid     = decimal.Parse(info.FactoryID.ToString());
                string  strTemp = info.serial_no;
                info           = new DataInfo();
                info.rkey      = did;
                info.FactoryID = fid;
                info.serial_no = strTemp;
            }
        }
        try { info.happen_date = Convert.ToDateTime(happen_date.Text); }
        catch { info.happen_date = DateTime.Now; }
        try{ info.required_date = Convert.ToDateTime(Required_Date.Text); }
        catch {}
        info.issued_user   = Issued_User.Text;
        info.issued_app    = Issued_APP.Text;
        info.received_user = Received_User.Text;
        info.car_part_num  = CAR_Part_Num.Text;
        info.from_comp     = From_Comp.SelectedItem.Text;
        info.car_comp      = CAR_Comp.SelectedItem.Text;
        info.serial_no     = Serial_No.Text.Trim();
        if (HSF_Happen_Type_1.Checked == true)
        {
            info.hsf_happen_type = "1";
        }
        else if (HSF_Happen_Type_2.Checked == true)
        {
            info.hsf_happen_type = "2";
        }
        else if (HSF_Happen_Type_3.Checked == true)
        {
            info.hsf_happen_type = "3";
        }
        else if (HSF_Happen_Type_4.Checked == true)
        {
            info.hsf_happen_type = "4";
        }
        else if (HSF_Happen_Type_5.Checked == true)
        {
            info.hsf_happen_type = "5";
        }
        info.car_content = CAR_Content.Text;
        info.lot         = LOT.Text;
        try { info.batch = float.Parse(batch.Text); }
        catch { info.batch = 0; }
        try { info.badness_num = float.Parse(badness_Num.Text); }
        catch { info.badness_num = 0; }
        try { info.rework = float.Parse(ReWork.Text); }
        catch { info.rework = 0; }
        try { info.reject = float.Parse(Reject.Text); }
        catch { info.reject = 0; }
        try { info.nowork = float.Parse(NoWork.Text); }
        catch { info.nowork = 0; }
        info.issued_date = DateTime.Now;

        info.op_type = 2;
        info.status  = status;
        info.nowuser = CurrentUser.UserADAcount;//发起人

        int a = 0;

        if (did == 0)
        {
            a = dataBll.AddData(info);
        }
        else
        {
            a = dataBll.UpdateData(info);
        }
        if (a != 0)
        {
            return(-1);
        }
        return(int.Parse(info.rkey.ToString()));
    }