Ejemplo n.º 1
0
        /// <summary>
        /// 加载供应商档案信息
        /// </summary>
        private void LoadInfo(string supperId)
        {
            if (!string.IsNullOrEmpty(supperId))
            {
                //1.加载供应商档案主信息
                DataTable dt = DBHelper.GetTable("查看一条供应商档案信息", "tb_supplier", "*", " sup_id='" + supperId + "'", "", "");
                if (dt != null && dt.Rows.Count > 0)
                {
                    tb_supplier model = new tb_supplier();
                    CommonFuncCall.SetModlByDataTable(model, dt);
                    CommonFuncCall.SetShowControlValue(this, model, "View");

                    DataTable dt_bill = CommonFuncCall.GetDataTable();
                    if (!string.IsNullOrEmpty(model.sup_type))
                    {
                        lblsup_type.Text = CommonFuncCall.GetBillNameByBillCode(dt_bill, model.sup_type);
                    }
                    if (!string.IsNullOrEmpty(model.unit_properties))
                    {
                        lblunit_properties.Text = CommonFuncCall.GetBillNameByBillCode(dt_bill, model.unit_properties);
                    }
                    if (!string.IsNullOrEmpty(model.price_type))
                    {
                        lblprice_type.Text = CommonFuncCall.GetBillNameByBillCode(dt_bill, model.price_type);
                    }
                    if (!string.IsNullOrEmpty(model.credit_class))
                    {
                        lblcredit_class.Text = CommonFuncCall.GetBillNameByBillCode(dt_bill, model.credit_class);
                    }
                    if (!string.IsNullOrEmpty(model.county))
                    {
                        lblsup_address.Text = CommonFuncCall.GetAddress(model.county) + " " + lblsup_address.Text;
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(model.city))
                        {
                            lblsup_address.Text = CommonFuncCall.GetAddress(model.city) + " " + lblsup_address.Text;
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(model.province))
                            {
                                lblsup_address.Text = CommonFuncCall.GetAddress(model.province) + " " + lblsup_address.Text;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 加载供应商档案信息
        /// </summary>
        private void LoadInfo(string workingTimeId)
        {
            if (!string.IsNullOrEmpty(workingTimeId))
            {
                //1.加载工时档案主信息
                DataTable dt = DBHelper.GetTable("查看一条工时档案信息", "v_workhours_users", "*", " whours_id='" + workingTimeId + "'", "", "");
                if (dt != null && dt.Rows.Count > 0)
                {
                    tb_workhours tb_workhours_Model = new tb_workhours();
                    CommonFuncCall.SetModlByDataTable(tb_workhours_Model, dt);
                    CommonFuncCall.SetShowControlValue(this, tb_workhours_Model, "");
                    if (tb_workhours_Model.whours_type == "1")
                    {
                        radIsWorkTime.Checked = true;
                    }
                    else if (tb_workhours_Model.whours_type == "2")
                    {
                        radIsQuota.Checked = true;
                    }
                    lblcreate_by.Text = dt.Rows[0]["create_username"].ToString();
                    lblupdate_by.Text = dt.Rows[0]["update_username"].ToString();

                    if (!string.IsNullOrEmpty(lblcreate_time.Text))
                    {
                        long ticks = (long)Convert.ToInt64(lblcreate_time.Text);
                        lblcreate_time.Text = Common.UtcLongToLocalDateTime(ticks).ToString();
                    }
                    if (!string.IsNullOrEmpty(lblupdate_time.Text))
                    {
                        long ticks = (long)Convert.ToInt64(lblupdate_time.Text);
                        lblupdate_time.Text = Common.UtcLongToLocalDateTime(ticks).ToString();
                    }

                    DataTable dt_bill = CommonFuncCall.GetDataTable();
                    if (!string.IsNullOrEmpty(tb_workhours_Model.repair_type))
                    {
                        lblrepair_type.Text = CommonFuncCall.GetBillNameByBillCode(dt_bill, tb_workhours_Model.repair_type);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 设置选择项后状态
        /// </summary>
        //void SetSelectedStatus()
        //{
        //    //已选择状态列表
        //    List<string> listFiles = new List<string>();
        //    listIDs.Clear();
        //    listStart.Clear();
        //    listStop.Clear();

        //    foreach (DataGridViewRow dgvr in dgvSupplierList.Rows)
        //    {
        //        if (Convert.ToBoolean(dgvr.Cells[colCheck.Name].EditedFormattedValue))
        //        {
        //            string cont_id = dgvr.Cells[suppID.Name].Value.ToString();
        //            listIDs.Add(cont_id);
        //            //if (dgvr.Cells[status.Name].Tag == null)
        //            //{
        //            //    continue;
        //            //}
        //            //enumStatus = (DataSources.EnumStatus)Convert.ToInt32(dgvr.Cells[status.Name].Value);//状态

        //            enumStatus = (DataSources.EnumStatus)Convert.ToInt32(dgvr.Cells[status.Name].Value);//状态

        //            if (enumStatus == DataSources.EnumStatus.Start)
        //            {
        //                listStart.Add(cont_id);
        //            }
        //            else if (enumStatus == DataSources.EnumStatus.Stop)
        //            {
        //                listStop.Add(cont_id);
        //            }
        //        }
        //    }
        //    #region 设置启用/停用
        //    if (listStart.Count > 0 && listStop.Count > 0)
        //    {
        //        btnStatus.Enabled = false;
        //    }
        //    else if (listStart.Count == 0 && listStop.Count == 0)
        //    {
        //        btnStatus.Enabled = false;
        //    }
        //    else if (listStart.Count > 0 && listStop.Count == 0)
        //    {
        //        btnStatus.Enabled = true;
        //        btnStatus.Caption = "停用";
        //        enumStatus = DataSources.EnumStatus.Start;
        //    }
        //    else if (listStart.Count == 0 && listStop.Count > 0)
        //    {
        //        btnStatus.Enabled = true;
        //        btnStatus.Caption = "启用";
        //        enumStatus = DataSources.EnumStatus.Stop;
        //    }
        //    #endregion


        //}
        #endregion

        #region dgv事件

        private void gvSupplierList_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.Value == null || e.Value.ToString() == string.Empty)
            {
                return;
            }
            string fieldNmae = dgvSupplierList.Columns[e.ColumnIndex].DataPropertyName;

            if (fieldNmae.Equals("create_time") || fieldNmae.Equals("update_time"))
            {
                long ticks = (long)e.Value;
                e.Value = Common.UtcLongToLocalDateTime(ticks);
            }
            if (fieldNmae.Equals("status"))
            {
                DataSources.EnumStatus enumDataSources = (DataSources.EnumStatus)Convert.ToInt16(e.Value.ToString());
                //e.Value = enumDataSources.ToString();
                e.Value = DataSources.GetDescription(enumDataSources, true);
            }
            if (fieldNmae.Equals("unit_properties") || fieldNmae.Equals("sup_type") || fieldNmae.Equals("credit_class"))
            {
                e.Value = CommonFuncCall.GetBillNameByBillCode(dt_bill, e.Value.ToString());
            }
        }