コード例 #1
0
ファイル: bllPickList.cs プロジェクト: ahmadmujtaba/BMC
 public DataTable GetPickListDetail(mdlPickList picklist)
 {
     DataTable dt = new DataTable();
     dt = obj_PickList.GetPickListDetail(picklist);
     return dt;
 }
コード例 #2
0
ファイル: frmParameterNew.cs プロジェクト: ahmadmujtaba/BMC
            private void MyTextBox_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
            {
                if (e.KeyCode == Keys.F10)
                {
                    m_Arr1 = this.Tag.ToString().Split(';');
                    if (m_Arr1.Length > 3)
                    {

                        ERPMDL.mdlPickList obj_pickList = new mdlPickList();
                        frmPickList pickList = new frmPickList(obj_pickList);
                        obj_pickList.PickListID = m_Arr1[3].Trim(' ');
                        obj_pickList.ReturnFieldName = m_Arr1[4].Trim(' ');
                        GlobalVar.g_pickListMultiSelection = true;
                        pickList.ShowDialog(this);
                        this.Text = obj_pickList.ReturnFieldValue;

                    }
                }
            }
コード例 #3
0
ファイル: frmPickList.cs プロジェクト: ahmadmujtaba/BMC
 public frmPickList(mdlPickList picklist)
 {
     obj_mdlPicklist = picklist;
     InitializeComponent();
 }
コード例 #4
0
ファイル: dalPickList.cs プロジェクト: ahmadmujtaba/BMC
        public DataTable GetPickListDetail(mdlPickList picklist)
        {
            DataTable dt = new DataTable();
            try
            {
                SqlCommand cmd = new SqlCommand("stp_ERP_PickList_Select", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@PickListId", SqlDbType.VarChar, 25).Value = picklist.PickListID;
                //cmd.Parameters.Add("@pk_picklistId", SqlDbType.VarChar, 16).Value = picklist.WhereClause;
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    reader.Read();
                    picklist.g_SQLQry = reader.GetValue(2).ToString();
                    picklist.g_GridFormat = reader.GetValue(3).ToString();
                    picklist.g_GridCaption = reader.GetValue(4).ToString();
                }
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }

                cmd = new SqlCommand(picklist.g_SQLQry, conn);
                cmd.CommandType = CommandType.StoredProcedure;
                if (picklist.WhereClause != null)
                {
                    char[] SeperateComa = { ',' };
                    char[] SeperateEqual = { '=' };

                    string WhereCondition = picklist.WhereClause;
                    string[] ParameterValue = WhereCondition.Split(SeperateComa);
                    string Condition = "";
                    string[] Parameter = null;
                    foreach (string s in ParameterValue)
                    {
                        Condition = s.Trim();
                        if (s.Contains(','))
                        {
                            Parameter = Condition.Split(SeperateEqual);
                            cmd.Parameters.Add(Parameter[0].Trim(), SqlDbType.VarChar, 50).Value = Parameter[1].Trim();
                            Parameter = null;
                        }
                        else
                        {

                            cmd.Parameters.Add("@WhereClause", SqlDbType.VarChar, 50).Value = picklist.WhereClause;
                            Parameter = null;
                        }

                    }

                }

                SqlDataAdapter ad = new SqlDataAdapter(cmd);
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                conn.Open();
                ad.Fill(dt);

                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "ERP - Babar Medicine Company Lahore", MessageBoxButtons.OK, MessageBoxIcon.Error);
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            return dt;
        }