コード例 #1
0
        public Boolean updateHSNCode(HSNMapping map)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                string updateSQL = "update ProductHSNMapping set HSNCode='" + map.HSNCode +
                                   "',Status=" + map.Status +
                                   " where RowID=" + map.RowID;
                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("update", "ProductHSNMapping", "", updateSQL) +
                           Main.QueryDelimiter;
                if (!UpdateTable.UT(utString))
                {
                    status = false;
                }
            }
            catch (Exception)
            {
                status = false;
            }
            return(status);
        }
コード例 #2
0
        public Boolean insertHSNCOde(HSNMapping map)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                string updateSQL = "insert into ProductHSNMapping (StockItemID,ModelNo,HSNCode,Status,CreateTime,CreateUser)" +
                                   " values (" +
                                   "'" + map.StockItemID + "'," +
                                   "'" + map.ModelNo + "'," +
                                   "'" + map.HSNCode + "'," +
                                   map.Status + "," +
                                   "GETDATE()" + "," +
                                   "'" + Login.userLoggedIn + "'" + ")";
                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("insert", "ProductHSNMapping", "", updateSQL) +
                           Main.QueryDelimiter;
                if (!UpdateTable.UT(utString))
                {
                    status = false;
                }
            }
            catch (Exception)
            {
                status = false;
            }
            return(status);
        }
コード例 #3
0
        public Boolean validateHSNMapping(HSNMapping map)
        {
            Boolean status = true;

            try
            {
                if (map.StockItemID.Trim().Length == 0 || map.StockItemID == null)
                {
                    return(false);
                }
                if (map.HSNCode.Trim().Length == 0 || map.HSNCode == null || Convert.ToInt32(map.HSNCode) == 0)
                {
                    return(false);
                }
            }
            catch (Exception)
            {
            }
            return(status);
        }
コード例 #4
0
        public List <HSNMapping> getHSNMappingList()
        {
            HSNMapping        map;
            List <HSNMapping> mapList = new List <HSNMapping>();

            try
            {
                SqlConnection conn  = new SqlConnection(Login.connString);
                string        query = "select a.StockItemID, b.Name,a.ModelNo,c.ModelName,a.HSNCode," +
                                      "a.Status,a.CreateTime,a.CreateUser,a.RowID " +
                                      "from ProductHSNMapping a left outer join " +
                                      "StockItem b on a.StockItemID = b.StockItemID left outer join " +
                                      "ProductModel c on a.StockItemID = c.StockItemID AND a.ModelNo = c.ModelNo " +
                                      "order by a.StockItemID";
                SqlCommand cmd = new SqlCommand(query, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    map               = new HSNMapping();
                    map.StockItemID   = reader.GetString(0);
                    map.StockItemName = reader.GetString(1);
                    map.ModelNo       = reader.IsDBNull(2) ? "NA":reader.GetString(2);
                    map.ModelName     = reader.IsDBNull(3) ? "NA":reader.GetString(3);
                    map.HSNCode       = reader.GetString(4);
                    map.Status        = reader.GetInt32(5);
                    map.CreateTime    = reader.GetDateTime(6);
                    map.CreateUser    = reader.GetString(7);
                    map.RowID         = reader.GetInt32(8);
                    mapList.Add(map);
                }
                conn.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Error querying HSNMApping Data");
            }
            return(mapList);
        }